You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/07/09 11:50:42 UTC

[01/41] git commit: - upgrade to RestEasy 3.0 (MARMOTTA-266) - upgrade to Weld 2.0 (MARMOTTA-268) - upgrade to the proper PostgreSQL artifact

Updated Branches:
  refs/heads/develop 46db5029a -> fb5776427


- upgrade to RestEasy 3.0 (MARMOTTA-266)
- upgrade to Weld 2.0 (MARMOTTA-268)
- upgrade to the proper PostgreSQL artifact


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/f3cd9590
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/f3cd9590
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/f3cd9590

Branch: refs/heads/develop
Commit: f3cd959044fd3910f837ed3e9fbedb592924b7c3
Parents: 46db502
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Jul 8 14:58:38 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Jul 8 14:58:38 2013 +0200

----------------------------------------------------------------------
 .../main/resources/archetype-resources/pom.xml  |  2 +-
 launchers/marmotta-webapp/pom.xml               |  6 +---
 libraries/kiwi/kiwi-reasoner/pom.xml            |  2 +-
 libraries/kiwi/kiwi-sparql/pom.xml              |  2 +-
 libraries/kiwi/kiwi-transactions/pom.xml        |  2 +-
 libraries/kiwi/kiwi-triplestore/pom.xml         |  2 +-
 libraries/kiwi/kiwi-versioning/pom.xml          |  2 +-
 libraries/ldcache/ldcache-backend-kiwi/pom.xml  |  2 +-
 libraries/ldcache/ldcache-core/pom.xml          |  2 +-
 libraries/ldcache/ldcache-sail-kiwi/pom.xml     |  2 +-
 parent/pom.xml                                  | 33 +++++++++++++----
 .../core/servlet/MarmottaOptionsFilter.java     |  2 +-
 .../test/base/jetty/TestInjectorFactory.java    | 38 ++++++++++++++------
 13 files changed, 65 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/pom.xml b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/pom.xml
index d39ab45..b278e6c 100644
--- a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/pom.xml
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/pom.xml
@@ -217,7 +217,7 @@
             <version>${h2Version}</version>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <version>${postgresqlVersion}</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/launchers/marmotta-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/pom.xml b/launchers/marmotta-webapp/pom.xml
index 50b90e2..444f55f 100644
--- a/launchers/marmotta-webapp/pom.xml
+++ b/launchers/marmotta-webapp/pom.xml
@@ -101,10 +101,6 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.tomcat.maven</groupId>
-                <artifactId>tomcat6-maven-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.tomcat.maven</groupId>
                 <artifactId>tomcat7-maven-plugin</artifactId>
             </plugin>
             <plugin>
@@ -241,7 +237,7 @@
             <artifactId>h2</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/kiwi/kiwi-reasoner/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-reasoner/pom.xml b/libraries/kiwi/kiwi-reasoner/pom.xml
index 161d5a5..67e9a97 100644
--- a/libraries/kiwi/kiwi-reasoner/pom.xml
+++ b/libraries/kiwi/kiwi-reasoner/pom.xml
@@ -167,7 +167,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/kiwi/kiwi-sparql/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/pom.xml b/libraries/kiwi/kiwi-sparql/pom.xml
index ea9093b..baa1f0a 100644
--- a/libraries/kiwi/kiwi-sparql/pom.xml
+++ b/libraries/kiwi/kiwi-sparql/pom.xml
@@ -124,7 +124,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/kiwi/kiwi-transactions/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-transactions/pom.xml b/libraries/kiwi/kiwi-transactions/pom.xml
index 869afd2..c76886e 100644
--- a/libraries/kiwi/kiwi-transactions/pom.xml
+++ b/libraries/kiwi/kiwi-transactions/pom.xml
@@ -124,7 +124,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/kiwi/kiwi-triplestore/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/pom.xml b/libraries/kiwi/kiwi-triplestore/pom.xml
index bbb69a9..cfa62d2 100644
--- a/libraries/kiwi/kiwi-triplestore/pom.xml
+++ b/libraries/kiwi/kiwi-triplestore/pom.xml
@@ -151,7 +151,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/kiwi/kiwi-versioning/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-versioning/pom.xml b/libraries/kiwi/kiwi-versioning/pom.xml
index 3d0fc62..7a3dc74 100644
--- a/libraries/kiwi/kiwi-versioning/pom.xml
+++ b/libraries/kiwi/kiwi-versioning/pom.xml
@@ -129,7 +129,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/ldcache/ldcache-backend-kiwi/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/pom.xml b/libraries/ldcache/ldcache-backend-kiwi/pom.xml
index 1351f1a..a67f0a5 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/pom.xml
+++ b/libraries/ldcache/ldcache-backend-kiwi/pom.xml
@@ -161,7 +161,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/ldcache/ldcache-core/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/pom.xml b/libraries/ldcache/ldcache-core/pom.xml
index a979810..f406705 100644
--- a/libraries/ldcache/ldcache-core/pom.xml
+++ b/libraries/ldcache/ldcache-core/pom.xml
@@ -173,7 +173,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/libraries/ldcache/ldcache-sail-kiwi/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/pom.xml b/libraries/ldcache/ldcache-sail-kiwi/pom.xml
index 286ca00..e05681f 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/pom.xml
+++ b/libraries/ldcache/ldcache-sail-kiwi/pom.xml
@@ -194,7 +194,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jumpmind.symmetric.jdbc</groupId>
+            <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 837a7aa..d8b89a8 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -38,18 +38,19 @@
     <properties>
         <sesame.version>2.7.3</sesame.version>
         <junit.version>4.11</junit.version>
-        <weld.version>1.1.Final</weld.version>
-        <weld.core.version>1.1.13.Final</weld.core.version>
+        <weld.version>2.0.SP1</weld.version>
+        <weld.core.version>2.0.2.Final</weld.core.version>
         <rest.assured.version>1.7.1</rest.assured.version>
         <hamcrest.version>1.3</hamcrest.version>
         <tempus.fugit.version>1.1</tempus.fugit.version>
         <jatl.version>0.2.2</jatl.version>
         <servlet.api.version>3.0.1</servlet.api.version>
         <javax.el.version>2.2.4</javax.el.version>
-        <h2.version>1.3.170</h2.version>
-        <postgresql.version>9.2-1002-jdbc4</postgresql.version>
+        <h2.version>1.3.172</h2.version>
+        <postgresql.version>9.2-1003-jdbc4</postgresql.version>
         <mysql.version>5.1.21</mysql.version>
         <jetty.version>9.0.3.v20130506</jetty.version>
+        <resteasy.version>3.0.1.Final</resteasy.version>
     </properties>
 
     <prerequisites>
@@ -769,7 +770,7 @@
             <dependency>
                 <groupId>org.jboss.resteasy</groupId>
                 <artifactId>resteasy-cdi</artifactId>
-                <version>2.3.6.Final</version>
+                <version>${resteasy.version}</version>
                 <exclusions>
                     <exclusion>
                         <groupId>commons-logging</groupId>
@@ -780,7 +781,7 @@
             <dependency>
                 <groupId>org.jboss.resteasy</groupId>
                 <artifactId>resteasy-jackson-provider</artifactId>
-                <version>2.3.6.Final</version>
+                <version>${resteasy.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.codehaus.jackson</groupId>
@@ -842,6 +843,10 @@
                         <groupId>org.javassist</groupId>
                         <artifactId>javassist</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.spec.javax.el</groupId>
+                        <artifactId>jboss-el-api_3.0_spec</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
             <dependency>
@@ -853,6 +858,10 @@
                         <groupId>javax.el</groupId>
                         <artifactId>el-api</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.spec.javax.el</groupId>
+                        <artifactId>jboss-el-api_3.0_spec</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
             <dependency>
@@ -860,6 +869,16 @@
                 <artifactId>weld-servlet-core</artifactId>
                 <version>${weld.core.version}</version>
                 <scope>runtime</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.el</groupId>
+                        <artifactId>el-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.spec.javax.el</groupId>
+                        <artifactId>jboss-el-api_3.0_spec</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.javassist</groupId>
@@ -902,7 +921,7 @@
                 <version>${h2.version}</version>
             </dependency>
             <dependency>
-                <groupId>org.jumpmind.symmetric.jdbc</groupId>
+                <groupId>org.postgresql</groupId>
                 <artifactId>postgresql</artifactId>
                 <version>${postgresql.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaOptionsFilter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaOptionsFilter.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaOptionsFilter.java
index e81eb1b..d14209e 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaOptionsFilter.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaOptionsFilter.java
@@ -65,7 +65,7 @@ public class MarmottaOptionsFilter implements Filter {
      */
     @Override
     public void init(FilterConfig filterConfig) throws ServletException {
-        ResteasyProviderFactory.getInstance().addExceptionMapper(new OptionsMapper());
+        ResteasyProviderFactory.getInstance().registerProviderInstance(new OptionsMapper());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f3cd9590/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
index b7cf315..b712f35 100644
--- a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
@@ -27,6 +27,10 @@ import org.jboss.resteasy.spi.InjectorFactory;
 import org.jboss.resteasy.spi.MethodInjector;
 import org.jboss.resteasy.spi.PropertyInjector;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.jboss.resteasy.spi.metadata.Parameter;
+import org.jboss.resteasy.spi.metadata.ResourceClass;
+import org.jboss.resteasy.spi.metadata.ResourceConstructor;
+import org.jboss.resteasy.spi.metadata.ResourceLocator;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
@@ -65,7 +69,7 @@ public class TestInjectorFactory implements InjectorFactory {
     }
 
     @Override
-    public ConstructorInjector createConstructor(Constructor constructor) {
+    public ConstructorInjector createConstructor(Constructor constructor, ResteasyProviderFactory factory) {
         Class<?> clazz = constructor.getDeclaringClass();
 
         if (!manager.getBeans(clazz).isEmpty())
@@ -75,30 +79,44 @@ public class TestInjectorFactory implements InjectorFactory {
         }
 
         log.debug("No CDI beans found for {0}. Using default ConstructorInjector.", clazz);
-        return delegate.createConstructor(constructor);
+        return delegate.createConstructor(constructor, factory);
 
     }
 
     @Override
-    public PropertyInjector createPropertyInjector(Class resourceClass) {
-        return new CdiPropertyInjector(delegate.createPropertyInjector(resourceClass), resourceClass, Collections.<Class<?>, Type>emptyMap(), manager);
+    public PropertyInjector createPropertyInjector(Class resourceClass, ResteasyProviderFactory factory) {
+        return new CdiPropertyInjector(delegate.createPropertyInjector(resourceClass, factory), resourceClass, Collections.<Class<?>, Type>emptyMap(), manager);
     }
 
     @Override
-    public MethodInjector createMethodInjector(Class root, Method method) {
-        return delegate.createMethodInjector(root, method);
+    public MethodInjector createMethodInjector(ResourceLocator method, ResteasyProviderFactory factory) {
+        return delegate.createMethodInjector(method, factory);
     }
 
     @Override
-    public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations) {
-        return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations);
+    public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations, ResteasyProviderFactory factory) {
+        return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations, factory);
     }
 
     @Override
-    public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations, boolean useDefault) {
-        return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations, useDefault);
+    public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations, boolean useDefault, ResteasyProviderFactory factory) {
+        return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations, useDefault, factory);
     }
 
+    @Override
+    public ValueInjector createParameterExtractor(Parameter parameter, ResteasyProviderFactory providerFactory) {
+        return delegate.createParameterExtractor(parameter, providerFactory);
+    }
+
+    @Override
+    public PropertyInjector createPropertyInjector(ResourceClass resourceClass, ResteasyProviderFactory providerFactory) {
+        return delegate.createPropertyInjector(resourceClass, providerFactory);
+    }
+
+    @Override
+    public ConstructorInjector createConstructor(ResourceConstructor constructor, ResteasyProviderFactory providerFactory) {
+        return createConstructor(constructor.getConstructor(), providerFactory);
+    }
 
     /**
      * Lookup ResteasyCdiExtension instance that was instantiated during CDI bootstrap


[09/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode_ll1.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode_ll1.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode_ll1.js
deleted file mode 100644
index 2c1dd90..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode_ll1.js
+++ /dev/null
@@ -1,1765 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-CodeMirror.defineMode("sparql", function(config, parserConfig) {
-
-    var indentUnit = config.indentUnit;
-
-    // ll1_table is auto-generated from grammar 
-    // - do not edit manually
-    var ll1_table=
-    {
-  "*[&&, valueLogical]" : {
-     "&&": ["[&&, valueLogical]","*[&&, valueLogical]"], 
-     ")": [], 
-     ",": [], 
-     "||": []}, 
-  "*[,, expression]" : {
-     ",": ["[,, expression]","*[,, expression]"], 
-     ")": []}, 
-  "*[,, object]" : {
-     ",": ["[,, object]","*[,, object]"], 
-     ".": [], 
-     ";": [], 
-     "]": [], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "*[;, ?[verb, objectList]]" : {
-     ";": ["[;, ?[verb, objectList]]","*[;, ?[verb, objectList]]"], 
-     ".": [], 
-     "]": [], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "*[UNION, groupGraphPattern]" : {
-     "UNION": ["[UNION, groupGraphPattern]","*[UNION, groupGraphPattern]"], 
-     "VAR1": [], 
-     "VAR2": [], 
-     "NIL": [], 
-     "(": [], 
-     "[": [], 
-     "IRI_REF": [], 
-     "TRUE": [], 
-     "FALSE": [], 
-     "BLANK_NODE_LABEL": [], 
-     "ANON": [], 
-     "PNAME_LN": [], 
-     "PNAME_NS": [], 
-     "STRING_LITERAL1": [], 
-     "STRING_LITERAL2": [], 
-     "STRING_LITERAL_LONG1": [], 
-     "STRING_LITERAL_LONG2": [], 
-     "INTEGER": [], 
-     "DECIMAL": [], 
-     "DOUBLE": [], 
-     "INTEGER_POSITIVE": [], 
-     "DECIMAL_POSITIVE": [], 
-     "DOUBLE_POSITIVE": [], 
-     "INTEGER_NEGATIVE": [], 
-     "DECIMAL_NEGATIVE": [], 
-     "DOUBLE_NEGATIVE": [], 
-     ".": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": [], 
-     "}": []}, 
-  "*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]" : {
-     "FILTER": ["[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]","*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]"], 
-     "OPTIONAL": ["[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]","*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]"], 
-     "{": ["[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]","*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]"], 
-     "GRAPH": ["[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]","*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]"], 
-     "}": []}, 
-  "*[||, conditionalAndExpression]" : {
-     "||": ["[||, conditionalAndExpression]","*[||, conditionalAndExpression]"], 
-     ")": [], 
-     ",": []}, 
-  "*datasetClause" : {
-     "FROM": ["datasetClause","*datasetClause"], 
-     "WHERE": [], 
-     "{": []}, 
-  "*graphNode" : {
-     "(": ["graphNode","*graphNode"], 
-     "[": ["graphNode","*graphNode"], 
-     "VAR1": ["graphNode","*graphNode"], 
-     "VAR2": ["graphNode","*graphNode"], 
-     "NIL": ["graphNode","*graphNode"], 
-     "IRI_REF": ["graphNode","*graphNode"], 
-     "TRUE": ["graphNode","*graphNode"], 
-     "FALSE": ["graphNode","*graphNode"], 
-     "BLANK_NODE_LABEL": ["graphNode","*graphNode"], 
-     "ANON": ["graphNode","*graphNode"], 
-     "PNAME_LN": ["graphNode","*graphNode"], 
-     "PNAME_NS": ["graphNode","*graphNode"], 
-     "STRING_LITERAL1": ["graphNode","*graphNode"], 
-     "STRING_LITERAL2": ["graphNode","*graphNode"], 
-     "STRING_LITERAL_LONG1": ["graphNode","*graphNode"], 
-     "STRING_LITERAL_LONG2": ["graphNode","*graphNode"], 
-     "INTEGER": ["graphNode","*graphNode"], 
-     "DECIMAL": ["graphNode","*graphNode"], 
-     "DOUBLE": ["graphNode","*graphNode"], 
-     "INTEGER_POSITIVE": ["graphNode","*graphNode"], 
-     "DECIMAL_POSITIVE": ["graphNode","*graphNode"], 
-     "DOUBLE_POSITIVE": ["graphNode","*graphNode"], 
-     "INTEGER_NEGATIVE": ["graphNode","*graphNode"], 
-     "DECIMAL_NEGATIVE": ["graphNode","*graphNode"], 
-     "DOUBLE_NEGATIVE": ["graphNode","*graphNode"], 
-     ")": []}, 
-  "*or([[*, unaryExpression], [/, unaryExpression]])" : {
-     "*": ["or([[*, unaryExpression], [/, unaryExpression]])","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "/": ["or([[*, unaryExpression], [/, unaryExpression]])","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     ")": [], 
-     ",": [], 
-     "||": [], 
-     "&&": [], 
-     "=": [], 
-     "!=": [], 
-     "<": [], 
-     ">": [], 
-     "<=": [], 
-     ">=": [], 
-     "+": [], 
-     "-": [], 
-     "INTEGER_POSITIVE": [], 
-     "DECIMAL_POSITIVE": [], 
-     "DOUBLE_POSITIVE": [], 
-     "INTEGER_NEGATIVE": [], 
-     "DECIMAL_NEGATIVE": [], 
-     "DOUBLE_NEGATIVE": []}, 
-  "*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])" : {
-     "+": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "-": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "INTEGER_POSITIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DECIMAL_POSITIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DOUBLE_POSITIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "INTEGER_NEGATIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DECIMAL_NEGATIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DOUBLE_NEGATIVE": ["or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     ")": [], 
-     ",": [], 
-     "||": [], 
-     "&&": [], 
-     "=": [], 
-     "!=": [], 
-     "<": [], 
-     ">": [], 
-     "<=": [], 
-     ">=": []}, 
-  "*prefixDecl" : {
-     "PREFIX": ["prefixDecl","*prefixDecl"], 
-     "SELECT": [], 
-     "CONSTRUCT": [], 
-     "DESCRIBE": [], 
-     "ASK": []}, 
-  "*var" : {
-     "VAR1": ["var","*var"], 
-     "VAR2": ["var","*var"], 
-     "WHERE": [], 
-     "{": [], 
-     "FROM": []}, 
-  "*varOrIRIref" : {
-     "VAR1": ["varOrIRIref","*varOrIRIref"], 
-     "VAR2": ["varOrIRIref","*varOrIRIref"], 
-     "IRI_REF": ["varOrIRIref","*varOrIRIref"], 
-     "PNAME_LN": ["varOrIRIref","*varOrIRIref"], 
-     "PNAME_NS": ["varOrIRIref","*varOrIRIref"], 
-     "WHERE": [], 
-     "{": [], 
-     "FROM": []}, 
-  "+graphNode" : {
-     "(": ["graphNode","*graphNode"], 
-     "[": ["graphNode","*graphNode"], 
-     "VAR1": ["graphNode","*graphNode"], 
-     "VAR2": ["graphNode","*graphNode"], 
-     "NIL": ["graphNode","*graphNode"], 
-     "IRI_REF": ["graphNode","*graphNode"], 
-     "TRUE": ["graphNode","*graphNode"], 
-     "FALSE": ["graphNode","*graphNode"], 
-     "BLANK_NODE_LABEL": ["graphNode","*graphNode"], 
-     "ANON": ["graphNode","*graphNode"], 
-     "PNAME_LN": ["graphNode","*graphNode"], 
-     "PNAME_NS": ["graphNode","*graphNode"], 
-     "STRING_LITERAL1": ["graphNode","*graphNode"], 
-     "STRING_LITERAL2": ["graphNode","*graphNode"], 
-     "STRING_LITERAL_LONG1": ["graphNode","*graphNode"], 
-     "STRING_LITERAL_LONG2": ["graphNode","*graphNode"], 
-     "INTEGER": ["graphNode","*graphNode"], 
-     "DECIMAL": ["graphNode","*graphNode"], 
-     "DOUBLE": ["graphNode","*graphNode"], 
-     "INTEGER_POSITIVE": ["graphNode","*graphNode"], 
-     "DECIMAL_POSITIVE": ["graphNode","*graphNode"], 
-     "DOUBLE_POSITIVE": ["graphNode","*graphNode"], 
-     "INTEGER_NEGATIVE": ["graphNode","*graphNode"], 
-     "DECIMAL_NEGATIVE": ["graphNode","*graphNode"], 
-     "DOUBLE_NEGATIVE": ["graphNode","*graphNode"]}, 
-  "+var" : {
-     "VAR1": ["var","*var"], 
-     "VAR2": ["var","*var"]}, 
-  "+varOrIRIref" : {
-     "VAR1": ["varOrIRIref","*varOrIRIref"], 
-     "VAR2": ["varOrIRIref","*varOrIRIref"], 
-     "IRI_REF": ["varOrIRIref","*varOrIRIref"], 
-     "PNAME_LN": ["varOrIRIref","*varOrIRIref"], 
-     "PNAME_NS": ["varOrIRIref","*varOrIRIref"]}, 
-  "?." : {
-     ".": ["."], 
-     "VAR1": [], 
-     "VAR2": [], 
-     "NIL": [], 
-     "(": [], 
-     "[": [], 
-     "IRI_REF": [], 
-     "TRUE": [], 
-     "FALSE": [], 
-     "BLANK_NODE_LABEL": [], 
-     "ANON": [], 
-     "PNAME_LN": [], 
-     "PNAME_NS": [], 
-     "STRING_LITERAL1": [], 
-     "STRING_LITERAL2": [], 
-     "STRING_LITERAL_LONG1": [], 
-     "STRING_LITERAL_LONG2": [], 
-     "INTEGER": [], 
-     "DECIMAL": [], 
-     "DOUBLE": [], 
-     "INTEGER_POSITIVE": [], 
-     "DECIMAL_POSITIVE": [], 
-     "DOUBLE_POSITIVE": [], 
-     "INTEGER_NEGATIVE": [], 
-     "DECIMAL_NEGATIVE": [], 
-     "DOUBLE_NEGATIVE": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": [], 
-     "}": []}, 
-  "?WHERE" : {
-     "WHERE": ["WHERE"], 
-     "{": []}, 
-  "?[,, expression]" : {
-     ",": ["[,, expression]"], 
-     ")": []}, 
-  "?[., ?constructTriples]" : {
-     ".": ["[., ?constructTriples]"], 
-     "}": []}, 
-  "?[., ?triplesBlock]" : {
-     ".": ["[., ?triplesBlock]"], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "?[verb, objectList]" : {
-     "a": ["[verb, objectList]"], 
-     "VAR1": ["[verb, objectList]"], 
-     "VAR2": ["[verb, objectList]"], 
-     "IRI_REF": ["[verb, objectList]"], 
-     "PNAME_LN": ["[verb, objectList]"], 
-     "PNAME_NS": ["[verb, objectList]"], 
-     ";": [], 
-     ".": [], 
-     "]": [], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "?argList" : {
-     "NIL": ["argList"], 
-     "(": ["argList"], 
-     ")": [], 
-     ",": [], 
-     "||": [], 
-     "&&": [], 
-     "=": [], 
-     "!=": [], 
-     "<": [], 
-     ">": [], 
-     "<=": [], 
-     ">=": [], 
-     "+": [], 
-     "-": [], 
-     "INTEGER_POSITIVE": [], 
-     "DECIMAL_POSITIVE": [], 
-     "DOUBLE_POSITIVE": [], 
-     "INTEGER_NEGATIVE": [], 
-     "DECIMAL_NEGATIVE": [], 
-     "DOUBLE_NEGATIVE": [], 
-     "*": [], 
-     "/": []}, 
-  "?baseDecl" : {
-     "BASE": ["baseDecl"], 
-     "SELECT": [], 
-     "CONSTRUCT": [], 
-     "DESCRIBE": [], 
-     "ASK": [], 
-     "PREFIX": []}, 
-  "?constructTriples" : {
-     "VAR1": ["constructTriples"], 
-     "VAR2": ["constructTriples"], 
-     "NIL": ["constructTriples"], 
-     "(": ["constructTriples"], 
-     "[": ["constructTriples"], 
-     "IRI_REF": ["constructTriples"], 
-     "TRUE": ["constructTriples"], 
-     "FALSE": ["constructTriples"], 
-     "BLANK_NODE_LABEL": ["constructTriples"], 
-     "ANON": ["constructTriples"], 
-     "PNAME_LN": ["constructTriples"], 
-     "PNAME_NS": ["constructTriples"], 
-     "STRING_LITERAL1": ["constructTriples"], 
-     "STRING_LITERAL2": ["constructTriples"], 
-     "STRING_LITERAL_LONG1": ["constructTriples"], 
-     "STRING_LITERAL_LONG2": ["constructTriples"], 
-     "INTEGER": ["constructTriples"], 
-     "DECIMAL": ["constructTriples"], 
-     "DOUBLE": ["constructTriples"], 
-     "INTEGER_POSITIVE": ["constructTriples"], 
-     "DECIMAL_POSITIVE": ["constructTriples"], 
-     "DOUBLE_POSITIVE": ["constructTriples"], 
-     "INTEGER_NEGATIVE": ["constructTriples"], 
-     "DECIMAL_NEGATIVE": ["constructTriples"], 
-     "DOUBLE_NEGATIVE": ["constructTriples"], 
-     "}": []}, 
-  "?limitOffsetClauses" : {
-     "LIMIT": ["limitOffsetClauses"], 
-     "$": []}, 
-  "?offsetClause" : {
-     "OFFSET": ["offsetClause"], 
-     "$": []}, 
-  "?or([DISTINCT, REDUCED])" : {
-     "DISTINCT": ["or([DISTINCT, REDUCED])"], 
-     "REDUCED": ["or([DISTINCT, REDUCED])"], 
-     "*": [], 
-     "VAR1": [], 
-     "VAR2": []}, 
-  "?or([LANGTAG, [^^, iriRef]])" : {
-     "LANGTAG": ["or([LANGTAG, [^^, iriRef]])"], 
-     "^^": ["or([LANGTAG, [^^, iriRef]])"], 
-     "a": [], 
-     "VAR1": [], 
-     "VAR2": [], 
-     "IRI_REF": [], 
-     "PNAME_LN": [], 
-     "PNAME_NS": [], 
-     "(": [], 
-     "[": [], 
-     "NIL": [], 
-     "TRUE": [], 
-     "FALSE": [], 
-     "BLANK_NODE_LABEL": [], 
-     "ANON": [], 
-     "STRING_LITERAL1": [], 
-     "STRING_LITERAL2": [], 
-     "STRING_LITERAL_LONG1": [], 
-     "STRING_LITERAL_LONG2": [], 
-     "INTEGER": [], 
-     "DECIMAL": [], 
-     "DOUBLE": [], 
-     "INTEGER_POSITIVE": [], 
-     "DECIMAL_POSITIVE": [], 
-     "DOUBLE_POSITIVE": [], 
-     "INTEGER_NEGATIVE": [], 
-     "DECIMAL_NEGATIVE": [], 
-     "DOUBLE_NEGATIVE": [], 
-     ".": [], 
-     ";": [], 
-     ",": [], 
-     ")": [], 
-     "]": [], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": [], 
-     "||": [], 
-     "&&": [], 
-     "=": [], 
-     "!=": [], 
-     "<": [], 
-     ">": [], 
-     "<=": [], 
-     ">=": [], 
-     "+": [], 
-     "-": [], 
-     "*": [], 
-     "/": []}, 
-  "?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])" : {
-     "=": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "!=": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "<": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     ">": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "<=": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     ">=": ["or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     ")": [], 
-     ",": [], 
-     "||": [], 
-     "&&": []}, 
-  "?orderClause" : {
-     "ORDER": ["orderClause"], 
-     "LIMIT": [], 
-     "$": []}, 
-  "?propertyListNotEmpty" : {
-     "a": ["propertyListNotEmpty"], 
-     "VAR1": ["propertyListNotEmpty"], 
-     "VAR2": ["propertyListNotEmpty"], 
-     "IRI_REF": ["propertyListNotEmpty"], 
-     "PNAME_LN": ["propertyListNotEmpty"], 
-     "PNAME_NS": ["propertyListNotEmpty"], 
-     ".": [], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "?triplesBlock" : {
-     "VAR1": ["triplesBlock"], 
-     "VAR2": ["triplesBlock"], 
-     "NIL": ["triplesBlock"], 
-     "(": ["triplesBlock"], 
-     "[": ["triplesBlock"], 
-     "IRI_REF": ["triplesBlock"], 
-     "TRUE": ["triplesBlock"], 
-     "FALSE": ["triplesBlock"], 
-     "BLANK_NODE_LABEL": ["triplesBlock"], 
-     "ANON": ["triplesBlock"], 
-     "PNAME_LN": ["triplesBlock"], 
-     "PNAME_NS": ["triplesBlock"], 
-     "STRING_LITERAL1": ["triplesBlock"], 
-     "STRING_LITERAL2": ["triplesBlock"], 
-     "STRING_LITERAL_LONG1": ["triplesBlock"], 
-     "STRING_LITERAL_LONG2": ["triplesBlock"], 
-     "INTEGER": ["triplesBlock"], 
-     "DECIMAL": ["triplesBlock"], 
-     "DOUBLE": ["triplesBlock"], 
-     "INTEGER_POSITIVE": ["triplesBlock"], 
-     "DECIMAL_POSITIVE": ["triplesBlock"], 
-     "DOUBLE_POSITIVE": ["triplesBlock"], 
-     "INTEGER_NEGATIVE": ["triplesBlock"], 
-     "DECIMAL_NEGATIVE": ["triplesBlock"], 
-     "DOUBLE_NEGATIVE": ["triplesBlock"], 
-     "}": [], 
-     "FILTER": [], 
-     "OPTIONAL": [], 
-     "{": [], 
-     "GRAPH": []}, 
-  "[!, primaryExpression]" : {
-     "!": ["!","primaryExpression"]}, 
-  "[!=, numericExpression]" : {
-     "!=": ["!=","numericExpression"]}, 
-  "[&&, valueLogical]" : {
-     "&&": ["&&","valueLogical"]}, 
-  "[*, unaryExpression]" : {
-     "*": ["*","unaryExpression"]}, 
-  "[+, multiplicativeExpression]" : {
-     "+": ["+","multiplicativeExpression"]}, 
-  "[+, primaryExpression]" : {
-     "+": ["+","primaryExpression"]}, 
-  "[,, expression]" : {
-     ",": [",","expression"]}, 
-  "[,, object]" : {
-     ",": [",","object"]}, 
-  "[-, multiplicativeExpression]" : {
-     "-": ["-","multiplicativeExpression"]}, 
-  "[-, primaryExpression]" : {
-     "-": ["-","primaryExpression"]}, 
-  "[., ?constructTriples]" : {
-     ".": [".","?constructTriples"]}, 
-  "[., ?triplesBlock]" : {
-     ".": [".","?triplesBlock"]}, 
-  "[/, unaryExpression]" : {
-     "/": ["/","unaryExpression"]}, 
-  "[;, ?[verb, objectList]]" : {
-     ";": [";","?[verb, objectList]"]}, 
-  "[<, numericExpression]" : {
-     "<": ["<","numericExpression"]}, 
-  "[<=, numericExpression]" : {
-     "<=": ["<=","numericExpression"]}, 
-  "[=, numericExpression]" : {
-     "=": ["=","numericExpression"]}, 
-  "[>, numericExpression]" : {
-     ">": [">","numericExpression"]}, 
-  "[>=, numericExpression]" : {
-     ">=": [">=","numericExpression"]}, 
-  "[UNION, groupGraphPattern]" : {
-     "UNION": ["UNION","groupGraphPattern"]}, 
-  "[^^, iriRef]" : {
-     "^^": ["^^","iriRef"]}, 
-  "[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]" : {
-     "FILTER": ["or([graphPatternNotTriples, filter])","?.","?triplesBlock"], 
-     "OPTIONAL": ["or([graphPatternNotTriples, filter])","?.","?triplesBlock"], 
-     "{": ["or([graphPatternNotTriples, filter])","?.","?triplesBlock"], 
-     "GRAPH": ["or([graphPatternNotTriples, filter])","?.","?triplesBlock"]}, 
-  "[verb, objectList]" : {
-     "a": ["verb","objectList"], 
-     "VAR1": ["verb","objectList"], 
-     "VAR2": ["verb","objectList"], 
-     "IRI_REF": ["verb","objectList"], 
-     "PNAME_LN": ["verb","objectList"], 
-     "PNAME_NS": ["verb","objectList"]}, 
-  "[||, conditionalAndExpression]" : {
-     "||": ["||","conditionalAndExpression"]}, 
-  "additiveExpression" : {
-     "!": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "+": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "-": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "VAR1": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "VAR2": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "(": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "STR": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "LANG": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "LANGMATCHES": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DATATYPE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "BOUND": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "SAMETERM": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "ISIRI": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "ISURI": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "ISBLANK": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "ISLITERAL": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "TRUE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "FALSE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "REGEX": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "IRI_REF": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "STRING_LITERAL1": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "STRING_LITERAL2": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "STRING_LITERAL_LONG1": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "STRING_LITERAL_LONG2": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "INTEGER": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DECIMAL": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DOUBLE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "INTEGER_POSITIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DECIMAL_POSITIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DOUBLE_POSITIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "INTEGER_NEGATIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DECIMAL_NEGATIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "DOUBLE_NEGATIVE": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "PNAME_LN": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"], 
-     "PNAME_NS": ["multiplicativeExpression","*or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])"]}, 
-  "argList" : {
-     "NIL": ["NIL"], 
-     "(": ["(","expression","*[,, expression]",")"]}, 
-  "askQuery" : {
-     "ASK": ["ASK","*datasetClause","whereClause","solutionModifier"]}, 
-  "baseDecl" : {
-     "BASE": ["BASE","IRI_REF"]}, 
-  "blankNode" : {
-     "BLANK_NODE_LABEL": ["BLANK_NODE_LABEL"], 
-     "ANON": ["ANON"]}, 
-  "blankNodePropertyList" : {
-     "[": ["[","propertyListNotEmpty","]"]}, 
-  "booleanLiteral" : {
-     "TRUE": ["TRUE"], 
-     "FALSE": ["FALSE"]}, 
-  "brackettedExpression" : {
-     "(": ["(","expression",")"]}, 
-  "builtInCall" : {
-     "STR": ["STR","(","expression",")"], 
-     "LANG": ["LANG","(","expression",")"], 
-     "LANGMATCHES": ["LANGMATCHES","(","expression",")"], 
-     "DATATYPE": ["DATATYPE","(","expression",")"], 
-     "BOUND": ["BOUND","(","expression",")"], 
-     "SAMETERM": ["SAMETERM","(","expression",")"], 
-     "ISIRI": ["ISIRI","(","expression",")"], 
-     "ISURI": ["ISURI","(","expression",")"], 
-     "ISBLANK": ["ISBLANK","(","expression",")"], 
-     "ISLITERAL": ["ISLITERAL","(","expression",")"], 
-     "REGEX": ["regexExpression"]}, 
-  "collection" : {
-     "(": ["(","+graphNode",")"]}, 
-  "conditionalAndExpression" : {
-     "!": ["valueLogical","*[&&, valueLogical]"], 
-     "+": ["valueLogical","*[&&, valueLogical]"], 
-     "-": ["valueLogical","*[&&, valueLogical]"], 
-     "VAR1": ["valueLogical","*[&&, valueLogical]"], 
-     "VAR2": ["valueLogical","*[&&, valueLogical]"], 
-     "(": ["valueLogical","*[&&, valueLogical]"], 
-     "STR": ["valueLogical","*[&&, valueLogical]"], 
-     "LANG": ["valueLogical","*[&&, valueLogical]"], 
-     "LANGMATCHES": ["valueLogical","*[&&, valueLogical]"], 
-     "DATATYPE": ["valueLogical","*[&&, valueLogical]"], 
-     "BOUND": ["valueLogical","*[&&, valueLogical]"], 
-     "SAMETERM": ["valueLogical","*[&&, valueLogical]"], 
-     "ISIRI": ["valueLogical","*[&&, valueLogical]"], 
-     "ISURI": ["valueLogical","*[&&, valueLogical]"], 
-     "ISBLANK": ["valueLogical","*[&&, valueLogical]"], 
-     "ISLITERAL": ["valueLogical","*[&&, valueLogical]"], 
-     "TRUE": ["valueLogical","*[&&, valueLogical]"], 
-     "FALSE": ["valueLogical","*[&&, valueLogical]"], 
-     "REGEX": ["valueLogical","*[&&, valueLogical]"], 
-     "IRI_REF": ["valueLogical","*[&&, valueLogical]"], 
-     "STRING_LITERAL1": ["valueLogical","*[&&, valueLogical]"], 
-     "STRING_LITERAL2": ["valueLogical","*[&&, valueLogical]"], 
-     "STRING_LITERAL_LONG1": ["valueLogical","*[&&, valueLogical]"], 
-     "STRING_LITERAL_LONG2": ["valueLogical","*[&&, valueLogical]"], 
-     "INTEGER": ["valueLogical","*[&&, valueLogical]"], 
-     "DECIMAL": ["valueLogical","*[&&, valueLogical]"], 
-     "DOUBLE": ["valueLogical","*[&&, valueLogical]"], 
-     "INTEGER_POSITIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "DECIMAL_POSITIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "DOUBLE_POSITIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "INTEGER_NEGATIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "DECIMAL_NEGATIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "DOUBLE_NEGATIVE": ["valueLogical","*[&&, valueLogical]"], 
-     "PNAME_LN": ["valueLogical","*[&&, valueLogical]"], 
-     "PNAME_NS": ["valueLogical","*[&&, valueLogical]"]}, 
-  "conditionalOrExpression" : {
-     "!": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "+": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "-": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "VAR1": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "VAR2": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "(": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "STR": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "LANG": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "LANGMATCHES": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DATATYPE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "BOUND": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "SAMETERM": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "ISIRI": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "ISURI": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "ISBLANK": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "ISLITERAL": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "TRUE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "FALSE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "REGEX": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "IRI_REF": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "STRING_LITERAL1": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "STRING_LITERAL2": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "STRING_LITERAL_LONG1": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "STRING_LITERAL_LONG2": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "INTEGER": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DECIMAL": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DOUBLE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "INTEGER_POSITIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DECIMAL_POSITIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DOUBLE_POSITIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "INTEGER_NEGATIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DECIMAL_NEGATIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "DOUBLE_NEGATIVE": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "PNAME_LN": ["conditionalAndExpression","*[||, conditionalAndExpression]"], 
-     "PNAME_NS": ["conditionalAndExpression","*[||, conditionalAndExpression]"]}, 
-  "constraint" : {
-     "(": ["brackettedExpression"], 
-     "STR": ["builtInCall"], 
-     "LANG": ["builtInCall"], 
-     "LANGMATCHES": ["builtInCall"], 
-     "DATATYPE": ["builtInCall"], 
-     "BOUND": ["builtInCall"], 
-     "SAMETERM": ["builtInCall"], 
-     "ISIRI": ["builtInCall"], 
-     "ISURI": ["builtInCall"], 
-     "ISBLANK": ["builtInCall"], 
-     "ISLITERAL": ["builtInCall"], 
-     "REGEX": ["builtInCall"], 
-     "IRI_REF": ["functionCall"], 
-     "PNAME_LN": ["functionCall"], 
-     "PNAME_NS": ["functionCall"]}, 
-  "constructQuery" : {
-     "CONSTRUCT": ["CONSTRUCT","constructTemplate","*datasetClause","whereClause","solutionModifier"]}, 
-  "constructTemplate" : {
-     "{": ["{","?constructTriples","}"]}, 
-  "constructTriples" : {
-     "VAR1": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "VAR2": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "NIL": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "(": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "[": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "IRI_REF": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "TRUE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "FALSE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "BLANK_NODE_LABEL": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "ANON": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "PNAME_LN": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "PNAME_NS": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "STRING_LITERAL1": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "STRING_LITERAL2": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "STRING_LITERAL_LONG1": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "STRING_LITERAL_LONG2": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "INTEGER": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DECIMAL": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DOUBLE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "INTEGER_POSITIVE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DECIMAL_POSITIVE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DOUBLE_POSITIVE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "INTEGER_NEGATIVE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DECIMAL_NEGATIVE": ["triplesSameSubject","?[., ?constructTriples]"], 
-     "DOUBLE_NEGATIVE": ["triplesSameSubject","?[., ?constructTriples]"]}, 
-  "datasetClause" : {
-     "FROM": ["FROM","or([defaultGraphClause, namedGraphClause])"]}, 
-  "defaultGraphClause" : {
-     "IRI_REF": ["sourceSelector"], 
-     "PNAME_LN": ["sourceSelector"], 
-     "PNAME_NS": ["sourceSelector"]}, 
-  "describeQuery" : {
-     "DESCRIBE": ["DESCRIBE","or([+varOrIRIref, *])","*datasetClause","whereClause","solutionModifier"]}, 
-  "expression" : {
-     "!": ["conditionalOrExpression"], 
-     "+": ["conditionalOrExpression"], 
-     "-": ["conditionalOrExpression"], 
-     "VAR1": ["conditionalOrExpression"], 
-     "VAR2": ["conditionalOrExpression"], 
-     "(": ["conditionalOrExpression"], 
-     "STR": ["conditionalOrExpression"], 
-     "LANG": ["conditionalOrExpression"], 
-     "LANGMATCHES": ["conditionalOrExpression"], 
-     "DATATYPE": ["conditionalOrExpression"], 
-     "BOUND": ["conditionalOrExpression"], 
-     "SAMETERM": ["conditionalOrExpression"], 
-     "ISIRI": ["conditionalOrExpression"], 
-     "ISURI": ["conditionalOrExpression"], 
-     "ISBLANK": ["conditionalOrExpression"], 
-     "ISLITERAL": ["conditionalOrExpression"], 
-     "TRUE": ["conditionalOrExpression"], 
-     "FALSE": ["conditionalOrExpression"], 
-     "REGEX": ["conditionalOrExpression"], 
-     "IRI_REF": ["conditionalOrExpression"], 
-     "STRING_LITERAL1": ["conditionalOrExpression"], 
-     "STRING_LITERAL2": ["conditionalOrExpression"], 
-     "STRING_LITERAL_LONG1": ["conditionalOrExpression"], 
-     "STRING_LITERAL_LONG2": ["conditionalOrExpression"], 
-     "INTEGER": ["conditionalOrExpression"], 
-     "DECIMAL": ["conditionalOrExpression"], 
-     "DOUBLE": ["conditionalOrExpression"], 
-     "INTEGER_POSITIVE": ["conditionalOrExpression"], 
-     "DECIMAL_POSITIVE": ["conditionalOrExpression"], 
-     "DOUBLE_POSITIVE": ["conditionalOrExpression"], 
-     "INTEGER_NEGATIVE": ["conditionalOrExpression"], 
-     "DECIMAL_NEGATIVE": ["conditionalOrExpression"], 
-     "DOUBLE_NEGATIVE": ["conditionalOrExpression"], 
-     "PNAME_LN": ["conditionalOrExpression"], 
-     "PNAME_NS": ["conditionalOrExpression"]}, 
-  "filter" : {
-     "FILTER": ["FILTER","constraint"]}, 
-  "functionCall" : {
-     "IRI_REF": ["iriRef","argList"], 
-     "PNAME_LN": ["iriRef","argList"], 
-     "PNAME_NS": ["iriRef","argList"]}, 
-  "graphGraphPattern" : {
-     "GRAPH": ["GRAPH","varOrIRIref","groupGraphPattern"]}, 
-  "graphNode" : {
-     "VAR1": ["varOrTerm"], 
-     "VAR2": ["varOrTerm"], 
-     "NIL": ["varOrTerm"], 
-     "IRI_REF": ["varOrTerm"], 
-     "TRUE": ["varOrTerm"], 
-     "FALSE": ["varOrTerm"], 
-     "BLANK_NODE_LABEL": ["varOrTerm"], 
-     "ANON": ["varOrTerm"], 
-     "PNAME_LN": ["varOrTerm"], 
-     "PNAME_NS": ["varOrTerm"], 
-     "STRING_LITERAL1": ["varOrTerm"], 
-     "STRING_LITERAL2": ["varOrTerm"], 
-     "STRING_LITERAL_LONG1": ["varOrTerm"], 
-     "STRING_LITERAL_LONG2": ["varOrTerm"], 
-     "INTEGER": ["varOrTerm"], 
-     "DECIMAL": ["varOrTerm"], 
-     "DOUBLE": ["varOrTerm"], 
-     "INTEGER_POSITIVE": ["varOrTerm"], 
-     "DECIMAL_POSITIVE": ["varOrTerm"], 
-     "DOUBLE_POSITIVE": ["varOrTerm"], 
-     "INTEGER_NEGATIVE": ["varOrTerm"], 
-     "DECIMAL_NEGATIVE": ["varOrTerm"], 
-     "DOUBLE_NEGATIVE": ["varOrTerm"], 
-     "(": ["triplesNode"], 
-     "[": ["triplesNode"]}, 
-  "graphPatternNotTriples" : {
-     "OPTIONAL": ["optionalGraphPattern"], 
-     "{": ["groupOrUnionGraphPattern"], 
-     "GRAPH": ["graphGraphPattern"]}, 
-  "graphTerm" : {
-     "IRI_REF": ["iriRef"], 
-     "PNAME_LN": ["iriRef"], 
-     "PNAME_NS": ["iriRef"], 
-     "STRING_LITERAL1": ["rdfLiteral"], 
-     "STRING_LITERAL2": ["rdfLiteral"], 
-     "STRING_LITERAL_LONG1": ["rdfLiteral"], 
-     "STRING_LITERAL_LONG2": ["rdfLiteral"], 
-     "INTEGER": ["numericLiteral"], 
-     "DECIMAL": ["numericLiteral"], 
-     "DOUBLE": ["numericLiteral"], 
-     "INTEGER_POSITIVE": ["numericLiteral"], 
-     "DECIMAL_POSITIVE": ["numericLiteral"], 
-     "DOUBLE_POSITIVE": ["numericLiteral"], 
-     "INTEGER_NEGATIVE": ["numericLiteral"], 
-     "DECIMAL_NEGATIVE": ["numericLiteral"], 
-     "DOUBLE_NEGATIVE": ["numericLiteral"], 
-     "TRUE": ["booleanLiteral"], 
-     "FALSE": ["booleanLiteral"], 
-     "BLANK_NODE_LABEL": ["blankNode"], 
-     "ANON": ["blankNode"], 
-     "NIL": ["NIL"]}, 
-  "groupGraphPattern" : {
-     "{": ["{","?triplesBlock","*[or([graphPatternNotTriples, filter]), ?., ?triplesBlock]","}"]}, 
-  "groupOrUnionGraphPattern" : {
-     "{": ["groupGraphPattern","*[UNION, groupGraphPattern]"]}, 
-  "iriRef" : {
-     "IRI_REF": ["IRI_REF"], 
-     "PNAME_LN": ["prefixedName"], 
-     "PNAME_NS": ["prefixedName"]}, 
-  "iriRefOrFunction" : {
-     "IRI_REF": ["iriRef","?argList"], 
-     "PNAME_LN": ["iriRef","?argList"], 
-     "PNAME_NS": ["iriRef","?argList"]}, 
-  "limitClause" : {
-     "LIMIT": ["LIMIT","INTEGER"]}, 
-  "limitOffsetClauses" : {
-     "LIMIT": ["limitClause","?offsetClause"]}, 
-  "multiplicativeExpression" : {
-     "!": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "+": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "-": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "VAR1": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "VAR2": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "(": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "STR": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "LANG": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "LANGMATCHES": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DATATYPE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "BOUND": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "SAMETERM": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "ISIRI": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "ISURI": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "ISBLANK": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "ISLITERAL": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "TRUE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "FALSE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "REGEX": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "IRI_REF": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "STRING_LITERAL1": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "STRING_LITERAL2": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "STRING_LITERAL_LONG1": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "STRING_LITERAL_LONG2": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "INTEGER": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DECIMAL": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DOUBLE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "INTEGER_POSITIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DECIMAL_POSITIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DOUBLE_POSITIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "INTEGER_NEGATIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DECIMAL_NEGATIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "DOUBLE_NEGATIVE": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "PNAME_LN": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"], 
-     "PNAME_NS": ["unaryExpression","*or([[*, unaryExpression], [/, unaryExpression]])"]}, 
-  "namedGraphClause" : {
-     "NAMED": ["NAMED","sourceSelector"]}, 
-  "numericExpression" : {
-     "!": ["additiveExpression"], 
-     "+": ["additiveExpression"], 
-     "-": ["additiveExpression"], 
-     "VAR1": ["additiveExpression"], 
-     "VAR2": ["additiveExpression"], 
-     "(": ["additiveExpression"], 
-     "STR": ["additiveExpression"], 
-     "LANG": ["additiveExpression"], 
-     "LANGMATCHES": ["additiveExpression"], 
-     "DATATYPE": ["additiveExpression"], 
-     "BOUND": ["additiveExpression"], 
-     "SAMETERM": ["additiveExpression"], 
-     "ISIRI": ["additiveExpression"], 
-     "ISURI": ["additiveExpression"], 
-     "ISBLANK": ["additiveExpression"], 
-     "ISLITERAL": ["additiveExpression"], 
-     "TRUE": ["additiveExpression"], 
-     "FALSE": ["additiveExpression"], 
-     "REGEX": ["additiveExpression"], 
-     "IRI_REF": ["additiveExpression"], 
-     "STRING_LITERAL1": ["additiveExpression"], 
-     "STRING_LITERAL2": ["additiveExpression"], 
-     "STRING_LITERAL_LONG1": ["additiveExpression"], 
-     "STRING_LITERAL_LONG2": ["additiveExpression"], 
-     "INTEGER": ["additiveExpression"], 
-     "DECIMAL": ["additiveExpression"], 
-     "DOUBLE": ["additiveExpression"], 
-     "INTEGER_POSITIVE": ["additiveExpression"], 
-     "DECIMAL_POSITIVE": ["additiveExpression"], 
-     "DOUBLE_POSITIVE": ["additiveExpression"], 
-     "INTEGER_NEGATIVE": ["additiveExpression"], 
-     "DECIMAL_NEGATIVE": ["additiveExpression"], 
-     "DOUBLE_NEGATIVE": ["additiveExpression"], 
-     "PNAME_LN": ["additiveExpression"], 
-     "PNAME_NS": ["additiveExpression"]}, 
-  "numericLiteral" : {
-     "INTEGER": ["numericLiteralUnsigned"], 
-     "DECIMAL": ["numericLiteralUnsigned"], 
-     "DOUBLE": ["numericLiteralUnsigned"], 
-     "INTEGER_POSITIVE": ["numericLiteralPositive"], 
-     "DECIMAL_POSITIVE": ["numericLiteralPositive"], 
-     "DOUBLE_POSITIVE": ["numericLiteralPositive"], 
-     "INTEGER_NEGATIVE": ["numericLiteralNegative"], 
-     "DECIMAL_NEGATIVE": ["numericLiteralNegative"], 
-     "DOUBLE_NEGATIVE": ["numericLiteralNegative"]}, 
-  "numericLiteralNegative" : {
-     "INTEGER_NEGATIVE": ["INTEGER_NEGATIVE"], 
-     "DECIMAL_NEGATIVE": ["DECIMAL_NEGATIVE"], 
-     "DOUBLE_NEGATIVE": ["DOUBLE_NEGATIVE"]}, 
-  "numericLiteralPositive" : {
-     "INTEGER_POSITIVE": ["INTEGER_POSITIVE"], 
-     "DECIMAL_POSITIVE": ["DECIMAL_POSITIVE"], 
-     "DOUBLE_POSITIVE": ["DOUBLE_POSITIVE"]}, 
-  "numericLiteralUnsigned" : {
-     "INTEGER": ["INTEGER"], 
-     "DECIMAL": ["DECIMAL"], 
-     "DOUBLE": ["DOUBLE"]}, 
-  "object" : {
-     "(": ["graphNode"], 
-     "[": ["graphNode"], 
-     "VAR1": ["graphNode"], 
-     "VAR2": ["graphNode"], 
-     "NIL": ["graphNode"], 
-     "IRI_REF": ["graphNode"], 
-     "TRUE": ["graphNode"], 
-     "FALSE": ["graphNode"], 
-     "BLANK_NODE_LABEL": ["graphNode"], 
-     "ANON": ["graphNode"], 
-     "PNAME_LN": ["graphNode"], 
-     "PNAME_NS": ["graphNode"], 
-     "STRING_LITERAL1": ["graphNode"], 
-     "STRING_LITERAL2": ["graphNode"], 
-     "STRING_LITERAL_LONG1": ["graphNode"], 
-     "STRING_LITERAL_LONG2": ["graphNode"], 
-     "INTEGER": ["graphNode"], 
-     "DECIMAL": ["graphNode"], 
-     "DOUBLE": ["graphNode"], 
-     "INTEGER_POSITIVE": ["graphNode"], 
-     "DECIMAL_POSITIVE": ["graphNode"], 
-     "DOUBLE_POSITIVE": ["graphNode"], 
-     "INTEGER_NEGATIVE": ["graphNode"], 
-     "DECIMAL_NEGATIVE": ["graphNode"], 
-     "DOUBLE_NEGATIVE": ["graphNode"]}, 
-  "objectList" : {
-     "(": ["object","*[,, object]"], 
-     "[": ["object","*[,, object]"], 
-     "VAR1": ["object","*[,, object]"], 
-     "VAR2": ["object","*[,, object]"], 
-     "NIL": ["object","*[,, object]"], 
-     "IRI_REF": ["object","*[,, object]"], 
-     "TRUE": ["object","*[,, object]"], 
-     "FALSE": ["object","*[,, object]"], 
-     "BLANK_NODE_LABEL": ["object","*[,, object]"], 
-     "ANON": ["object","*[,, object]"], 
-     "PNAME_LN": ["object","*[,, object]"], 
-     "PNAME_NS": ["object","*[,, object]"], 
-     "STRING_LITERAL1": ["object","*[,, object]"], 
-     "STRING_LITERAL2": ["object","*[,, object]"], 
-     "STRING_LITERAL_LONG1": ["object","*[,, object]"], 
-     "STRING_LITERAL_LONG2": ["object","*[,, object]"], 
-     "INTEGER": ["object","*[,, object]"], 
-     "DECIMAL": ["object","*[,, object]"], 
-     "DOUBLE": ["object","*[,, object]"], 
-     "INTEGER_POSITIVE": ["object","*[,, object]"], 
-     "DECIMAL_POSITIVE": ["object","*[,, object]"], 
-     "DOUBLE_POSITIVE": ["object","*[,, object]"], 
-     "INTEGER_NEGATIVE": ["object","*[,, object]"], 
-     "DECIMAL_NEGATIVE": ["object","*[,, object]"], 
-     "DOUBLE_NEGATIVE": ["object","*[,, object]"]}, 
-  "offsetClause" : {
-     "OFFSET": ["OFFSET","INTEGER"]}, 
-  "optionalGraphPattern" : {
-     "OPTIONAL": ["OPTIONAL","groupGraphPattern"]}, 
-  "or([+var, *])" : {
-     "VAR1": ["+var"], 
-     "VAR2": ["+var"], 
-     "*": ["*"]}, 
-  "or([+varOrIRIref, *])" : {
-     "VAR1": ["+varOrIRIref"], 
-     "VAR2": ["+varOrIRIref"], 
-     "IRI_REF": ["+varOrIRIref"], 
-     "PNAME_LN": ["+varOrIRIref"], 
-     "PNAME_NS": ["+varOrIRIref"], 
-     "*": ["*"]}, 
-  "or([ASC, DESC])" : {
-     "ASC": ["ASC"], 
-     "DESC": ["DESC"]}, 
-  "or([DISTINCT, REDUCED])" : {
-     "DISTINCT": ["DISTINCT"], 
-     "REDUCED": ["REDUCED"]}, 
-  "or([LANGTAG, [^^, iriRef]])" : {
-     "LANGTAG": ["LANGTAG"], 
-     "^^": ["[^^, iriRef]"]}, 
-  "or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])" : {
-     "!": ["[!, primaryExpression]"], 
-     "+": ["[+, primaryExpression]"], 
-     "-": ["[-, primaryExpression]"], 
-     "VAR1": ["primaryExpression"], 
-     "VAR2": ["primaryExpression"], 
-     "(": ["primaryExpression"], 
-     "STR": ["primaryExpression"], 
-     "LANG": ["primaryExpression"], 
-     "LANGMATCHES": ["primaryExpression"], 
-     "DATATYPE": ["primaryExpression"], 
-     "BOUND": ["primaryExpression"], 
-     "SAMETERM": ["primaryExpression"], 
-     "ISIRI": ["primaryExpression"], 
-     "ISURI": ["primaryExpression"], 
-     "ISBLANK": ["primaryExpression"], 
-     "ISLITERAL": ["primaryExpression"], 
-     "TRUE": ["primaryExpression"], 
-     "FALSE": ["primaryExpression"], 
-     "REGEX": ["primaryExpression"], 
-     "IRI_REF": ["primaryExpression"], 
-     "STRING_LITERAL1": ["primaryExpression"], 
-     "STRING_LITERAL2": ["primaryExpression"], 
-     "STRING_LITERAL_LONG1": ["primaryExpression"], 
-     "STRING_LITERAL_LONG2": ["primaryExpression"], 
-     "INTEGER": ["primaryExpression"], 
-     "DECIMAL": ["primaryExpression"], 
-     "DOUBLE": ["primaryExpression"], 
-     "INTEGER_POSITIVE": ["primaryExpression"], 
-     "DECIMAL_POSITIVE": ["primaryExpression"], 
-     "DOUBLE_POSITIVE": ["primaryExpression"], 
-     "INTEGER_NEGATIVE": ["primaryExpression"], 
-     "DECIMAL_NEGATIVE": ["primaryExpression"], 
-     "DOUBLE_NEGATIVE": ["primaryExpression"], 
-     "PNAME_LN": ["primaryExpression"], 
-     "PNAME_NS": ["primaryExpression"]}, 
-  "or([[*, unaryExpression], [/, unaryExpression]])" : {
-     "*": ["[*, unaryExpression]"], 
-     "/": ["[/, unaryExpression]"]}, 
-  "or([[+, multiplicativeExpression], [-, multiplicativeExpression], numericLiteralPositive, numericLiteralNegative])" : {
-     "+": ["[+, multiplicativeExpression]"], 
-     "-": ["[-, multiplicativeExpression]"], 
-     "INTEGER_POSITIVE": ["numericLiteralPositive"], 
-     "DECIMAL_POSITIVE": ["numericLiteralPositive"], 
-     "DOUBLE_POSITIVE": ["numericLiteralPositive"], 
-     "INTEGER_NEGATIVE": ["numericLiteralNegative"], 
-     "DECIMAL_NEGATIVE": ["numericLiteralNegative"], 
-     "DOUBLE_NEGATIVE": ["numericLiteralNegative"]}, 
-  "or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])" : {
-     "=": ["[=, numericExpression]"], 
-     "!=": ["[!=, numericExpression]"], 
-     "<": ["[<, numericExpression]"], 
-     ">": ["[>, numericExpression]"], 
-     "<=": ["[<=, numericExpression]"], 
-     ">=": ["[>=, numericExpression]"]}, 
-  "or([defaultGraphClause, namedGraphClause])" : {
-     "IRI_REF": ["defaultGraphClause"], 
-     "PNAME_LN": ["defaultGraphClause"], 
-     "PNAME_NS": ["defaultGraphClause"], 
-     "NAMED": ["namedGraphClause"]}, 
-  "or([graphPatternNotTriples, filter])" : {
-     "OPTIONAL": ["graphPatternNotTriples"], 
-     "{": ["graphPatternNotTriples"], 
-     "GRAPH": ["graphPatternNotTriples"], 
-     "FILTER": ["filter"]}, 
-  "or([selectQuery, constructQuery, describeQuery, askQuery])" : {
-     "SELECT": ["selectQuery"], 
-     "CONSTRUCT": ["constructQuery"], 
-     "DESCRIBE": ["describeQuery"], 
-     "ASK": ["askQuery"]}, 
-  "orderClause" : {
-     "ORDER": ["ORDER","BY","orderCondition"]}, 
-  "orderCondition" : {
-     "ASC": ["or([ASC, DESC])","brackettedExpression"], 
-     "DESC": ["or([ASC, DESC])","brackettedExpression"], 
-     "(": ["constraint"], 
-     "STR": ["constraint"], 
-     "LANG": ["constraint"], 
-     "LANGMATCHES": ["constraint"], 
-     "DATATYPE": ["constraint"], 
-     "BOUND": ["constraint"], 
-     "SAMETERM": ["constraint"], 
-     "ISIRI": ["constraint"], 
-     "ISURI": ["constraint"], 
-     "ISBLANK": ["constraint"], 
-     "ISLITERAL": ["constraint"], 
-     "REGEX": ["constraint"], 
-     "IRI_REF": ["constraint"], 
-     "PNAME_LN": ["constraint"], 
-     "PNAME_NS": ["constraint"], 
-     "VAR1": ["var"], 
-     "VAR2": ["var"]}, 
-  "prefixDecl" : {
-     "PREFIX": ["PREFIX","PNAME_NS","IRI_REF"]}, 
-  "prefixedName" : {
-     "PNAME_LN": ["PNAME_LN"], 
-     "PNAME_NS": ["PNAME_NS"]}, 
-  "primaryExpression" : {
-     "(": ["brackettedExpression"], 
-     "STR": ["builtInCall"], 
-     "LANG": ["builtInCall"], 
-     "LANGMATCHES": ["builtInCall"], 
-     "DATATYPE": ["builtInCall"], 
-     "BOUND": ["builtInCall"], 
-     "SAMETERM": ["builtInCall"], 
-     "ISIRI": ["builtInCall"], 
-     "ISURI": ["builtInCall"], 
-     "ISBLANK": ["builtInCall"], 
-     "ISLITERAL": ["builtInCall"], 
-     "REGEX": ["builtInCall"], 
-     "IRI_REF": ["iriRefOrFunction"], 
-     "PNAME_LN": ["iriRefOrFunction"], 
-     "PNAME_NS": ["iriRefOrFunction"], 
-     "STRING_LITERAL1": ["rdfLiteral"], 
-     "STRING_LITERAL2": ["rdfLiteral"], 
-     "STRING_LITERAL_LONG1": ["rdfLiteral"], 
-     "STRING_LITERAL_LONG2": ["rdfLiteral"], 
-     "INTEGER": ["numericLiteral"], 
-     "DECIMAL": ["numericLiteral"], 
-     "DOUBLE": ["numericLiteral"], 
-     "INTEGER_POSITIVE": ["numericLiteral"], 
-     "DECIMAL_POSITIVE": ["numericLiteral"], 
-     "DOUBLE_POSITIVE": ["numericLiteral"], 
-     "INTEGER_NEGATIVE": ["numericLiteral"], 
-     "DECIMAL_NEGATIVE": ["numericLiteral"], 
-     "DOUBLE_NEGATIVE": ["numericLiteral"], 
-     "TRUE": ["booleanLiteral"], 
-     "FALSE": ["booleanLiteral"], 
-     "VAR1": ["var"], 
-     "VAR2": ["var"]}, 
-  "prologue" : {
-     "PREFIX": ["?baseDecl","*prefixDecl"], 
-     "BASE": ["?baseDecl","*prefixDecl"], 
-     "SELECT": ["?baseDecl","*prefixDecl"], 
-     "CONSTRUCT": ["?baseDecl","*prefixDecl"], 
-     "DESCRIBE": ["?baseDecl","*prefixDecl"], 
-     "ASK": ["?baseDecl","*prefixDecl"]}, 
-  "propertyList" : {
-     "a": ["?propertyListNotEmpty"], 
-     "VAR1": ["?propertyListNotEmpty"], 
-     "VAR2": ["?propertyListNotEmpty"], 
-     "IRI_REF": ["?propertyListNotEmpty"], 
-     "PNAME_LN": ["?propertyListNotEmpty"], 
-     "PNAME_NS": ["?propertyListNotEmpty"], 
-     ".": ["?propertyListNotEmpty"], 
-     "}": ["?propertyListNotEmpty"], 
-     "FILTER": ["?propertyListNotEmpty"], 
-     "OPTIONAL": ["?propertyListNotEmpty"], 
-     "{": ["?propertyListNotEmpty"], 
-     "GRAPH": ["?propertyListNotEmpty"]}, 
-  "propertyListNotEmpty" : {
-     "a": ["verb","objectList","*[;, ?[verb, objectList]]"], 
-     "VAR1": ["verb","objectList","*[;, ?[verb, objectList]]"], 
-     "VAR2": ["verb","objectList","*[;, ?[verb, objectList]]"], 
-     "IRI_REF": ["verb","objectList","*[;, ?[verb, objectList]]"], 
-     "PNAME_LN": ["verb","objectList","*[;, ?[verb, objectList]]"], 
-     "PNAME_NS": ["verb","objectList","*[;, ?[verb, objectList]]"]}, 
-  "query" : {
-     "SELECT": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"], 
-     "CONSTRUCT": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"], 
-     "DESCRIBE": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"], 
-     "ASK": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"], 
-     "PREFIX": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"], 
-     "BASE": ["prologue","or([selectQuery, constructQuery, describeQuery, askQuery])"]}, 
-  "rdfLiteral" : {
-     "STRING_LITERAL1": ["string","?or([LANGTAG, [^^, iriRef]])"], 
-     "STRING_LITERAL2": ["string","?or([LANGTAG, [^^, iriRef]])"], 
-     "STRING_LITERAL_LONG1": ["string","?or([LANGTAG, [^^, iriRef]])"], 
-     "STRING_LITERAL_LONG2": ["string","?or([LANGTAG, [^^, iriRef]])"]}, 
-  "regexExpression" : {
-     "REGEX": ["REGEX","(","expression",",","expression","?[,, expression]",")"]}, 
-  "relationalExpression" : {
-     "!": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "+": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "-": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "VAR1": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "VAR2": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "(": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "STR": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "LANG": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "LANGMATCHES": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DATATYPE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "BOUND": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "SAMETERM": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "ISIRI": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "ISURI": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "ISBLANK": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "ISLITERAL": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "TRUE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "FALSE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "REGEX": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "IRI_REF": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "STRING_LITERAL1": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "STRING_LITERAL2": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "STRING_LITERAL_LONG1": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "STRING_LITERAL_LONG2": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "INTEGER": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DECIMAL": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DOUBLE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "INTEGER_POSITIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DECIMAL_POSITIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DOUBLE_POSITIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "INTEGER_NEGATIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DECIMAL_NEGATIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "DOUBLE_NEGATIVE": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "PNAME_LN": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"], 
-     "PNAME_NS": ["numericExpression","?or([[=, numericExpression], [!=, numericExpression], [<, numericExpression], [>, numericExpression], [<=, numericExpression], [>=, numericExpression]])"]}, 
-  "s" : {
-     "SELECT": ["query","$"], 
-     "CONSTRUCT": ["query","$"], 
-     "DESCRIBE": ["query","$"], 
-     "ASK": ["query","$"], 
-     "PREFIX": ["query","$"], 
-     "BASE": ["query","$"]}, 
-  "selectQuery" : {
-     "SELECT": ["SELECT","?or([DISTINCT, REDUCED])","or([+var, *])","*datasetClause","whereClause","solutionModifier"]}, 
-  "solutionModifier" : {
-     "LIMIT": ["?orderClause","?limitOffsetClauses"], 
-     "ORDER": ["?orderClause","?limitOffsetClauses"], 
-     "$": ["?orderClause","?limitOffsetClauses"]}, 
-  "sourceSelector" : {
-     "IRI_REF": ["iriRef"], 
-     "PNAME_LN": ["iriRef"], 
-     "PNAME_NS": ["iriRef"]}, 
-  "string" : {
-     "STRING_LITERAL1": ["STRING_LITERAL1"], 
-     "STRING_LITERAL2": ["STRING_LITERAL2"], 
-     "STRING_LITERAL_LONG1": ["STRING_LITERAL_LONG1"], 
-     "STRING_LITERAL_LONG2": ["STRING_LITERAL_LONG2"]}, 
-  "triplesBlock" : {
-     "VAR1": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "VAR2": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "NIL": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "(": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "[": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "IRI_REF": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "TRUE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "FALSE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "BLANK_NODE_LABEL": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "ANON": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "PNAME_LN": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "PNAME_NS": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "STRING_LITERAL1": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "STRING_LITERAL2": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "STRING_LITERAL_LONG1": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "STRING_LITERAL_LONG2": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "INTEGER": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DECIMAL": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DOUBLE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "INTEGER_POSITIVE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DECIMAL_POSITIVE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DOUBLE_POSITIVE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "INTEGER_NEGATIVE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DECIMAL_NEGATIVE": ["triplesSameSubject","?[., ?triplesBlock]"], 
-     "DOUBLE_NEGATIVE": ["triplesSameSubject","?[., ?triplesBlock]"]}, 
-  "triplesNode" : {
-     "(": ["collection"], 
-     "[": ["blankNodePropertyList"]}, 
-  "triplesSameSubject" : {
-     "VAR1": ["varOrTerm","propertyListNotEmpty"], 
-     "VAR2": ["varOrTerm","propertyListNotEmpty"], 
-     "NIL": ["varOrTerm","propertyListNotEmpty"], 
-     "IRI_REF": ["varOrTerm","propertyListNotEmpty"], 
-     "TRUE": ["varOrTerm","propertyListNotEmpty"], 
-     "FALSE": ["varOrTerm","propertyListNotEmpty"], 
-     "BLANK_NODE_LABEL": ["varOrTerm","propertyListNotEmpty"], 
-     "ANON": ["varOrTerm","propertyListNotEmpty"], 
-     "PNAME_LN": ["varOrTerm","propertyListNotEmpty"], 
-     "PNAME_NS": ["varOrTerm","propertyListNotEmpty"], 
-     "STRING_LITERAL1": ["varOrTerm","propertyListNotEmpty"], 
-     "STRING_LITERAL2": ["varOrTerm","propertyListNotEmpty"], 
-     "STRING_LITERAL_LONG1": ["varOrTerm","propertyListNotEmpty"], 
-     "STRING_LITERAL_LONG2": ["varOrTerm","propertyListNotEmpty"], 
-     "INTEGER": ["varOrTerm","propertyListNotEmpty"], 
-     "DECIMAL": ["varOrTerm","propertyListNotEmpty"], 
-     "DOUBLE": ["varOrTerm","propertyListNotEmpty"], 
-     "INTEGER_POSITIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "DECIMAL_POSITIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "DOUBLE_POSITIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "INTEGER_NEGATIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "DECIMAL_NEGATIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "DOUBLE_NEGATIVE": ["varOrTerm","propertyListNotEmpty"], 
-     "(": ["triplesNode","propertyList"], 
-     "[": ["triplesNode","propertyList"]}, 
-  "unaryExpression" : {
-     "!": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "+": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "-": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "VAR1": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "VAR2": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "(": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "STR": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "LANG": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "LANGMATCHES": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DATATYPE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "BOUND": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "SAMETERM": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "ISIRI": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "ISURI": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "ISBLANK": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "ISLITERAL": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "TRUE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "FALSE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "REGEX": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "IRI_REF": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "STRING_LITERAL1": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "STRING_LITERAL2": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "STRING_LITERAL_LONG1": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "STRING_LITERAL_LONG2": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "INTEGER": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DECIMAL": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DOUBLE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "INTEGER_POSITIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DECIMAL_POSITIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DOUBLE_POSITIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "INTEGER_NEGATIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DECIMAL_NEGATIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "DOUBLE_NEGATIVE": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "PNAME_LN": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"], 
-     "PNAME_NS": ["or([[!, primaryExpression], [+, primaryExpression], [-, primaryExpression], primaryExpression])"]}, 
-  "valueLogical" : {
-     "!": ["relationalExpression"], 
-     "+": ["relationalExpression"], 
-     "-": ["relationalExpression"], 
-     "VAR1": ["relationalExpression"], 
-     "VAR2": ["relationalExpression"], 
-     "(": ["relationalExpression"], 
-     "STR": ["relationalExpression"], 
-     "LANG": ["relationalExpression"], 
-     "LANGMATCHES": ["relationalExpression"], 
-     "DATATYPE": ["relationalExpression"], 
-     "BOUND": ["relationalExpression"], 
-     "SAMETERM": ["relationalExpression"], 
-     "ISIRI": ["relationalExpression"], 
-     "ISURI": ["relationalExpression"], 
-     "ISBLANK": ["relationalExpression"], 
-     "ISLITERAL": ["relationalExpression"], 
-     "TRUE": ["relationalExpression"], 
-     "FALSE": ["relationalExpression"], 
-     "REGEX": ["relationalExpression"], 
-     "IRI_REF": ["relationalExpression"], 
-     "STRING_LITERAL1": ["relationalExpression"], 
-     "STRING_LITERAL2": ["relationalExpression"], 
-     "STRING_LITERAL_LONG1": ["relationalExpression"], 
-     "STRING_LITERAL_LONG2": ["relationalExpression"], 
-     "INTEGER": ["relationalExpression"], 
-     "DECIMAL": ["relationalExpression"], 
-     "DOUBLE": ["relationalExpression"], 
-     "INTEGER_POSITIVE": ["relationalExpression"], 
-     "DECIMAL_POSITIVE": ["relationalExpression"], 
-     "DOUBLE_POSITIVE": ["relationalExpression"], 
-     "INTEGER_NEGATIVE": ["relationalExpression"], 
-     "DECIMAL_NEGATIVE": ["relationalExpression"], 
-     "DOUBLE_NEGATIVE": ["relationalExpression"], 
-     "PNAME_LN": ["relationalExpression"], 
-     "PNAME_NS": ["relationalExpression"]}, 
-  "var" : {
-     "VAR1": ["VAR1"], 
-     "VAR2": ["VAR2"]}, 
-  "varOrIRIref" : {
-     "VAR1": ["var"], 
-     "VAR2": ["var"], 
-     "IRI_REF": ["iriRef"], 
-     "PNAME_LN": ["iriRef"], 
-     "PNAME_NS": ["iriRef"]}, 
-  "varOrTerm" : {
-     "VAR1": ["var"], 
-     "VAR2": ["var"], 
-     "NIL": ["graphTerm"], 
-     "IRI_REF": ["graphTerm"], 
-     "TRUE": ["graphTerm"], 
-     "FALSE": ["graphTerm"], 
-     "BLANK_NODE_LABEL": ["graphTerm"], 
-     "ANON": ["graphTerm"], 
-     "PNAME_LN": ["graphTerm"], 
-     "PNAME_NS": ["graphTerm"], 
-     "STRING_LITERAL1": ["graphTerm"], 
-     "STRING_LITERAL2": ["graphTerm"], 
-     "STRING_LITERAL_LONG1": ["graphTerm"], 
-     "STRING_LITERAL_LONG2": ["graphTerm"], 
-     "INTEGER": ["graphTerm"], 
-     "DECIMAL": ["graphTerm"], 
-     "DOUBLE": ["graphTerm"], 
-     "INTEGER_POSITIVE": ["graphTerm"], 
-     "DECIMAL_POSITIVE": ["graphTerm"], 
-     "DOUBLE_POSITIVE": ["graphTerm"], 
-     "INTEGER_NEGATIVE": ["graphTerm"], 
-     "DECIMAL_NEGATIVE": ["graphTerm"], 
-     "DOUBLE_NEGATIVE": ["graphTerm"]}, 
-  "verb" : {
-     "VAR1": ["varOrIRIref"], 
-     "VAR2": ["varOrIRIref"], 
-     "IRI_REF": ["varOrIRIref"], 
-     "PNAME_LN": ["varOrIRIref"], 
-     "PNAME_NS": ["varOrIRIref"], 
-     "a": ["a"]}, 
-  "whereClause" : {
-     "{": ["?WHERE","groupGraphPattern"], 
-     "WHERE": ["?WHERE","groupGraphPattern"]}
-    };
-
-
-    function getTerminals()
-    {
-	var IRI_REF = '<[^<>\"\'\|\{\}\^\\\x00-\x20]*>';
-	/*
-	  PN_CHARS_BASE =	
-	  '[A-Z]|[a-z]|[\\u00C0-\\u00D6]|[\\u00D8-\\u00F6]|[\\u00F8-\\u02FF]|[\\u0370-\\u037D]|[\\u037F-\\u1FFF]|[\\u200C-\\u200D]|[\\u2070-\\u218F]|[\\u2C00-\\u2FEF]|[\\u3001-\\uD7FF]|[\\uF900-\\uFDCF]|[\\uFDF0-\\uFFFD]|[\\u10000-\\uEFFFF]';
-	*/
-
-	var PN_CHARS_BASE =	
-	    '[A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]';
-	var PN_CHARS_U = PN_CHARS_BASE+'|_';
-
-	var PN_CHARS=  PN_CHARS_U+'|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]';
-	var VARNAME = '('+PN_CHARS_U+'|[0-9])'+
-	    '('+PN_CHARS_U+'|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*';
-	var VAR1 = '\\?'+VARNAME;
-	var VAR2 = '\\$'+VARNAME;
-
-	var PN_PREFIX= '('+PN_CHARS_BASE+')((('+PN_CHARS+')|\\.)*('+PN_CHARS+'))?';
-	var PN_LOCAL= '('+PN_CHARS_U+'|[0-9])((('+PN_CHARS+')|\\.)*('+PN_CHARS+'))?';
-
-	var PNAME_NS = '('+PN_PREFIX+')?:';
-	var PNAME_LN = PNAME_NS+PN_LOCAL;
-	var BLANK_NODE_LABEL = '_:'+PN_LOCAL;
-	var LANGTAG = '@[a-zA-Z]+(-[a-zA-Z0-9]+)*';
-
-	var EXPONENT = '[eE][\\+-]?[0-9]+';
-	var INTEGER = '[0-9]+';
-	var DECIMAL = '(([0-9]+\\.[0-9]*)|(\\.[0-9]+))';
-	var DOUBLE = 
-	    '(([0-9]+\\.[0-9]*'+EXPONENT+')|'+
-	    '(\\.[0-9]+'+EXPONENT+')|'+                    
-	    '([0-9]+'+EXPONENT+'))';
-
-	var INTEGER_POSITIVE = '\\+' + INTEGER;
-	var DECIMAL_POSITIVE = '\\+' + DECIMAL;
-	var DOUBLE_POSITIVE  = '\\+' + DOUBLE;
-	var INTEGER_NEGATIVE = '-' + INTEGER;
-	var DECIMAL_NEGATIVE = '-' + DECIMAL;
-	var DOUBLE_NEGATIVE  = '-' + DOUBLE;
-
-	var ECHAR = '\\\\[tbnrf\\\\"\']';
-
-	var STRING_LITERAL1 = "'(([^\x27\x5C\x0A\x0D])|"+ECHAR+")*'";
-	var STRING_LITERAL2 = '"(([^\x22\x5C\x0A\x0D])|'+ECHAR+')*"';
-	var STRING_LITERAL_LONG1 = "'''(('|'')?([^'\\\\]|"+ECHAR+"))*'''";
-	var STRING_LITERAL_LONG2 = '"""(("|"")?([^"\\\\]|'+ECHAR+'))*"""';
-
-	var WS    =	'[\\x20\\x09\\x0D\\x0A]';
-	// Careful! Code mirror feeds one line at a time with no \n
-	// ... but otherwise comment is terminated by \n
-	var COMMENT = '#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)' 
-	var WS_OR_COMMENT_STAR = '('+WS+'|('+COMMENT+'))*';
-	var NIL   = '\\('+WS_OR_COMMENT_STAR+'\\)';
-	var ANON  =	'\\['+WS_OR_COMMENT_STAR+'\\]';
-
-	var terminals=
-	    {
-		terminal: [
-
-		    { name: "WS", 
-		      regex:new RegExp("^"+WS+"+"), 
-		      style:"sp-ws" }, 
-
-		    { name: "COMMENT", 
-		      regex:new RegExp("^"+COMMENT), 
-		      style:"sp-comment" }, 
-
-		    { name: "IRI_REF", 
-		      regex:new RegExp("^"+IRI_REF), 
-		      style:"sp-uri" }, 
-
-		    { name: "VAR1", 
-		      regex:new RegExp("^"+VAR1), 
-		      style:"sp-var"}, 
-
-		    { name: "VAR2", 
-		      regex:new RegExp("^"+VAR2), 
-		      style:"sp-var"},
- 
-		    { name: "LANGTAG", 
-		      regex:new RegExp("^"+LANGTAG), 
-		      style:"sp-punc"}, 
-
-		    { name: "DOUBLE", 
-		      regex:new RegExp("^"+DOUBLE), 
-		      style:"sp-number" }, 
-
-		    { name: "DECIMAL", 
-		      regex:new RegExp("^"+DECIMAL), 
-		      style:"sp-number" }, 
-
-		    { name: "INTEGER", 
-		      regex:new RegExp("^"+INTEGER), 
-		      style:"sp-number" }, 
-
-		    { name: "DOUBLE_POSITIVE", 
-		      regex:new RegExp("^"+DOUBLE_POSITIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "DECIMAL_POSITIVE", 
-		      regex:new RegExp("^"+DECIMAL_POSITIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "INTEGER_POSITIVE", 
-		      regex:new RegExp("^"+INTEGER_POSITIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "DOUBLE_NEGATIVE", 
-		      regex:new RegExp("^"+DOUBLE_NEGATIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "DECIMAL_NEGATIVE", 
-		      regex:new RegExp("^"+DECIMAL_NEGATIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "INTEGER_NEGATIVE", 
-		      regex:new RegExp("^"+INTEGER_NEGATIVE), 
-		      style:"sp-number" }, 
-
-		    { name: "STRING_LITERAL_LONG1", 
-		      regex:new RegExp("^"+STRING_LITERAL_LONG1), 
-		      style:"sp-literal" }, 
-
-		    { name: "STRING_LITERAL_LONG2", 
-		      regex:new RegExp("^"+STRING_LITERAL_LONG2), 
-		      style:"sp-literal" }, 
-
-		    { name: "STRING_LITERAL1", 
-		      regex:new RegExp("^"+STRING_LITERAL1), 
-		      style:"sp-literal" }, 
-
-		    { name: "STRING_LITERAL2", 
-		      regex:new RegExp("^"+STRING_LITERAL2), 
-		      style:"sp-literal" }, 
-
-		    // Enclosed comments won't be highlighted
-		    { name: "NIL", 
-		      regex:new RegExp("^"+NIL), 
-		      style:"sp-punc" }, 
-
-		    // Enclosed comments won't be highlighted
-		    { name: "ANON", 
-		      regex:new RegExp("^"+ANON), 
-		      style:"sp-punc" }, 
-
-		    { name: "PNAME_LN", 
-		      regex:new RegExp("^"+PNAME_LN), 
-		      style:"sp-prefixed" }, 
-
-		    { name: "PNAME_NS", 
-		      regex:new RegExp("^"+PNAME_NS), 
-		      style:"sp-prefixed" }, 
-
-		    { name: "BLANK_NODE_LABEL", 
-		      regex:new RegExp("^"+BLANK_NODE_LABEL), 
-		      style:"sp-prefixed" }
-		],
-
-		punct: /^(\*|a|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|<|>|\+|-|\/|\^\^)/,
-
-		keywords: /^(BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|STR|LANG|LANGMATCHES|DATATYPE|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE)/i,
-
-//		whitespace: new RegExp("^"+WS+"*"),
-//		comments: new RegExp("^"+COMMENT),
-//		whitespace_or_comments: new RegExp("^"+WS_OR_COMMENT_STAR)
-
-	    }
-	return terminals;
-    }
-
-    function getPossibles(symbol)
-    {
-	var possibles=[], possiblesOb=ll1_table[symbol];
-	if (possiblesOb!=undefined)
-	    for (var property in possiblesOb) 
-		possibles.push(property.toString());
-	else
-	    possibles.push(symbol);
-	return possibles;
-    }
-
-    var tms= getTerminals();
-    var terminal=tms.terminal;
-    var keywords=tms.keywords;
-    var punct=tms.punct;
-
-    function tokenBase(stream, state) {
-	
-	function nextToken() {
-
-	    var consumed=null;
- 	    // Tokens defined by individual regular expressions
-	    for (var i=0; i<terminal.length; ++i) {
-		consumed= stream.match(terminal[i].regex,true,false);
-		if (consumed) 
-		    return { cat: terminal[i].name, 
-			     style: terminal[i].style,
-			     text: consumed[0]
-			   };
-	    }
-
-	    // Keywords
-	    consumed= stream.match(keywords,true,false);
-	    if (consumed)
-		return { cat: stream.current().toUpperCase(),
-			 style: "sp-keyword",
-			 text: consumed[0]
-		       };
-	
-	    // Punctuation
-	    consumed= stream.match(punct,true,false);
-	    if (consumed) 
-		return { cat: stream.current(),
-			 style: "sp-punc",
-			 text: consumed[0]
-		       };
-	    
-	    // Token is invalid
-	    // better consume something anyway, or else we're stuck
-	    consumed= stream.match(/^.[A-Za-z0-9]*/,true,false);
-	    return { cat:"<invalid_token>", 
-		     style: "sp-invalid",
-		     text: consumed[0]
-		   };
-	}
-
-	function recordFailurePos() { 
-	    // tokenOb.style= "sp-invalid";
-	    var col= stream.column();
-	    state.errorStartPos= col;
-	    state.errorEndPos= col+tokenOb.text.length;
-	};
-
-	function setQueryType(s) {
-	    if (s=="SELECT" || s=="CONSTRUCT" || s=="ASK" || s=="DESCRIBE")
-		state.queryType=s;
-	}
-
-	// CodeMirror works with one line at a time,
-	// but newline should behave like whitespace
-	// - i.e. a definite break between tokens (for autocompleter)
-	if (stream.pos==0) 
-	    state.possibleCurrent= state.possibleNext;
-
-	var tokenOb= nextToken();
-
-	if (tokenOb.cat=="<invalid_token>") {
-	    // set error state, and
-	    if (state.OK==true) {
-		state.OK=false;
-		recordFailurePos();
-	    }
-	    //alert("Invalid:"+tokenOb.text);
-	    return tokenOb.style;
-	}
-
-	if (tokenOb.cat == "WS" ||
-	    tokenOb.cat == "COMMENT") {
-	    state.possibleCurrent= state.possibleNext;
-	    return(tokenOb.style)
-	}
-	// Otherwise, run the parser until the token is digested
-	// or failure
-	var finished= false;
-	var topSymbol;
-	var token= tokenOb.cat;
-
-	// Incremental LL1 parse
-	while(state.stack.length>0 && token && state.OK && !finished ) {
-	    topSymbol= state.stack.pop();
-	    
-	    if (!ll1_table[topSymbol]) {
-		// Top symbol is a terminal
-		if (topSymbol==token) {
-		    // Matching terminals
-		    // - consume token from input stream
-		    finished=true;
-		    setQueryType(topSymbol);
-		} else {
-		    state.OK=false;
-		    recordFailurePos();
-		}
-	    } else {
-		// topSymbol is nonterminal
-		//  - see if there is an entry for topSymbol 
-		// and nextToken in table
-		var nextSymbols= ll1_table[topSymbol][token];
-		if (nextSymbols!=undefined) {
-		    // Match - copy RHS of rule to stack
-		    for (var i=nextSymbols.length-1; i>=0; --i)
-			state.stack.push(nextSymbols[i]);
-		} else {
-		    // No match in table - fail
-		    state.OK=false;
-		    recordFailurePos();
-		    state.stack.push(topSymbol);  // Shove topSymbol back on stack
-		}
-	    }
-	} 
-
-    	state.possibleCurrent= state.possibleNext;
-	state.possibleNext= getPossibles(state.stack[state.stack.length-1]);
-
-	//alert(tokenOb.style);
-	return tokenOb.style;
-    }
-
-    
-    var indentTop={
-	"*[,, object]": 3,
-	"?[verb, objectList]": 1,
-	"object": 2,
-	"objectList": 2,
-	"propertyListNotEmpty": 1,
-	"propertyList": 1,
-    };
-
-    var indentTable={
-	"}":1,
-	"]":0,
-	")":1
-    };
-
-    function indent(state, textAfter) {
-	var n = 0; // indent level
-	var i=state.stack.length-1;
-		
-	if (/^[\}\]\)]/.test(textAfter)) {
-	    // Skip stack items until after matching bracket
-	    var closeBracket=textAfter.substr(0,1);
-	    for( ;i>=0;--i)
-	    {
-		if (state.stack[i]==closeBracket)
-		{--i; break};
-	    }
-	} else {
-	    // Consider nullable non-terminals if at top of stack
-	    var dn=indentTop[state.stack[i]];
-	    if (dn) { n+=dn; --i}
-	}
-	for( ;i>=0;--i)
-	{
-	    var dn=indentTable[state.stack[i]];
-	    if (dn) n+=dn;
-	}
-	return n * config.indentUnit;
-    };
-    
-    return {
-	token: tokenBase,
-	startState: function(base) {
-	    return {
-		tokenize: tokenBase,
-		OK: true, 
-		errorStartPos: null,
-		errorEndPos: null,
-		queryType: null,
-		possibleCurrent: getPossibles("query"),
-		possibleNext: getPossibles("query"),
-		stack: ["query"] }; },
-	indent: indent,
-	electricChars: "}])"
-    };
-});
-

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/link.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/link.png b/platform/marmotta-sparql/src/main/resources/web/admin/link.png
new file mode 100755
index 0000000..419c06f
Binary files /dev/null and b/platform/marmotta-sparql/src/main/resources/web/admin/link.png differ


[28/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/builder.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/builder.js b/extras/webjars/snorql/src/main/resources/scriptaculous/builder.js
new file mode 100755
index 0000000..afa33df
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/builder.js
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Builder = {
+  NODEMAP: {
+    AREA: 'map',
+    CAPTION: 'table',
+    COL: 'table',
+    COLGROUP: 'table',
+    LEGEND: 'fieldset',
+    OPTGROUP: 'select',
+    OPTION: 'select',
+    PARAM: 'object',
+    TBODY: 'table',
+    TD: 'table',
+    TFOOT: 'table',
+    TH: 'table',
+    THEAD: 'table',
+    TR: 'table'
+  },
+  // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
+  //       due to a Firefox bug
+  node: function(elementName) {
+    elementName = elementName.toUpperCase();
+    
+    // try innerHTML approach
+    var parentTag = this.NODEMAP[elementName] || 'div';
+    var parentElement = document.createElement(parentTag);
+    try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+      parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
+    } catch(e) {}
+    var element = parentElement.firstChild || null;
+      
+    // see if browser added wrapping tags
+    if(element && (element.tagName.toUpperCase() != elementName))
+      element = element.getElementsByTagName(elementName)[0];
+    
+    // fallback to createElement approach
+    if(!element) element = document.createElement(elementName);
+    
+    // abort if nothing could be created
+    if(!element) return;
+
+    // attributes (or text)
+    if(arguments[1])
+      if(this._isStringOrNumber(arguments[1]) ||
+        (arguments[1] instanceof Array) ||
+        arguments[1].tagName) {
+          this._children(element, arguments[1]);
+        } else {
+          var attrs = this._attributes(arguments[1]);
+          if(attrs.length) {
+            try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+              parentElement.innerHTML = "<" +elementName + " " +
+                attrs + "></" + elementName + ">";
+            } catch(e) {}
+            element = parentElement.firstChild || null;
+            // workaround firefox 1.0.X bug
+            if(!element) {
+              element = document.createElement(elementName);
+              for(attr in arguments[1]) 
+                element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
+            }
+            if(element.tagName.toUpperCase() != elementName)
+              element = parentElement.getElementsByTagName(elementName)[0];
+          }
+        } 
+
+    // text, or array of children
+    if(arguments[2])
+      this._children(element, arguments[2]);
+
+     return element;
+  },
+  _text: function(text) {
+     return document.createTextNode(text);
+  },
+
+  ATTR_MAP: {
+    'className': 'class',
+    'htmlFor': 'for'
+  },
+
+  _attributes: function(attributes) {
+    var attrs = [];
+    for(attribute in attributes)
+      attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
+          '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
+    return attrs.join(" ");
+  },
+  _children: function(element, children) {
+    if(children.tagName) {
+      element.appendChild(children);
+      return;
+    }
+    if(typeof children=='object') { // array can hold nodes and text
+      children.flatten().each( function(e) {
+        if(typeof e=='object')
+          element.appendChild(e)
+        else
+          if(Builder._isStringOrNumber(e))
+            element.appendChild(Builder._text(e));
+      });
+    } else
+      if(Builder._isStringOrNumber(children))
+        element.appendChild(Builder._text(children));
+  },
+  _isStringOrNumber: function(param) {
+    return(typeof param=='string' || typeof param=='number');
+  },
+  build: function(html) {
+    var element = this.node('div');
+    $(element).update(html.strip());
+    return element.down();
+  },
+  dump: function(scope) { 
+    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 
+  
+    var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
+      "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
+      "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
+      "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
+      "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
+      "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
+  
+    tags.each( function(tag){ 
+      scope[tag] = function() { 
+        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
+      } 
+    });
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/controls.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/controls.js b/extras/webjars/snorql/src/main/resources/scriptaculous/controls.js
new file mode 100755
index 0000000..278f99b
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/controls.js
@@ -0,0 +1,971 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Autocompleter.Base handles all the autocompletion functionality
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least, 
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method 
+// should get the text for which to provide autocompletion by
+// invoking this.getToken(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: [',', '\n'] } which
+// enables autocompletion on multiple tokens. This is most 
+// useful when one of the tokens is \n (a newline), as it 
+// allows smart autocompletion after linebreaks.
+
+if(typeof Effect == 'undefined')
+  throw("controls.js requires including script.aculo.us' effects.js library");
+
+var Autocompleter = { }
+Autocompleter.Base = Class.create({
+  baseInitialize: function(element, update, options) {
+    element          = $(element)
+    this.element     = element; 
+    this.update      = $(update);  
+    this.hasFocus    = false; 
+    this.changed     = false; 
+    this.active      = false; 
+    this.index       = 0;     
+    this.entryCount  = 0;
+    this.oldElementValue = this.element.value;
+
+    if(this.setOptions)
+      this.setOptions(options);
+    else
+      this.options = options || { };
+
+    this.options.paramName    = this.options.paramName || this.element.name;
+    this.options.tokens       = this.options.tokens || [];
+    this.options.frequency    = this.options.frequency || 0.4;
+    this.options.minChars     = this.options.minChars || 1;
+    this.options.onShow       = this.options.onShow || 
+      function(element, update){ 
+        if(!update.style.position || update.style.position=='absolute') {
+          update.style.position = 'absolute';
+          Position.clone(element, update, {
+            setHeight: false, 
+            offsetTop: element.offsetHeight
+          });
+        }
+        Effect.Appear(update,{duration:0.15});
+      };
+    this.options.onHide = this.options.onHide || 
+      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+
+    if(typeof(this.options.tokens) == 'string') 
+      this.options.tokens = new Array(this.options.tokens);
+    // Force carriage returns as token delimiters anyway
+    if (!this.options.tokens.include('\n'))
+      this.options.tokens.push('\n');
+
+    this.observer = null;
+    
+    this.element.setAttribute('autocomplete','off');
+
+    Element.hide(this.update);
+
+    Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
+    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
+  },
+
+  show: function() {
+    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
+    if(!this.iefix && 
+      (Prototype.Browser.IE) &&
+      (Element.getStyle(this.update, 'position')=='absolute')) {
+      new Insertion.After(this.update, 
+       '<iframe id="' + this.update.id + '_iefix" '+
+       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
+       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
+      this.iefix = $(this.update.id+'_iefix');
+    }
+    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
+  },
+  
+  fixIEOverlapping: function() {
+    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
+    this.iefix.style.zIndex = 1;
+    this.update.style.zIndex = 2;
+    Element.show(this.iefix);
+  },
+
+  hide: function() {
+    this.stopIndicator();
+    if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
+    if(this.iefix) Element.hide(this.iefix);
+  },
+
+  startIndicator: function() {
+    if(this.options.indicator) Element.show(this.options.indicator);
+  },
+
+  stopIndicator: function() {
+    if(this.options.indicator) Element.hide(this.options.indicator);
+  },
+
+  onKeyPress: function(event) {
+    if(this.active)
+      switch(event.keyCode) {
+       case Event.KEY_TAB:
+       case Event.KEY_RETURN:
+         this.selectEntry();
+         Event.stop(event);
+       case Event.KEY_ESC:
+         this.hide();
+         this.active = false;
+         Event.stop(event);
+         return;
+       case Event.KEY_LEFT:
+       case Event.KEY_RIGHT:
+         return;
+       case Event.KEY_UP:
+         this.markPrevious();
+         this.render();
+         Event.stop(event);
+         return;
+       case Event.KEY_DOWN:
+         this.markNext();
+         this.render();
+         Event.stop(event);
+         return;
+      }
+     else 
+       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 
+         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
+
+    this.changed = true;
+    this.hasFocus = true;
+
+    if(this.observer) clearTimeout(this.observer);
+      this.observer = 
+        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+  },
+
+  activate: function() {
+    this.changed = false;
+    this.hasFocus = true;
+    this.getUpdatedChoices();
+  },
+
+  onHover: function(event) {
+    var element = Event.findElement(event, 'LI');
+    if(this.index != element.autocompleteIndex) 
+    {
+        this.index = element.autocompleteIndex;
+        this.render();
+    }
+    Event.stop(event);
+  },
+  
+  onClick: function(event) {
+    var element = Event.findElement(event, 'LI');
+    this.index = element.autocompleteIndex;
+    this.selectEntry();
+    this.hide();
+  },
+  
+  onBlur: function(event) {
+    // needed to make click events working
+    setTimeout(this.hide.bind(this), 250);
+    this.hasFocus = false;
+    this.active = false;     
+  }, 
+  
+  render: function() {
+    if(this.entryCount > 0) {
+      for (var i = 0; i < this.entryCount; i++)
+        this.index==i ? 
+          Element.addClassName(this.getEntry(i),"selected") : 
+          Element.removeClassName(this.getEntry(i),"selected");
+      if(this.hasFocus) { 
+        this.show();
+        this.active = true;
+      }
+    } else {
+      this.active = false;
+      this.hide();
+    }
+  },
+  
+  markPrevious: function() {
+    if(this.index > 0) this.index--
+      else this.index = this.entryCount-1;
+    this.getEntry(this.index).scrollIntoView(true);
+  },
+  
+  markNext: function() {
+    if(this.index < this.entryCount-1) this.index++
+      else this.index = 0;
+    this.getEntry(this.index).scrollIntoView(false);
+  },
+  
+  getEntry: function(index) {
+    return this.update.firstChild.childNodes[index];
+  },
+  
+  getCurrentEntry: function() {
+    return this.getEntry(this.index);
+  },
+  
+  selectEntry: function() {
+    this.active = false;
+    this.updateElement(this.getCurrentEntry());
+  },
+
+  updateElement: function(selectedElement) {
+    if (this.options.updateElement) {
+      this.options.updateElement(selectedElement);
+      return;
+    }
+    var value = '';
+    if (this.options.select) {
+      var nodes = $(selectedElement).select('.' + this.options.select) || [];
+      if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
+    } else
+      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
+    
+    var bounds = this.getTokenBounds();
+    if (bounds[0] != -1) {
+      var newValue = this.element.value.substr(0, bounds[0]);
+      var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
+      if (whitespace)
+        newValue += whitespace[0];
+      this.element.value = newValue + value + this.element.value.substr(bounds[1]);
+    } else {
+      this.element.value = value;
+    }
+    this.oldElementValue = this.element.value;
+    this.element.focus();
+    
+    if (this.options.afterUpdateElement)
+      this.options.afterUpdateElement(this.element, selectedElement);
+  },
+
+  updateChoices: function(choices) {
+    if(!this.changed && this.hasFocus) {
+      this.update.innerHTML = choices;
+      Element.cleanWhitespace(this.update);
+      Element.cleanWhitespace(this.update.down());
+
+      if(this.update.firstChild && this.update.down().childNodes) {
+        this.entryCount = 
+          this.update.down().childNodes.length;
+        for (var i = 0; i < this.entryCount; i++) {
+          var entry = this.getEntry(i);
+          entry.autocompleteIndex = i;
+          this.addObservers(entry);
+        }
+      } else { 
+        this.entryCount = 0;
+      }
+
+      this.stopIndicator();
+      this.index = 0;
+      
+      if(this.entryCount==1 && this.options.autoSelect) {
+        this.selectEntry();
+        this.hide();
+      } else {
+        this.render();
+      }
+    }
+  },
+
+  addObservers: function(element) {
+    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+  },
+
+  onObserverEvent: function() {
+    this.changed = false;   
+    this.tokenBounds = null;
+    if(this.getToken().length>=this.options.minChars) {
+      this.getUpdatedChoices();
+    } else {
+      this.active = false;
+      this.hide();
+    }
+    this.oldElementValue = this.element.value;
+  },
+
+  getToken: function() {
+    var bounds = this.getTokenBounds();
+    return this.element.value.substring(bounds[0], bounds[1]).strip();
+  },
+
+  getTokenBounds: function() {
+    if (null != this.tokenBounds) return this.tokenBounds;
+    var value = this.element.value;
+    if (value.strip().empty()) return [-1, 0];
+    var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
+    var offset = (diff == this.oldElementValue.length ? 1 : 0);
+    var prevTokenPos = -1, nextTokenPos = value.length;
+    var tp;
+    for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
+      tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
+      if (tp > prevTokenPos) prevTokenPos = tp;
+      tp = value.indexOf(this.options.tokens[index], diff + offset);
+      if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
+    }
+    return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
+  }
+});
+
+Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
+  var boundary = Math.min(newS.length, oldS.length);
+  for (var index = 0; index < boundary; ++index)
+    if (newS[index] != oldS[index])
+      return index;
+  return boundary;
+};
+
+Ajax.Autocompleter = Class.create(Autocompleter.Base, {
+  initialize: function(element, update, url, options) {
+    this.baseInitialize(element, update, options);
+    this.options.asynchronous  = true;
+    this.options.onComplete    = this.onComplete.bind(this);
+    this.options.defaultParams = this.options.parameters || null;
+    this.url                   = url;
+  },
+
+  getUpdatedChoices: function() {
+    this.startIndicator();
+    
+    var entry = encodeURIComponent(this.options.paramName) + '=' + 
+      encodeURIComponent(this.getToken());
+
+    this.options.parameters = this.options.callback ?
+      this.options.callback(this.element, entry) : entry;
+
+    if(this.options.defaultParams) 
+      this.options.parameters += '&' + this.options.defaultParams;
+    
+    new Ajax.Request(this.url, this.options);
+  },
+
+  onComplete: function(request) {
+    this.updateChoices(request.responseText);
+  }
+});
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partialSearch - If false, the autocompleter will match entered
+//                    text only at the beginning of strings in the 
+//                    autocomplete array. Defaults to true, which will
+//                    match text at the beginning of any *word* in the
+//                    strings in the autocomplete array. If you want to
+//                    search anywhere in the string, additionally set
+//                    the option fullSearch to true (default: off).
+//
+// - fullSsearch - Search anywhere in autocomplete array strings.
+//
+// - partialChars - How many characters to enter before triggering
+//                   a partial match (unlike minChars, which defines
+//                   how many characters are required to do any match
+//                   at all). Defaults to 2.
+//
+// - ignoreCase - Whether to ignore case when autocompleting.
+//                 Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector' 
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create(Autocompleter.Base, {
+  initialize: function(element, update, array, options) {
+    this.baseInitialize(element, update, options);
+    this.options.array = array;
+  },
+
+  getUpdatedChoices: function() {
+    this.updateChoices(this.options.selector(this));
+  },
+
+  setOptions: function(options) {
+    this.options = Object.extend({
+      choices: 10,
+      partialSearch: true,
+      partialChars: 2,
+      ignoreCase: true,
+      fullSearch: false,
+      selector: function(instance) {
+        var ret       = []; // Beginning matches
+        var partial   = []; // Inside matches
+        var entry     = instance.getToken();
+        var count     = 0;
+
+        for (var i = 0; i < instance.options.array.length &&  
+          ret.length < instance.options.choices ; i++) { 
+
+          var elem = instance.options.array[i];
+          var foundPos = instance.options.ignoreCase ? 
+            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
+            elem.indexOf(entry);
+
+          while (foundPos != -1) {
+            if (foundPos == 0 && elem.length != entry.length) { 
+              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
+                elem.substr(entry.length) + "</li>");
+              break;
+            } else if (entry.length >= instance.options.partialChars && 
+              instance.options.partialSearch && foundPos != -1) {
+              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
+                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
+                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
+                  foundPos + entry.length) + "</li>");
+                break;
+              }
+            }
+
+            foundPos = instance.options.ignoreCase ? 
+              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 
+              elem.indexOf(entry, foundPos + 1);
+
+          }
+        }
+        if (partial.length)
+          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+        return "<ul>" + ret.join('') + "</ul>";
+      }
+    }, options || { });
+  }
+});
+
+// AJAX in-place editor and collection editor
+// Full rewrite by Christophe Porteneuve <td...@tddsworld.com> (April 2007).
+
+// Use this if you notice weird scrolling problems on some browsers,
+// the DOM might be a bit confused when this gets called so do this
+// waits 1 ms (with setTimeout) until it does the activation
+Field.scrollFreeActivate = function(field) {
+  setTimeout(function() {
+    Field.activate(field);
+  }, 1);
+}
+
+Ajax.InPlaceEditor = Class.create({
+  initialize: function(element, url, options) {
+    this.url = url;
+    this.element = element = $(element);
+    this.prepareOptions();
+    this._controls = { };
+    arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
+    Object.extend(this.options, options || { });
+    if (!this.options.formId && this.element.id) {
+      this.options.formId = this.element.id + '-inplaceeditor';
+      if ($(this.options.formId))
+        this.options.formId = '';
+    }
+    if (this.options.externalControl)
+      this.options.externalControl = $(this.options.externalControl);
+    if (!this.options.externalControl)
+      this.options.externalControlOnly = false;
+    this._originalBackground = this.element.getStyle('background-color') || 'transparent';
+    this.element.title = this.options.clickToEditText;
+    this._boundCancelHandler = this.handleFormCancellation.bind(this);
+    this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
+    this._boundFailureHandler = this.handleAJAXFailure.bind(this);
+    this._boundSubmitHandler = this.handleFormSubmission.bind(this);
+    this._boundWrapperHandler = this.wrapUp.bind(this);
+    this.registerListeners();
+  },
+  checkForEscapeOrReturn: function(e) {
+    if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
+    if (Event.KEY_ESC == e.keyCode)
+      this.handleFormCancellation(e);
+    else if (Event.KEY_RETURN == e.keyCode)
+      this.handleFormSubmission(e);
+  },
+  createControl: function(mode, handler, extraClasses) {
+    var control = this.options[mode + 'Control'];
+    var text = this.options[mode + 'Text'];
+    if ('button' == control) {
+      var btn = document.createElement('input');
+      btn.type = 'submit';
+      btn.value = text;
+      btn.className = 'editor_' + mode + '_button';
+      if ('cancel' == mode)
+        btn.onclick = this._boundCancelHandler;
+      this._form.appendChild(btn);
+      this._controls[mode] = btn;
+    } else if ('link' == control) {
+      var link = document.createElement('a');
+      link.href = '#';
+      link.appendChild(document.createTextNode(text));
+      link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
+      link.className = 'editor_' + mode + '_link';
+      if (extraClasses)
+        link.className += ' ' + extraClasses;
+      this._form.appendChild(link);
+      this._controls[mode] = link;
+    }
+  },
+  createEditField: function() {
+    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
+    var fld;
+    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
+      fld = document.createElement('input');
+      fld.type = 'text';
+      var size = this.options.size || this.options.cols || 0;
+      if (0 < size) fld.size = size;
+    } else {
+      fld = document.createElement('textarea');
+      fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
+      fld.cols = this.options.cols || 40;
+    }
+    fld.name = this.options.paramName;
+    fld.value = text; // No HTML breaks conversion anymore
+    fld.className = 'editor_field';
+    if (this.options.submitOnBlur)
+      fld.onblur = this._boundSubmitHandler;
+    this._controls.editor = fld;
+    if (this.options.loadTextURL)
+      this.loadExternalText();
+    this._form.appendChild(this._controls.editor);
+  },
+  createForm: function() {
+    var ipe = this;
+    function addText(mode, condition) {
+      var text = ipe.options['text' + mode + 'Controls'];
+      if (!text || condition === false) return;
+      ipe._form.appendChild(document.createTextNode(text));
+    };
+    this._form = $(document.createElement('form'));
+    this._form.id = this.options.formId;
+    this._form.addClassName(this.options.formClassName);
+    this._form.onsubmit = this._boundSubmitHandler;
+    this.createEditField();
+    if ('textarea' == this._controls.editor.tagName.toLowerCase())
+      this._form.appendChild(document.createElement('br'));
+    if (this.options.onFormCustomization)
+      this.options.onFormCustomization(this, this._form);
+    addText('Before', this.options.okControl || this.options.cancelControl);
+    this.createControl('ok', this._boundSubmitHandler);
+    addText('Between', this.options.okControl && this.options.cancelControl);
+    this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
+    addText('After', this.options.okControl || this.options.cancelControl);
+  },
+  destroy: function() {
+    if (this._oldInnerHTML)
+      this.element.innerHTML = this._oldInnerHTML;
+    this.leaveEditMode();
+    this.unregisterListeners();
+  },
+  enterEditMode: function(e) {
+    if (this._saving || this._editing) return;
+    this._editing = true;
+    this.triggerCallback('onEnterEditMode');
+    if (this.options.externalControl)
+      this.options.externalControl.hide();
+    this.element.hide();
+    this.createForm();
+    this.element.parentNode.insertBefore(this._form, this.element);
+    if (!this.options.loadTextURL)
+      this.postProcessEditField();
+    if (e) Event.stop(e);
+  },
+  enterHover: function(e) {
+    if (this.options.hoverClassName)
+      this.element.addClassName(this.options.hoverClassName);
+    if (this._saving) return;
+    this.triggerCallback('onEnterHover');
+  },
+  getText: function() {
+    return this.element.innerHTML;
+  },
+  handleAJAXFailure: function(transport) {
+    this.triggerCallback('onFailure', transport);
+    if (this._oldInnerHTML) {
+      this.element.innerHTML = this._oldInnerHTML;
+      this._oldInnerHTML = null;
+    }
+  },
+  handleFormCancellation: function(e) {
+    this.wrapUp();
+    if (e) Event.stop(e);
+  },
+  handleFormSubmission: function(e) {
+    var form = this._form;
+    var value = $F(this._controls.editor);
+    this.prepareSubmission();
+    var params = this.options.callback(form, value) || '';
+    if (Object.isString(params))
+      params = params.toQueryParams();
+    params.editorId = this.element.id;
+    if (this.options.htmlResponse) {
+      var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
+      Object.extend(options, {
+        parameters: params,
+        onComplete: this._boundWrapperHandler,
+        onFailure: this._boundFailureHandler
+      });
+      new Ajax.Updater({ success: this.element }, this.url, options);
+    } else {
+      var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+      Object.extend(options, {
+        parameters: params,
+        onComplete: this._boundWrapperHandler,
+        onFailure: this._boundFailureHandler
+      });
+      new Ajax.Request(this.url, options);
+    }
+    if (e) Event.stop(e);
+  },
+  leaveEditMode: function() {
+    this.element.removeClassName(this.options.savingClassName);
+    this.removeForm();
+    this.leaveHover();
+    this.element.style.backgroundColor = this._originalBackground;
+    this.element.show();
+    if (this.options.externalControl)
+      this.options.externalControl.show();
+    this._saving = false;
+    this._editing = false;
+    this._oldInnerHTML = null;
+    this.triggerCallback('onLeaveEditMode');
+  },
+  leaveHover: function(e) {
+    if (this.options.hoverClassName)
+      this.element.removeClassName(this.options.hoverClassName);
+    if (this._saving) return;
+    this.triggerCallback('onLeaveHover');
+  },
+  loadExternalText: function() {
+    this._form.addClassName(this.options.loadingClassName);
+    this._controls.editor.disabled = true;
+    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+    Object.extend(options, {
+      parameters: 'editorId=' + encodeURIComponent(this.element.id),
+      onComplete: Prototype.emptyFunction,
+      onSuccess: function(transport) {
+        this._form.removeClassName(this.options.loadingClassName);
+        var text = transport.responseText;
+        if (this.options.stripLoadedTextTags)
+          text = text.stripTags();
+        this._controls.editor.value = text;
+        this._controls.editor.disabled = false;
+        this.postProcessEditField();
+      }.bind(this),
+      onFailure: this._boundFailureHandler
+    });
+    new Ajax.Request(this.options.loadTextURL, options);
+  },
+  postProcessEditField: function() {
+    var fpc = this.options.fieldPostCreation;
+    if (fpc)
+      $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
+  },
+  prepareOptions: function() {
+    this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
+    Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
+    [this._extraDefaultOptions].flatten().compact().each(function(defs) {
+      Object.extend(this.options, defs);
+    }.bind(this));
+  },
+  prepareSubmission: function() {
+    this._saving = true;
+    this.removeForm();
+    this.leaveHover();
+    this.showSaving();
+  },
+  registerListeners: function() {
+    this._listeners = { };
+    var listener;
+    $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
+      listener = this[pair.value].bind(this);
+      this._listeners[pair.key] = listener;
+      if (!this.options.externalControlOnly)
+        this.element.observe(pair.key, listener);
+      if (this.options.externalControl)
+        this.options.externalControl.observe(pair.key, listener);
+    }.bind(this));
+  },
+  removeForm: function() {
+    if (!this._form) return;
+    this._form.remove();
+    this._form = null;
+    this._controls = { };
+  },
+  showSaving: function() {
+    this._oldInnerHTML = this.element.innerHTML;
+    this.element.innerHTML = this.options.savingText;
+    this.element.addClassName(this.options.savingClassName);
+    this.element.style.backgroundColor = this._originalBackground;
+    this.element.show();
+  },
+  triggerCallback: function(cbName, arg) {
+    if ('function' == typeof this.options[cbName]) {
+      this.options[cbName](this, arg);
+    }
+  },
+  unregisterListeners: function() {
+    $H(this._listeners).each(function(pair) {
+      if (!this.options.externalControlOnly)
+        this.element.stopObserving(pair.key, pair.value);
+      if (this.options.externalControl)
+        this.options.externalControl.stopObserving(pair.key, pair.value);
+    }.bind(this));
+  },
+  wrapUp: function(transport) {
+    this.leaveEditMode();
+    // Can't use triggerCallback due to backward compatibility: requires
+    // binding + direct element
+    this._boundComplete(transport, this.element);
+  }
+});
+
+Object.extend(Ajax.InPlaceEditor.prototype, {
+  dispose: Ajax.InPlaceEditor.prototype.destroy
+});
+
+Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
+  initialize: function($super, element, url, options) {
+    this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
+    $super(element, url, options);
+  },
+
+  createEditField: function() {
+    var list = document.createElement('select');
+    list.name = this.options.paramName;
+    list.size = 1;
+    this._controls.editor = list;
+    this._collection = this.options.collection || [];
+    if (this.options.loadCollectionURL)
+      this.loadCollection();
+    else
+      this.checkForExternalText();
+    this._form.appendChild(this._controls.editor);
+  },
+
+  loadCollection: function() {
+    this._form.addClassName(this.options.loadingClassName);
+    this.showLoadingText(this.options.loadingCollectionText);
+    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+    Object.extend(options, {
+      parameters: 'editorId=' + encodeURIComponent(this.element.id),
+      onComplete: Prototype.emptyFunction,
+      onSuccess: function(transport) {
+        var js = transport.responseText.strip();
+        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
+          throw 'Server returned an invalid collection representation.';
+        this._collection = eval(js);
+        this.checkForExternalText();
+      }.bind(this),
+      onFailure: this.onFailure
+    });
+    new Ajax.Request(this.options.loadCollectionURL, options);
+  },
+
+  showLoadingText: function(text) {
+    this._controls.editor.disabled = true;
+    var tempOption = this._controls.editor.firstChild;
+    if (!tempOption) {
+      tempOption = document.createElement('option');
+      tempOption.value = '';
+      this._controls.editor.appendChild(tempOption);
+      tempOption.selected = true;
+    }
+    tempOption.update((text || '').stripScripts().stripTags());
+  },
+
+  checkForExternalText: function() {
+    this._text = this.getText();
+    if (this.options.loadTextURL)
+      this.loadExternalText();
+    else
+      this.buildOptionList();
+  },
+
+  loadExternalText: function() {
+    this.showLoadingText(this.options.loadingText);
+    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+    Object.extend(options, {
+      parameters: 'editorId=' + encodeURIComponent(this.element.id),
+      onComplete: Prototype.emptyFunction,
+      onSuccess: function(transport) {
+        this._text = transport.responseText.strip();
+        this.buildOptionList();
+      }.bind(this),
+      onFailure: this.onFailure
+    });
+    new Ajax.Request(this.options.loadTextURL, options);
+  },
+
+  buildOptionList: function() {
+    this._form.removeClassName(this.options.loadingClassName);
+    this._collection = this._collection.map(function(entry) {
+      return 2 === entry.length ? entry : [entry, entry].flatten();
+    });
+    var marker = ('value' in this.options) ? this.options.value : this._text;
+    var textFound = this._collection.any(function(entry) {
+      return entry[0] == marker;
+    }.bind(this));
+    this._controls.editor.update('');
+    var option;
+    this._collection.each(function(entry, index) {
+      option = document.createElement('option');
+      option.value = entry[0];
+      option.selected = textFound ? entry[0] == marker : 0 == index;
+      option.appendChild(document.createTextNode(entry[1]));
+      this._controls.editor.appendChild(option);
+    }.bind(this));
+    this._controls.editor.disabled = false;
+    Field.scrollFreeActivate(this._controls.editor);
+  }
+});
+
+//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
+//**** This only  exists for a while,  in order to  let ****
+//**** users adapt to  the new API.  Read up on the new ****
+//**** API and convert your code to it ASAP!            ****
+
+Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
+  if (!options) return;
+  function fallback(name, expr) {
+    if (name in options || expr === undefined) return;
+    options[name] = expr;
+  };
+  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
+    options.cancelLink == options.cancelButton == false ? false : undefined)));
+  fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
+    options.okLink == options.okButton == false ? false : undefined)));
+  fallback('highlightColor', options.highlightcolor);
+  fallback('highlightEndColor', options.highlightendcolor);
+};
+
+Object.extend(Ajax.InPlaceEditor, {
+  DefaultOptions: {
+    ajaxOptions: { },
+    autoRows: 3,                                // Use when multi-line w/ rows == 1
+    cancelControl: 'link',                      // 'link'|'button'|false
+    cancelText: 'cancel',
+    clickToEditText: 'Click to edit',
+    externalControl: null,                      // id|elt
+    externalControlOnly: false,
+    fieldPostCreation: 'activate',              // 'activate'|'focus'|false
+    formClassName: 'inplaceeditor-form',
+    formId: null,                               // id|elt
+    highlightColor: '#ffff99',
+    highlightEndColor: '#ffffff',
+    hoverClassName: '',
+    htmlResponse: true,
+    loadingClassName: 'inplaceeditor-loading',
+    loadingText: 'Loading...',
+    okControl: 'button',                        // 'link'|'button'|false
+    okText: 'ok',
+    paramName: 'value',
+    rows: 1,                                    // If 1 and multi-line, uses autoRows
+    savingClassName: 'inplaceeditor-saving',
+    savingText: 'Saving...',
+    size: 0,
+    stripLoadedTextTags: false,
+    submitOnBlur: false,
+    textAfterControls: '',
+    textBeforeControls: '',
+    textBetweenControls: ''
+  },
+  DefaultCallbacks: {
+    callback: function(form) {
+      return Form.serialize(form);
+    },
+    onComplete: function(transport, element) {
+      // For backward compatibility, this one is bound to the IPE, and passes
+      // the element directly.  It was too often customized, so we don't break it.
+      new Effect.Highlight(element, {
+        startcolor: this.options.highlightColor, keepBackgroundImage: true });
+    },
+    onEnterEditMode: null,
+    onEnterHover: function(ipe) {
+      ipe.element.style.backgroundColor = ipe.options.highlightColor;
+      if (ipe._effect)
+        ipe._effect.cancel();
+    },
+    onFailure: function(transport, ipe) {
+      alert('Error communication with the server: ' + transport.responseText.stripTags());
+    },
+    onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
+    onLeaveEditMode: null,
+    onLeaveHover: function(ipe) {
+      ipe._effect = new Effect.Highlight(ipe.element, {
+        startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
+        restorecolor: ipe._originalBackground, keepBackgroundImage: true
+      });
+    }
+  },
+  Listeners: {
+    click: 'enterEditMode',
+    keydown: 'checkForEscapeOrReturn',
+    mouseover: 'enterHover',
+    mouseout: 'leaveHover'
+  }
+});
+
+Ajax.InPlaceCollectionEditor.DefaultOptions = {
+  loadingCollectionText: 'Loading options...'
+};
+
+// Delayed observer, like Form.Element.Observer, 
+// but waits for delay after last key input
+// Ideal for live-search fields
+
+Form.Element.DelayedObserver = Class.create({
+  initialize: function(element, delay, callback) {
+    this.delay     = delay || 0.5;
+    this.element   = $(element);
+    this.callback  = callback;
+    this.timer     = null;
+    this.lastValue = $F(this.element); 
+    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
+  },
+  delayedListener: function(event) {
+    if(this.lastValue == $F(this.element)) return;
+    if(this.timer) clearTimeout(this.timer);
+    this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
+    this.lastValue = $F(this.element);
+  },
+  onTimerEvent: function() {
+    this.timer = null;
+    this.callback(this.element, $F(this.element));
+  }
+});

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/dragdrop.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/dragdrop.js b/extras/webjars/snorql/src/main/resources/scriptaculous/dragdrop.js
new file mode 100755
index 0000000..dde6393
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/dragdrop.js
@@ -0,0 +1,985 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+if(Object.isUndefined(Effect))
+  throw("dragdrop.js requires including script.aculo.us' effects.js library");
+
+var Droppables = {
+  drops: [],
+
+  remove: function(element) {
+    this.drops = this.drops.reject(function(d) { return d.element==$(element) });
+  },
+
+  add: function(element) {
+    element = $(element);
+    var options = Object.extend({
+      greedy:     true,
+      hoverclass: null,
+      tree:       false
+    }, arguments[1] || { });
+
+    // cache containers
+    if(options.containment) {
+      options._containers = [];
+      var containment = options.containment;
+      if(Object.isArray(containment)) {
+        containment.each( function(c) { options._containers.push($(c)) });
+      } else {
+        options._containers.push($(containment));
+      }
+    }
+    
+    if(options.accept) options.accept = [options.accept].flatten();
+
+    Element.makePositioned(element); // fix IE
+    options.element = element;
+
+    this.drops.push(options);
+  },
+  
+  findDeepestChild: function(drops) {
+    deepest = drops[0];
+      
+    for (i = 1; i < drops.length; ++i)
+      if (Element.isParent(drops[i].element, deepest.element))
+        deepest = drops[i];
+    
+    return deepest;
+  },
+
+  isContained: function(element, drop) {
+    var containmentNode;
+    if(drop.tree) {
+      containmentNode = element.treeNode; 
+    } else {
+      containmentNode = element.parentNode;
+    }
+    return drop._containers.detect(function(c) { return containmentNode == c });
+  },
+  
+  isAffected: function(point, element, drop) {
+    return (
+      (drop.element!=element) &&
+      ((!drop._containers) ||
+        this.isContained(element, drop)) &&
+      ((!drop.accept) ||
+        (Element.classNames(element).detect( 
+          function(v) { return drop.accept.include(v) } ) )) &&
+      Position.within(drop.element, point[0], point[1]) );
+  },
+
+  deactivate: function(drop) {
+    if(drop.hoverclass)
+      Element.removeClassName(drop.element, drop.hoverclass);
+    this.last_active = null;
+  },
+
+  activate: function(drop) {
+    if(drop.hoverclass)
+      Element.addClassName(drop.element, drop.hoverclass);
+    this.last_active = drop;
+  },
+
+  show: function(point, element) {
+    if(!this.drops.length) return;
+    var drop, affected = [];
+    
+    this.drops.each( function(drop) {
+      if(Droppables.isAffected(point, element, drop))
+        affected.push(drop);
+    });
+        
+    if(affected.length>0)
+      drop = Droppables.findDeepestChild(affected);
+
+    if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
+    if (drop) {
+      Position.within(drop.element, point[0], point[1]);
+      if(drop.onHover)
+        drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
+      
+      if (drop != this.last_active) Droppables.activate(drop);
+    }
+  },
+
+  fire: function(event, element) {
+    if(!this.last_active) return;
+    Position.prepare();
+
+    if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
+      if (this.last_active.onDrop) {
+        this.last_active.onDrop(element, this.last_active.element, event); 
+        return true; 
+      }
+  },
+
+  reset: function() {
+    if(this.last_active)
+      this.deactivate(this.last_active);
+  }
+}
+
+var Draggables = {
+  drags: [],
+  observers: [],
+  
+  register: function(draggable) {
+    if(this.drags.length == 0) {
+      this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
+      this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
+      this.eventKeypress  = this.keyPress.bindAsEventListener(this);
+      
+      Event.observe(document, "mouseup", this.eventMouseUp);
+      Event.observe(document, "mousemove", this.eventMouseMove);
+      Event.observe(document, "keypress", this.eventKeypress);
+    }
+    this.drags.push(draggable);
+  },
+  
+  unregister: function(draggable) {
+    this.drags = this.drags.reject(function(d) { return d==draggable });
+    if(this.drags.length == 0) {
+      Event.stopObserving(document, "mouseup", this.eventMouseUp);
+      Event.stopObserving(document, "mousemove", this.eventMouseMove);
+      Event.stopObserving(document, "keypress", this.eventKeypress);
+    }
+  },
+  
+  activate: function(draggable) {
+    if(draggable.options.delay) { 
+      this._timeout = setTimeout(function() { 
+        Draggables._timeout = null; 
+        window.focus(); 
+        Draggables.activeDraggable = draggable; 
+      }.bind(this), draggable.options.delay); 
+    } else {
+      window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
+      this.activeDraggable = draggable;
+    }
+  },
+  
+  deactivate: function() {
+    this.activeDraggable = null;
+  },
+  
+  updateDrag: function(event) {
+    if(!this.activeDraggable) return;
+    var pointer = [Event.pointerX(event), Event.pointerY(event)];
+    // Mozilla-based browsers fire successive mousemove events with
+    // the same coordinates, prevent needless redrawing (moz bug?)
+    if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
+    this._lastPointer = pointer;
+    
+    this.activeDraggable.updateDrag(event, pointer);
+  },
+  
+  endDrag: function(event) {
+    if(this._timeout) { 
+      clearTimeout(this._timeout); 
+      this._timeout = null; 
+    }
+    if(!this.activeDraggable) return;
+    this._lastPointer = null;
+    this.activeDraggable.endDrag(event);
+    this.activeDraggable = null;
+  },
+  
+  keyPress: function(event) {
+    if(this.activeDraggable)
+      this.activeDraggable.keyPress(event);
+  },
+  
+  addObserver: function(observer) {
+    this.observers.push(observer);
+    this._cacheObserverCallbacks();
+  },
+  
+  removeObserver: function(element) {  // element instead of observer fixes mem leaks
+    this.observers = this.observers.reject( function(o) { return o.element==element });
+    this._cacheObserverCallbacks();
+  },
+  
+  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
+    if(this[eventName+'Count'] > 0)
+      this.observers.each( function(o) {
+        if(o[eventName]) o[eventName](eventName, draggable, event);
+      });
+    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
+  },
+  
+  _cacheObserverCallbacks: function() {
+    ['onStart','onEnd','onDrag'].each( function(eventName) {
+      Draggables[eventName+'Count'] = Draggables.observers.select(
+        function(o) { return o[eventName]; }
+      ).length;
+    });
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Draggable = Class.create({
+  initialize: function(element) {
+    var defaults = {
+      handle: false,
+      reverteffect: function(element, top_offset, left_offset) {
+        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
+        new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
+          queue: {scope:'_draggable', position:'end'}
+        });
+      },
+      endeffect: function(element) {
+        var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
+        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
+          queue: {scope:'_draggable', position:'end'},
+          afterFinish: function(){ 
+            Draggable._dragging[element] = false 
+          }
+        }); 
+      },
+      zindex: 1000,
+      revert: false,
+      quiet: false,
+      scroll: false,
+      scrollSensitivity: 20,
+      scrollSpeed: 15,
+      snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
+      delay: 0
+    };
+    
+    if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
+      Object.extend(defaults, {
+        starteffect: function(element) {
+          element._opacity = Element.getOpacity(element);
+          Draggable._dragging[element] = true;
+          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
+        }
+      });
+    
+    var options = Object.extend(defaults, arguments[1] || { });
+
+    this.element = $(element);
+    
+    if(options.handle && Object.isString(options.handle))
+      this.handle = this.element.down('.'+options.handle, 0);
+    
+    if(!this.handle) this.handle = $(options.handle);
+    if(!this.handle) this.handle = this.element;
+    
+    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
+      options.scroll = $(options.scroll);
+      this._isScrollChild = Element.childOf(this.element, options.scroll);
+    }
+
+    Element.makePositioned(this.element); // fix IE    
+
+    this.options  = options;
+    this.dragging = false;   
+
+    this.eventMouseDown = this.initDrag.bindAsEventListener(this);
+    Event.observe(this.handle, "mousedown", this.eventMouseDown);
+    
+    Draggables.register(this);
+  },
+  
+  destroy: function() {
+    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
+    Draggables.unregister(this);
+  },
+  
+  currentDelta: function() {
+    return([
+      parseInt(Element.getStyle(this.element,'left') || '0'),
+      parseInt(Element.getStyle(this.element,'top') || '0')]);
+  },
+  
+  initDrag: function(event) {
+    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
+      Draggable._dragging[this.element]) return;
+    if(Event.isLeftClick(event)) {    
+      // abort on form elements, fixes a Firefox issue
+      var src = Event.element(event);
+      if((tag_name = src.tagName.toUpperCase()) && (
+        tag_name=='INPUT' ||
+        tag_name=='SELECT' ||
+        tag_name=='OPTION' ||
+        tag_name=='BUTTON' ||
+        tag_name=='TEXTAREA')) return;
+        
+      var pointer = [Event.pointerX(event), Event.pointerY(event)];
+      var pos     = Position.cumulativeOffset(this.element);
+      this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
+      
+      Draggables.activate(this);
+      Event.stop(event);
+    }
+  },
+  
+  startDrag: function(event) {
+    this.dragging = true;
+    if(!this.delta)
+      this.delta = this.currentDelta();
+    
+    if(this.options.zindex) {
+      this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
+      this.element.style.zIndex = this.options.zindex;
+    }
+    
+    if(this.options.ghosting) {
+      this._clone = this.element.cloneNode(true);
+      this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
+      if (!this.element._originallyAbsolute)
+        Position.absolutize(this.element);
+      this.element.parentNode.insertBefore(this._clone, this.element);
+    }
+    
+    if(this.options.scroll) {
+      if (this.options.scroll == window) {
+        var where = this._getWindowScroll(this.options.scroll);
+        this.originalScrollLeft = where.left;
+        this.originalScrollTop = where.top;
+      } else {
+        this.originalScrollLeft = this.options.scroll.scrollLeft;
+        this.originalScrollTop = this.options.scroll.scrollTop;
+      }
+    }
+    
+    Draggables.notify('onStart', this, event);
+        
+    if(this.options.starteffect) this.options.starteffect(this.element);
+  },
+  
+  updateDrag: function(event, pointer) {
+    if(!this.dragging) this.startDrag(event);
+    
+    if(!this.options.quiet){
+      Position.prepare();
+      Droppables.show(pointer, this.element);
+    }
+    
+    Draggables.notify('onDrag', this, event);
+    
+    this.draw(pointer);
+    if(this.options.change) this.options.change(this);
+    
+    if(this.options.scroll) {
+      this.stopScrolling();
+      
+      var p;
+      if (this.options.scroll == window) {
+        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
+      } else {
+        p = Position.page(this.options.scroll);
+        p[0] += this.options.scroll.scrollLeft + Position.deltaX;
+        p[1] += this.options.scroll.scrollTop + Position.deltaY;
+        p.push(p[0]+this.options.scroll.offsetWidth);
+        p.push(p[1]+this.options.scroll.offsetHeight);
+      }
+      var speed = [0,0];
+      if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
+      if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
+      if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
+      if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
+      this.startScrolling(speed);
+    }
+    
+    // fix AppleWebKit rendering
+    if(Prototype.Browser.WebKit) window.scrollBy(0,0);
+    
+    Event.stop(event);
+  },
+  
+  finishDrag: function(event, success) {
+    this.dragging = false;
+    
+    if(this.options.quiet){
+      Position.prepare();
+      var pointer = [Event.pointerX(event), Event.pointerY(event)];
+      Droppables.show(pointer, this.element);
+    }
+
+    if(this.options.ghosting) {
+      if (!this.element._originallyAbsolute)
+        Position.relativize(this.element);
+      delete this.element._originallyAbsolute;
+      Element.remove(this._clone);
+      this._clone = null;
+    }
+
+    var dropped = false; 
+    if(success) { 
+      dropped = Droppables.fire(event, this.element); 
+      if (!dropped) dropped = false; 
+    }
+    if(dropped && this.options.onDropped) this.options.onDropped(this.element);
+    Draggables.notify('onEnd', this, event);
+
+    var revert = this.options.revert;
+    if(revert && Object.isFunction(revert)) revert = revert(this.element);
+    
+    var d = this.currentDelta();
+    if(revert && this.options.reverteffect) {
+      if (dropped == 0 || revert != 'failure')
+        this.options.reverteffect(this.element,
+          d[1]-this.delta[1], d[0]-this.delta[0]);
+    } else {
+      this.delta = d;
+    }
+
+    if(this.options.zindex)
+      this.element.style.zIndex = this.originalZ;
+
+    if(this.options.endeffect) 
+      this.options.endeffect(this.element);
+      
+    Draggables.deactivate(this);
+    Droppables.reset();
+  },
+  
+  keyPress: function(event) {
+    if(event.keyCode!=Event.KEY_ESC) return;
+    this.finishDrag(event, false);
+    Event.stop(event);
+  },
+  
+  endDrag: function(event) {
+    if(!this.dragging) return;
+    this.stopScrolling();
+    this.finishDrag(event, true);
+    Event.stop(event);
+  },
+  
+  draw: function(point) {
+    var pos = Position.cumulativeOffset(this.element);
+    if(this.options.ghosting) {
+      var r   = Position.realOffset(this.element);
+      pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
+    }
+    
+    var d = this.currentDelta();
+    pos[0] -= d[0]; pos[1] -= d[1];
+    
+    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
+      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
+      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
+    }
+    
+    var p = [0,1].map(function(i){ 
+      return (point[i]-pos[i]-this.offset[i]) 
+    }.bind(this));
+    
+    if(this.options.snap) {
+      if(Object.isFunction(this.options.snap)) {
+        p = this.options.snap(p[0],p[1],this);
+      } else {
+      if(Object.isArray(this.options.snap)) {
+        p = p.map( function(v, i) {
+          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
+      } else {
+        p = p.map( function(v) {
+          return (v/this.options.snap).round()*this.options.snap }.bind(this))
+      }
+    }}
+    
+    var style = this.element.style;
+    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
+      style.left = p[0] + "px";
+    if((!this.options.constraint) || (this.options.constraint=='vertical'))
+      style.top  = p[1] + "px";
+    
+    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
+  },
+  
+  stopScrolling: function() {
+    if(this.scrollInterval) {
+      clearInterval(this.scrollInterval);
+      this.scrollInterval = null;
+      Draggables._lastScrollPointer = null;
+    }
+  },
+  
+  startScrolling: function(speed) {
+    if(!(speed[0] || speed[1])) return;
+    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
+    this.lastScrolled = new Date();
+    this.scrollInterval = setInterval(this.scroll.bind(this), 10);
+  },
+  
+  scroll: function() {
+    var current = new Date();
+    var delta = current - this.lastScrolled;
+    this.lastScrolled = current;
+    if(this.options.scroll == window) {
+      with (this._getWindowScroll(this.options.scroll)) {
+        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
+          var d = delta / 1000;
+          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
+        }
+      }
+    } else {
+      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
+      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
+    }
+    
+    Position.prepare();
+    Droppables.show(Draggables._lastPointer, this.element);
+    Draggables.notify('onDrag', this);
+    if (this._isScrollChild) {
+      Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
+      Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
+      Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
+      if (Draggables._lastScrollPointer[0] < 0)
+        Draggables._lastScrollPointer[0] = 0;
+      if (Draggables._lastScrollPointer[1] < 0)
+        Draggables._lastScrollPointer[1] = 0;
+      this.draw(Draggables._lastScrollPointer);
+    }
+    
+    if(this.options.change) this.options.change(this);
+  },
+  
+  _getWindowScroll: function(w) {
+    var T, L, W, H;
+    with (w.document) {
+      if (w.document.documentElement && documentElement.scrollTop) {
+        T = documentElement.scrollTop;
+        L = documentElement.scrollLeft;
+      } else if (w.document.body) {
+        T = body.scrollTop;
+        L = body.scrollLeft;
+      }
+      if (w.innerWidth) {
+        W = w.innerWidth;
+        H = w.innerHeight;
+      } else if (w.document.documentElement && documentElement.clientWidth) {
+        W = documentElement.clientWidth;
+        H = documentElement.clientHeight;
+      } else {
+        W = body.offsetWidth;
+        H = body.offsetHeight
+      }
+    }
+    return { top: T, left: L, width: W, height: H };
+  }
+});
+
+Draggable._dragging = { };
+
+/*--------------------------------------------------------------------------*/
+
+var SortableObserver = Class.create({
+  initialize: function(element, observer) {
+    this.element   = $(element);
+    this.observer  = observer;
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  
+  onStart: function() {
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  
+  onEnd: function() {
+    Sortable.unmark();
+    if(this.lastValue != Sortable.serialize(this.element))
+      this.observer(this.element)
+  }
+});
+
+var Sortable = {
+  SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
+  
+  sortables: { },
+  
+  _findRootElement: function(element) {
+    while (element.tagName.toUpperCase() != "BODY") {  
+      if(element.id && Sortable.sortables[element.id]) return element;
+      element = element.parentNode;
+    }
+  },
+
+  options: function(element) {
+    element = Sortable._findRootElement($(element));
+    if(!element) return;
+    return Sortable.sortables[element.id];
+  },
+  
+  destroy: function(element){
+    var s = Sortable.options(element);
+    
+    if(s) {
+      Draggables.removeObserver(s.element);
+      s.droppables.each(function(d){ Droppables.remove(d) });
+      s.draggables.invoke('destroy');
+      
+      delete Sortable.sortables[s.element.id];
+    }
+  },
+
+  create: function(element) {
+    element = $(element);
+    var options = Object.extend({ 
+      element:     element,
+      tag:         'li',       // assumes li children, override with tag: 'tagname'
+      dropOnEmpty: false,
+      tree:        false,
+      treeTag:     'ul',
+      overlap:     'vertical', // one of 'vertical', 'horizontal'
+      constraint:  'vertical', // one of 'vertical', 'horizontal', false
+      containment: element,    // also takes array of elements (or id's); or false
+      handle:      false,      // or a CSS class
+      only:        false,
+      delay:       0,
+      hoverclass:  null,
+      ghosting:    false,
+      quiet:       false, 
+      scroll:      false,
+      scrollSensitivity: 20,
+      scrollSpeed: 15,
+      format:      this.SERIALIZE_RULE,
+      
+      // these take arrays of elements or ids and can be 
+      // used for better initialization performance
+      elements:    false,
+      handles:     false,
+      
+      onChange:    Prototype.emptyFunction,
+      onUpdate:    Prototype.emptyFunction
+    }, arguments[1] || { });
+
+    // clear any old sortable with same element
+    this.destroy(element);
+
+    // build options for the draggables
+    var options_for_draggable = {
+      revert:      true,
+      quiet:       options.quiet,
+      scroll:      options.scroll,
+      scrollSpeed: options.scrollSpeed,
+      scrollSensitivity: options.scrollSensitivity,
+      delay:       options.delay,
+      ghosting:    options.ghosting,
+      constraint:  options.constraint,
+      handle:      options.handle };
+
+    if(options.starteffect)
+      options_for_draggable.starteffect = options.starteffect;
+
+    if(options.reverteffect)
+      options_for_draggable.reverteffect = options.reverteffect;
+    else
+      if(options.ghosting) options_for_draggable.reverteffect = function(element) {
+        element.style.top  = 0;
+        element.style.left = 0;
+      };
+
+    if(options.endeffect)
+      options_for_draggable.endeffect = options.endeffect;
+
+    if(options.zindex)
+      options_for_draggable.zindex = options.zindex;
+
+    // build options for the droppables  
+    var options_for_droppable = {
+      overlap:     options.overlap,
+      containment: options.containment,
+      tree:        options.tree,
+      hoverclass:  options.hoverclass,
+      onHover:     Sortable.onHover
+    }
+    
+    var options_for_tree = {
+      onHover:      Sortable.onEmptyHover,
+      overlap:      options.overlap,
+      containment:  options.containment,
+      hoverclass:   options.hoverclass
+    }
+
+    // fix for gecko engine
+    Element.cleanWhitespace(element); 
+
+    options.draggables = [];
+    options.droppables = [];
+
+    // drop on empty handling
+    if(options.dropOnEmpty || options.tree) {
+      Droppables.add(element, options_for_tree);
+      options.droppables.push(element);
+    }
+
+    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
+      var handle = options.handles ? $(options.handles[i]) :
+        (options.handle ? $(e).select('.' + options.handle)[0] : e); 
+      options.draggables.push(
+        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
+      Droppables.add(e, options_for_droppable);
+      if(options.tree) e.treeNode = element;
+      options.droppables.push(e);      
+    });
+    
+    if(options.tree) {
+      (Sortable.findTreeElements(element, options) || []).each( function(e) {
+        Droppables.add(e, options_for_tree);
+        e.treeNode = element;
+        options.droppables.push(e);
+      });
+    }
+
+    // keep reference
+    this.sortables[element.id] = options;
+
+    // for onupdate
+    Draggables.addObserver(new SortableObserver(element, options.onUpdate));
+
+  },
+
+  // return all suitable-for-sortable elements in a guaranteed order
+  findElements: function(element, options) {
+    return Element.findChildren(
+      element, options.only, options.tree ? true : false, options.tag);
+  },
+  
+  findTreeElements: function(element, options) {
+    return Element.findChildren(
+      element, options.only, options.tree ? true : false, options.treeTag);
+  },
+
+  onHover: function(element, dropon, overlap) {
+    if(Element.isParent(dropon, element)) return;
+
+    if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
+      return;
+    } else if(overlap>0.5) {
+      Sortable.mark(dropon, 'before');
+      if(dropon.previousSibling != element) {
+        var oldParentNode = element.parentNode;
+        element.style.visibility = "hidden"; // fix gecko rendering
+        dropon.parentNode.insertBefore(element, dropon);
+        if(dropon.parentNode!=oldParentNode) 
+          Sortable.options(oldParentNode).onChange(element);
+        Sortable.options(dropon.parentNode).onChange(element);
+      }
+    } else {
+      Sortable.mark(dropon, 'after');
+      var nextElement = dropon.nextSibling || null;
+      if(nextElement != element) {
+        var oldParentNode = element.parentNode;
+        element.style.visibility = "hidden"; // fix gecko rendering
+        dropon.parentNode.insertBefore(element, nextElement);
+        if(dropon.parentNode!=oldParentNode) 
+          Sortable.options(oldParentNode).onChange(element);
+        Sortable.options(dropon.parentNode).onChange(element);
+      }
+    }
+  },
+  
+  onEmptyHover: function(element, dropon, overlap) {
+    var oldParentNode = element.parentNode;
+    var droponOptions = Sortable.options(dropon);
+        
+    if(!Element.isParent(dropon, element)) {
+      var index;
+      
+      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
+      var child = null;
+            
+      if(children) {
+        var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
+        
+        for (index = 0; index < children.length; index += 1) {
+          if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
+            offset -= Element.offsetSize (children[index], droponOptions.overlap);
+          } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
+            child = index + 1 < children.length ? children[index + 1] : null;
+            break;
+          } else {
+            child = children[index];
+            break;
+          }
+        }
+      }
+      
+      dropon.insertBefore(element, child);
+      
+      Sortable.options(oldParentNode).onChange(element);
+      droponOptions.onChange(element);
+    }
+  },
+
+  unmark: function() {
+    if(Sortable._marker) Sortable._marker.hide();
+  },
+
+  mark: function(dropon, position) {
+    // mark on ghosting only
+    var sortable = Sortable.options(dropon.parentNode);
+    if(sortable && !sortable.ghosting) return; 
+
+    if(!Sortable._marker) {
+      Sortable._marker = 
+        ($('dropmarker') || Element.extend(document.createElement('DIV'))).
+          hide().addClassName('dropmarker').setStyle({position:'absolute'});
+      document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
+    }    
+    var offsets = Position.cumulativeOffset(dropon);
+    Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
+    
+    if(position=='after')
+      if(sortable.overlap == 'horizontal') 
+        Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
+      else
+        Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
+    
+    Sortable._marker.show();
+  },
+  
+  _tree: function(element, options, parent) {
+    var children = Sortable.findElements(element, options) || [];
+  
+    for (var i = 0; i < children.length; ++i) {
+      var match = children[i].id.match(options.format);
+
+      if (!match) continue;
+      
+      var child = {
+        id: encodeURIComponent(match ? match[1] : null),
+        element: element,
+        parent: parent,
+        children: [],
+        position: parent.children.length,
+        container: $(children[i]).down(options.treeTag)
+      }
+      
+      /* Get the element containing the children and recurse over it */
+      if (child.container)
+        this._tree(child.container, options, child)
+      
+      parent.children.push (child);
+    }
+
+    return parent; 
+  },
+
+  tree: function(element) {
+    element = $(element);
+    var sortableOptions = this.options(element);
+    var options = Object.extend({
+      tag: sortableOptions.tag,
+      treeTag: sortableOptions.treeTag,
+      only: sortableOptions.only,
+      name: element.id,
+      format: sortableOptions.format
+    }, arguments[1] || { });
+    
+    var root = {
+      id: null,
+      parent: null,
+      children: [],
+      container: element,
+      position: 0
+    }
+    
+    return Sortable._tree(element, options, root);
+  },
+
+  /* Construct a [i] index for a particular node */
+  _constructIndex: function(node) {
+    var index = '';
+    do {
+      if (node.id) index = '[' + node.position + ']' + index;
+    } while ((node = node.parent) != null);
+    return index;
+  },
+
+  sequence: function(element) {
+    element = $(element);
+    var options = Object.extend(this.options(element), arguments[1] || { });
+    
+    return $(this.findElements(element, options) || []).map( function(item) {
+      return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
+    });
+  },
+
+  setSequence: function(element, new_sequence) {
+    element = $(element);
+    var options = Object.extend(this.options(element), arguments[2] || { });
+    
+    var nodeMap = { };
+    this.findElements(element, options).each( function(n) {
+        if (n.id.match(options.format))
+            nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
+        n.parentNode.removeChild(n);
+    });
+   
+    new_sequence.each(function(ident) {
+      var n = nodeMap[ident];
+      if (n) {
+        n[1].appendChild(n[0]);
+        delete nodeMap[ident];
+      }
+    });
+  },
+  
+  serialize: function(element) {
+    element = $(element);
+    var options = Object.extend(Sortable.options(element), arguments[1] || { });
+    var name = encodeURIComponent(
+      (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
+    
+    if (options.tree) {
+      return Sortable.tree(element, arguments[1]).children.map( function (item) {
+        return [name + Sortable._constructIndex(item) + "[id]=" + 
+                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
+      }).flatten().join('&');
+    } else {
+      return Sortable.sequence(element, arguments[1]).map( function(item) {
+        return name + "[]=" + encodeURIComponent(item);
+      }).join('&');
+    }
+  }
+}
+
+// Returns true if child is contained within element
+Element.isParent = function(child, element) {
+  if (!child.parentNode || child == element) return false;
+  if (child.parentNode == element) return true;
+  return Element.isParent(child.parentNode, element);
+}
+
+Element.findChildren = function(element, only, recursive, tagName) {   
+  if(!element.hasChildNodes()) return null;
+  tagName = tagName.toUpperCase();
+  if(only) only = [only].flatten();
+  var elements = [];
+  $A(element.childNodes).each( function(e) {
+    if(e.tagName && e.tagName.toUpperCase()==tagName &&
+      (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
+        elements.push(e);
+    if(recursive) {
+      var grandchildren = Element.findChildren(e, only, recursive, tagName);
+      if(grandchildren) elements.push(grandchildren);
+    }
+  });
+
+  return (elements.length>0 ? elements.flatten() : []);
+}
+
+Element.offsetSize = function (element, type) {
+  return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
+}


[16/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/flint-editor.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/flint-editor.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/flint-editor.js
deleted file mode 100644
index 2b7e3bb..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/flint-editor.js
+++ /dev/null
@@ -1,1923 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// Main flint editor class
-function FlintEditor(container, imagesPath, config) {
-
-    if (config.endpoints == null) {
-	alert("There must be at least one endpoint defined");
-	alert("There must be at least one endpoint defined");
-	return;
-    }
-    
-    var editor = new Flint(container, imagesPath, config);
-    this.getEditor = function() {return editor}
-
-    function Flint(container, imagesPath, config) {
-
-	var flint = this;
-	var editorId = "flint-editor";
-	var codeId = 'flint-code';
-	var initialQuery = "PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;\nPREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;\n\nSELECT * WHERE {?s ?p ?o}\nLIMIT 10"
-	var clearError = function() {};
-	var markerHandle = null;
-	var showResultsInSitu = true;
-	var cm;
-	this.windowClosing = false;
-		
-	// don't display dialogs when navigating away from page
-	$(window).bind('beforeunload', function(event) {    
-		editor.windowClosing = true;		
-	});		
-
-	this.allKeywords=
-	    [
-		"BASE", 
-		"PREFIX", 
-		"SELECT", 
-		"ASK", 
-		"CONSTRUCT", 
-		"DESCRIBE", 
-		"DISTINCT", 
-		"REDUCED", 
-		"FROM", 
-		"NAMED", 
-		"WHERE", 
-		"GRAPH", 
-		"UNION", 
-		"FILTER", 
-		"OPTIONAL", 
-		"ORDER", 
-		"LIMIT", 
-		"OFFSET", 
-		"BY", 
-		"ASC", 
-		"DESC",
-		"STR", 
-		"LANG", 
-		"LANGMATCHES", 
-		"DATATYPE", 
-		"BOUND", 
-		"SAMETERM", 
-		"ISIRI", 
-		"ISURI", 
-		"ISBLANK", 
-		"ISLITERAL", 
-		"REGEX"]
-
-	try {
-	    // Path to images directory
-	    this.getImagesPath = function() {return imagesPath};
-
-	    // Returns the version of the software
-	    this.getVersion = function() {return "0.5.1"};
-
-	    // Returns the title of the software
-	    this.getTitle = function() {return "Flint SPARQL Editor"};
-	    
-	    if ($.browser.msie) {
-		$('#' + container).append("<form id='" + editorId + "' action='" + config.endpoints[0].uri + "' method='post'></form>");
-	    }
-	    else {
-		$('#' + container).append("<div id='" + editorId + "'></div>");
-	    }
-	    
-	    $('#' + editorId).append("<h1 id='flint-title'>" + this.getTitle() + " " + this.getVersion() + "</h1>");		
-	    
-	    // Add menu
-	    if (config.interface.menu) {
-		var createMenu = new FlintMenu(flint);
-		createMenu.display(editorId);
-		this.getMenu = function() {return createMenu};	
-	    }
-
-	    // Add toolbar
-	    if (config.interface.toolbar) {
-		var createToolbar = new FlintToolbar(flint);
-		createToolbar.display(editorId);
-		this.getToolbar = function() {return createToolbar};	
-	    }
-
-	    // Add endpoint bar
-	    try {
-		var createEndpointBar = new FlintEndpointBar(config, flint);
-		createEndpointBar.display(editorId);
-		this.getEndpointBar = function() {return createEndpointBar};	
-
-		var endpointItem = createEndpointBar.getItems()[0];
-		var endpointGetInfoButton = createEndpointBar.getItems()[2];
-		var endpointMimeTypeItem = createEndpointBar.getItems()[3];
-		endpointMimeTypeItem.setDisableElements("SELECT");
-		
-		endpointGetInfoButton.setClickAction(
-		    function() {
-			try {
-			    var endpointUrl = endpointItem.getEndpoint();
-			    if (endpointItem.getItem(endpointUrl) == null) {
-				flint.getConfirmDialog().setCloseAction(
-				    function() {
-					if (flint.getConfirmDialog().getResult() == "Okay") {
-					    endpointItem.addItem();	
-					    if (!$.browser.msie) {
-						var epItem = endpointItem.getItem(endpointUrl);
-						createSidebar.updateProperties(epItem);
-						createSidebar.updateClasses(epItem);
-						createSidebar.updateSamples(epItem);
-					    }
-					}
-				    });
-				flint.getConfirmDialog().show("Flint Error", "<p>This operation may take a long time to perform if the dataset contains a large amount of results.</p><p>Do  you want to continue?</p>");
-			    }
-			}
-			catch (e) {"Get Dataset Info: "  + errorBox.show(e);}
-		    }
-		);
-	    }
-	    catch (e) {errorBox.show(e);}		
-
-	    // Add coolbar
-	    var createCoolbar = new FlintCoolbar(config, flint);
-	    createCoolbar.display(editorId);
-	    this.getCoolbar = function() {return createCoolbar};	
-
-	    // Add sidebar
-	    var createSidebar = new FlintSidebar(flint, config);
-	    createSidebar.display(editorId);
-	    createSidebar.showActiveTab();
-
-	    // Get a handle to the dataset item
-	    var datasetItems = createCoolbar.getItems()[0];
-	    datasetItems.setChangeAction(
-		function() {
-		    if ($.browser.msie) {
-			$('#' + editorId).attr('action', datasetItems.getEndpoint());
-		    }
-		    else {					
-			createSidebar.updateProperties(datasetItems.getItem(datasetItems.getEndpoint()));
-			createSidebar.updateClasses(datasetItems.getItem(datasetItems.getEndpoint()));
-			createSidebar.updateSamples(datasetItems.getItem(datasetItems.getEndpoint()));
-		    }
-		}
-	    );
-	    
-	    // Get a handle to the formats bar
-	    var datasetMimeTypeItem = createCoolbar.getItems()[2];
-	    datasetMimeTypeItem.setDisableElements("SELECT");
-
-	    // Add errorbox - this reuses the standard Flint dialog
-	    var errorBox = new FlintError(flint);
-	    this.getErrorBox = function() {return errorBox}
-
-	    // Add about box
-	    var aboutBox = new FlintAbout(flint);
-	    
-	    // Add confirmation dialog
-	    var confirmDialog = new FlintDialog();
-	    confirmDialog.display(editorId);
-	    this.getConfirmDialog = function() {return confirmDialog}
-
-	    // Add results area
-	    if (!$.browser.msie) {var resultsArea = new FlintResults(flint);}
-	    
-	    // Get a handle to the submit button
-	    var submitItemCoolbar = createCoolbar.getItems()[1];		
-	    var submitItemEndpointBar = createEndpointBar.getItems()[1];		
-	    
-	    // Physically set for now but we want this in the configuration so users can override and provide custom submissions
-	    this.sendDatasetQuery = function() {
-		try {
-		    if (!$.browser.msie) {
-			resultsArea.setResults("");
-			resultsArea.showLoading(true);
-		    }
-		    // Collect query parameters
-		    var paramsData = {};
-		    paramsData[config.defaultEndpointParameters.queryParameters.query] = cm.getValue();
-		    var mimeType = datasetMimeTypeItem.getMimeType();
-		    $.ajax({
-			url: datasetItems.getEndpoint(),
-			type: 'post',
-			data: paramsData,
-			headers: {"Accept": mimeType},
-			dataType: 'text',
-			error: function(XMLHttpRequest, textStatus, errorThrown) {
-			    if (XMLHttpRequest.status == 0) errorBox.show("The request was not sent. You may be offline");
-			    else errorBox.show("Dataset Request: HTTP Status: " + XMLHttpRequest.status + "; " + textStatus);
-			    resultsArea.showLoading(false);
-			},
-			success: function(data) {resultsArea.setResults(data,mimeType=="text/html");}
-		    });
-		}
-		catch (e) {errorBox.show(e);}
-	    }
-
-	    this.sendEndpointQuery = function() {
-		try {
-		    if (!$.browser.msie) {
-			resultsArea.setResults("");
-			resultsArea.showLoading(true);
-		    }
-		    // Collect query parameters
-		    var paramsData = {};
-		    paramsData[config.defaultEndpointParameters.queryParameters.query] = cm.getValue();
-		    var mimeType = endpointMimeTypeItem.getMimeType();
-		    $.ajax({
-			url: endpointItem.getEndpoint(),
-			type: 'post',
-			data: paramsData,
-			headers: {"Accept": mimeType},
-			dataType: 'text',
-			error: function(XMLHttpRequest, textStatus, errorThrown) {
-			    if (XMLHttpRequest.status == 0) errorBox.show("The request was not sent. You may be offline.");
-			    else errorBox.show("Endpoint Request: HTTP Status: " + XMLHttpRequest.status + "; " + textStatus);
-			    resultsArea.showLoading(false);
-			},
-			success: function(data) {resultsArea.setResults(data,mimeType=="text/html");}
-		    });
-		}
-		catch (e) {errorBox.show(e);}
-	    }
-		
-		this.sendIEDatasetQuery = function() {
-			$("#" + editorId).attr('action', datasetItems.getEndpoint());
-		}
-		
-		this.sendIEEndpointQuery = function() {
-			$("#" + editorId).attr('action', endpointItem.getEndpoint());
-		}
-	    
-	    if (!$.browser.msie) {
-		submitItemCoolbar.setSubmitAction(this.sendDatasetQuery);
-		submitItemEndpointBar.setSubmitAction(this.sendEndpointQuery);
-	    }
-		else {
-		submitItemCoolbar.setSubmitAction(this.sendIEDatasetQuery);
-		submitItemEndpointBar.setSubmitAction(this.sendIEEndpointQuery);
-		}
-
-	    
-	    //----------------------------------------------------------------
-	    // Autocompletion code, based on the example for javascript
-	    function autocompleteKeyEventHandler(i, e) {
-		// Hook into ctrl-space
-
-		if (e.keyCode == 32 &&  (e.ctrlKey || e.metaKey) && !e.altKey) {
-		    e.stop();
-		    return startComplete();
-		}}
-
-	    function stopEvent() {
-		if (this.preventDefault) 
-		{this.preventDefault(); this.stopPropagation();}
-		else 
-		{this.returnValue = false; this.cancelBubble = true;}
-	    }
-	    function addStop(event) {
-		if (!event.stop) event.stop = stopEvent;
-		return event;
-	    }
-	    function connect(node, type, handler) {
-		function wrapHandler(event) {handler(addStop(event || window.event));}
-		if (typeof node.addEventListener == "function")
-		    node.addEventListener(type, wrapHandler, false);
-		else
-		    node.attachEvent("on" + type, wrapHandler);
-	    }
-
-	    function forEach(arr, f) {
-		for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
-	    }
-
-	    function memberChk(el,arr) {
-		for (var i = 0, e = arr.length; i < e; ++i)
-		    if (arr[i]==el) return(true);
-		return false;
-	    }
-
-	    // Extract context info needed for autocompletion / keyword buttons
-	    // based on cursor position
-	    function getPossiblesAtCursor() {
-		// We want a single cursor position.
-		if (cm.somethingSelected()) return;
-		// Find the token at the cursor
-		var cur = cm.getCursor(false);
-		var cur1={ line: cur.line, ch: cur.ch };
-
-		// Before cursor
-		var charBefore= cm.getRange({line: cur.line, ch: cur.ch-1},
-					    {line: cur.line, ch: cur.ch  });
-
-		// Cursor position on the far left (ch=0) is problematic
-		// - if we ask CodeMirror for token at this position, we don't
-		// get back the token at the beginning of the line 
-		// - hence use adjusted position cur1 to recover this token.
-		if (cur1.ch==0 && cm.lineInfo(cur1.line).text.length>0)
-		    cur1.ch=1;
-		var token = cm.getTokenAt(cur1);
-		var charAfter;
-		var possibles, insertPos=null;
-
-		var start= token.string.toLowerCase();
-		var insertPos=null;
-		var insertEnd=false;
-		var insertStart=false;
-
-		// if the token is whitespace, use empty string for matching
-		//  and set insertPos, so that selection will be inserted into
-		//  into space, rather than replacing it.
-		if (token.className=="sp-ws") {
-		    start="";
-		    // charAfter is char after cursor
-		    charAfter= cm.getRange({line: cur.line, ch: cur.ch },
-					   {line: cur.line, ch: cur.ch+1 });
-		    insertPos= cur;
-		} else {
-		    // charAfter is char after end of token
-		    charAfter= cm.getRange({line: cur.line, ch: token.end },
-					   {line: cur.line, ch: token.end+1 });
-		    if (token.className!="sp-invalid" && 
-			token.className!="sp-prefixed" &&
-			(token.string!="<" || !memberChk("IRI_REF",token.state.possibleCurrent))
-			// OK when "<" is start of URI
-		       ) {
-			if (token.end==cur.ch && token.end!=0) {
-			    insertEnd=true;
-			    start="";
-			    insertPos=cur;
-			} else if (token.start==cur.ch) {
-			    insertStart=true;
-			    start="";
-			    insertPos=cur;
-			}
-		    }
-		}
-
-		if (token.className=="sp-comment")
-		    possibles=[];
-		else if (cur1.ch > 0 && !insertEnd) {
-		    possibles= token.state.possibleCurrent;
- 		} else {
-		    possibles= token.state.possibleNext;
-		}
-
-		return {"token": token,              // codemirror token object
-			"possibles": possibles,      // array of possibles terminals from grammar
-			"insertPos": insertPos,      // Position in line to insert text, or null if replacing existing text
-			"insertStart": insertStart,  // true if position of insert adjacent to start of a non-ws token
-			"insertEnd": insertEnd,      // true if ...                        ... end of a ...
-			"charAfter": charAfter,      // char found straight after cursor 
-			"cur": cur,                  // codemirror {line,ch} object giving pos of cursor
-			"start": start               // Start of token for autocompletion
-		       }
-	    }
-
-	    function startComplete() {
-
-		// We want a single cursor position.
-		if (cm.somethingSelected()) return;
-
-		var tkposs= getPossiblesAtCursor();
-		var stack=tkposs.token.state.stack;
-		
-		var completions= getCompletions(tkposs.token, tkposs.start, tkposs.possibles);
-		
-		if (!completions.length) return;
-
-		// When there is only one completion, use it directly.
-		if (completions.length == 1) {flint.insertOrReplace(completions[0],tkposs); return true;}
-
-		// Build the select widget
-		var complete = document.createElement("div");
-		complete.className = "completions";
-		var sel = complete.appendChild(document.createElement("select"));
-		sel.multiple = true;
-		for (var i = 0; i < completions.length; ++i) {
-		    var opt = sel.appendChild(document.createElement("option"));
-		    opt.appendChild(document.createTextNode(completions[i]));
-		}
-		sel.firstChild.selected = true;
-		sel.size = Math.min(10, completions.length);
-		var pos = cm.cursorCoords();
-
-		complete.style.position= "absolute";
-		complete.style.left = pos.x + "px";
-		complete.style.top = pos.yBot + "px";
-
-		document.body.appendChild(complete);
-
-		// Hack to hide the scrollbar.
-		if (completions.length <= 10)
-		    complete.style.width = (sel.clientWidth - 1) + "px";
-		
-		var done = false;
-		function close() {
-		    if (done) return;
-		    done = true;
-		    complete.parentNode.removeChild(complete);
-		}
-		function pick() {
-		    flint.insertOrReplace(sel.options[sel.selectedIndex].value,tkposs);
-		    close();
-		    setTimeout(function(){cm.focus();}, 50);
-		}
-		connect(sel, "blur", close);
-		connect(sel, "keydown", function(event) {
-		    var code = event.keyCode;
-		    // Enter and space
-		    if (code == 13 || code == 32) {event.stop(); pick();}
-		    // Escape
-		    else if (code == 27) {event.stop(); close(); cm.focus();}
-		    else if (code != 38 && code != 40) {close(); cm.focus(); setTimeout(startComplete, 50);}
-		});
-		connect(sel, "dblclick", pick);
-		
-		sel.focus();
-		// Opera sometimes ignores focusing a freshly created node
-		if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
-		return true;
-	    }
-	    
-	    var allKeywords = this.allKeywords;
-
-	    // FIXME: This is duplicated from elsewhere, and it shouldn't be!
-	    var keywords= /^(BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|STR|LANG|LANGMATCHES|DATATYPE|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE)$/i;
-	    // Punctuation omits "a" and "<"
-	    // - because we might want to autocomplete a URI
-	    var punct= /^(\*|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|>|\+|-|\/|\^\^)$/
-
-	    function getCompletions(token,start,possibles) {
-		var found = [];
-		// test the case of the 1st non-space char
-		var startIsLowerCase= /^ *[a-z]/.test(token.string); 
-		
-		// Where case is flexible
-		function maybeAdd(str) {
-		    if (str.toUpperCase().indexOf(start.toUpperCase()) == 0) {
-			if (startIsLowerCase)
-			    found.push(str.toLowerCase());
-			else
-			    found.push(str.toUpperCase());
-		    }
-		}
-
-		// Where case is not flexible
-		function maybeAddCS(str) {
-		    if (str.toUpperCase().indexOf(start.toUpperCase())==0)
-			found.push(str);
-		}
-
-		function gatherCompletions() {
-		    for (var i=0; i<possibles.length; ++i)
-		    {
-			if (possibles[i]=="VAR1")
-			    maybeAddCS("?");
-			else if (keywords.exec(possibles[i]))
-			{
-			    //  keywords - the strings stand for themselves
-			    maybeAdd(possibles[i]);
-			}
-			else if (punct.exec(possibles[i]))
-			{
-			    //  punctuation - the strings stand for themselves
-			    maybeAddCS(possibles[i]);
-			}
-			else if (possibles[i]=="STRING_LITERAL1") {
-			    maybeAddCS('"');
-			    maybeAddCS("'");
-			}
-			else if (possibles[i]=="IRI_REF" && !/^</.test(start)) {
-			    maybeAddCS("<");
-			}
-			else if (possibles[i]=="BLANK_NODE_LABEL") {
-			    maybeAddCS("_:");
-			}
-			else if (possibles[i]=="a") {
-			    // Property expected at cursor position - fetch possibilities
-			    maybeAddCS("a");
-			    if (/:/.test(start)) { 
-				// Prefix has been entered - give matching prefixed properties
-				var activeDataItem= createSidebar.getActiveDataItem();
-				if (activeDataItem) {
-				    for (var k = 0; k < activeDataItem.prefixes.length; k++) {
-					//maybeAddCS(activeDataItem.prefixes[i].prefix+":");
-					var ns= activeDataItem.prefixes[k].uri;
-					for (var j = 0; j < activeDataItem.properties.results.bindings.length; j++) {
-					    var fragments= 
-						activeDataItem.properties.results.bindings[j].p.value
-						.match(/(^\S*[#\/])([^#\/]*$)/);
-					    if (fragments.length==3 && fragments[1]==ns)
-						maybeAddCS(activeDataItem.prefixes[k].prefix+":"+fragments[2]);
-					}
-				    }
-				}
-			    }
-
-			    if (/^</.test(start)) { 
-//			    if (true) { 
-				// Looks like a URI - add property URIs
-				var activeDataItem= createSidebar.getActiveDataItem();
-				if (activeDataItem) {
-				    for (var j = 0; 
-					 j < activeDataItem.properties.results.bindings.length; 
-					 j++) 
-					maybeAddCS("<"+activeDataItem.properties.results.bindings[j].p.value+">");
-				}
-			    }
-			}
-			else if (possibles[i]=="PNAME_LN" && !/:$/.test(start)) {
-			    // prefixed names - offer prefixes
-			    var activeDataItem= createSidebar.getActiveDataItem();
-			    if (activeDataItem && activeDataItem.prefixes.length) {
-			 	for (var j = 0; j < activeDataItem.prefixes.length; j++) {
-			 	    maybeAddCS(activeDataItem.prefixes[j].prefix+":");
-			 	}
-			    }
-			}    
-		    }
-		}
-
-		gatherCompletions();
-		return found;
-	    }
-	    // End of autocompletion code
-
-	    var cmUpdate = function() {
-		if (cm != undefined) {
-		    var queryValid=true;
-		    if (clearError!=null) { clearError(); clearError=null };
-		    if (markerHandle != null) cm.clearMarker(markerHandle);
-		    var state;
-		    for (var l=0; l<cm.lineCount(); ++l) {
-			state= cm.getTokenAt({line:l, ch: cm.getLine(l).length}).state;
-			if (state.OK==false) {
-			    markerHandle= 
-				cm.setMarker(l, 
-					     "<span style=\"color: #f00 ; font-size: large;\">&rarr;</span> %N%");
-			    clearError = cm.markText(
-				{line:l, ch:state.errorStartPos},
-				{line:l, ch:state.errorEndPos}, 
-				"sp-error");
-			    queryValid=false;
-			    break;
-			}
-		    }
-		    var stack=state.stack, len=state.stack.length;
-		    // Because incremental parser doesn't receive end-of-input
-		    // it can't clear stack, so we have to check that whatever
-		    // is left on the stack is nillable
-		    if (len>1) queryValid=false;
-		    else if (len==1) {
-			if (stack[0]!="solutionModifier" &&
-			    stack[0]!="?limitOffsetClauses" &&
-			    stack[0]!="?offsetClause")
-			    queryValid=false;
-		    }
-
-		    if (queryValid) {
-			submitItemCoolbar.enable();
-			submitItemEndpointBar.enable();
-			datasetMimeTypeItem.setDisableElements(state.queryType);
-			endpointMimeTypeItem.setDisableElements(state.queryType);
-			statusArea.setQueryValid(true);
-			statusArea.updateStatus();
-		    } else {
-			submitItemCoolbar.disable();
-			submitItemEndpointBar.disable();
-			datasetMimeTypeItem.setDisableElements(state.queryType);	
-			endpointMimeTypeItem.setDisableElements(state.queryType);
-			statusArea.setQueryValid(false);
-			statusArea.updateStatus();
-		    }		    
-		}
-	    }
-
-	    // Enable/disable the keyword buttons depending on the possibilities at cursor position
-	    var updateKeywordTable= function() { 
-
-		var tkposs = getPossiblesAtCursor();
-		if (tkposs!=undefined) 
-		{
-		    function getButtonFn(str,tkposs)
-		    { return function(e) {
-			flint.insertOrReplace(str,tkposs);
-			cm.focus();
-			e.stopPropagation(); }
-		    };
-		    var token = tkposs.token;
-		    var possibles = tkposs.possibles;
-		    for( var i=0; i<flint.allKeywords.length; ++i) {
-			var enabled=false;
-			var keyword= flint.allKeywords[i];
-			for( var j=0; j<possibles.length && !enabled; ++j) {
-			    if (keyword==possibles[j])
-				enabled=true;
-			}
-			var button= $('#flint-keyword-'+keyword+'-button');
-			if (enabled) {
-			    button.attr("disabled",false);
-			    button.unbind("click");
-			    button.click(getButtonFn(keyword,tkposs));
-			} else {
-			    button.attr("disabled",true);
-			}
-		    }
-		}
-	    }
-
-	    var cmCursor = function() { 
-		updateKeywordTable();
-		if (cm != undefined) {
-		    // Activate cut?
-		    if (cm.somethingSelected() != "") {
-			createToolbar.setEnabled("Cut", true);
-			createMenu.setEnabled("Cut", true);
-		    }
-		    else {
-			createToolbar.setEnabled("Cut", false);
-			createMenu.setEnabled("Cut", false);
-		    }
-		    if (cm.historySize().undo > 0) {
-			createToolbar.setEnabled("Undo", true);
-			createMenu.setEnabled("Undo", true)					
-		    }
-		    else {
-			createToolbar.setEnabled("Undo", false);
-			createMenu.setEnabled("Undo", false);
-		    }
-		    if (cm.historySize().redo > 0) {
-			createToolbar.setEnabled("Redo", true);
-			createMenu.setEnabled("Redo", true);
-		    }
-		    else {
-			createToolbar.setEnabled("Redo", false);				
-			createMenu.setEnabled("Redo", false);				
-		    }
-		    
-		    statusArea.setLine(cm.getCursor().line);
-		    statusArea.setPosition(cm.getCursor().ch);
-		    statusArea.updateStatus();
-		}
-	    }
-
-	    // Add actual code editing area
-	    $('#' + editorId).append("<textarea id='" + codeId + "' name='query' cols='100' rows='1'>" + initialQuery + "</textarea>");		
-	    var cm =CodeMirror.fromTextArea(document.getElementById("flint-code"), {
-		mode: "sparql",		    
-		//	    workDelay: 50,
-		//	    workTime: 100,
-		lineNumbers: true,
-		indentUnit: 3,
-		tabMode: "indent",
-		matchBrackets: true,
-		//	    onChange: cmUpdate,
-		onHighlightComplete: cmUpdate,
-		onCursorActivity: cmCursor,
-		onKeyEvent: autocompleteKeyEventHandler
-	    });	
-
-	    this.getCodeEditor = function() {return cm};
-
-	    // Add status area
-	    var statusArea = new FlintStatus();
-	    statusArea.display(editorId);
-	    statusArea.updateStatus();
-	    
-	    // Clear the editor area
-	    this.clearEditorTextArea = function() {
-		if (cm.getValue() != "") {
-		    confirmDialog.setCloseAction(function() {
-			var result = confirmDialog.getResult();
-			if (result == "Okay") cm.setValue("");
-		    });
-		    confirmDialog.show("New Query", "<p>Are you sure you want to abandon the current text?</p>");
-		}			
-	    }
-	    
-	    this.undo = function() {cm.undo();}
-
-	    this.redo = function() {cm.redo();}
-
-	    this.cut = function() {
-		cm.replaceSelection("");
-		cm.focus();
-	    }
-	    
-	    this.insert = function(text) {
-		cm.replaceSelection(text);
-		cm.focus();
-	    }
-
-	    this.insertOrReplace= function(str,tkposs) {
-		if ((tkposs.insertStart || tkposs.charAfter!=" ") && /^[A-Za-z\*]*$/.exec(str) ) str=str+" ";
-		if (tkposs.insertEnd) str=" "+str;
-		if (tkposs.insertPos) {
-		    // Insert between spaces
-		    cm.replaceRange(str,tkposs.insertPos);
-		} else {
-		    // Replace existing token
-		    cm.replaceRange(
-			str, 
-			{line: tkposs.cur.line, ch: tkposs.token.start}, 
-			{line: tkposs.cur.line, ch: tkposs.token.end});
-		}
-	    }
-	    
-	    this.toggleTools = function() {$('#flint-sidebar-grabber').click();}
-	    
-	    this.showEndpointBar = function() {
-		createCoolbar.hide();		
-		createEndpointBar.show();
-		createToolbar.setEnabled("Show Endpoints", false);
-		createToolbar.setEnabled("Show Datasets", true);
-		createMenu.setEnabled("Show Endpoints", false);
-		createMenu.setEnabled("Show Datasets", true);
-		createSidebar.clearActiveItem();
-		createSidebar.showActiveTab();
-	    }
-
-	    this.showDataSetsBar = function() {
-		createCoolbar.show();
-		createEndpointBar.hide();
-		createToolbar.setEnabled("Show Endpoints", true);
-		createToolbar.setEnabled("Show Datasets", false);
-		createMenu.setEnabled("Show Endpoints", true);
-		createMenu.setEnabled("Show Datasets", false);
-		createSidebar.updateProperties(datasetItems.getItem(datasetItems.getEndpoint()));
-		createSidebar.updateClasses(datasetItems.getItem(datasetItems.getEndpoint()));
-		createSidebar.updateSamples(datasetItems.getItem(datasetItems.getEndpoint()));				
-	    }
-	    
-	    this.insertSelectQuery = function() {
-		if (cm.getValue() != "") {
-		    confirmDialog.setCloseAction(function() {
-			var result = confirmDialog.getResult();
-			if (result == "Okay") cm.setValue(createSidebar.getPrefixes()  + "\nSELECT * WHERE {?s ?p ?o}\nLIMIT 10");
-		    });
-		    confirmDialog.show("New Select Query", "<p>Are you sure you want to abandon the current text?</p>");
-		}		
-		else cm.setValue(createSidebar.getPrefixes()  + "\nSELECT * WHERE {?s ?p ?o}\nLIMIT 10");
-	    }
-	    
-	    this.insertConstructQuery = function() {
-		if (cm.getValue() != "") {
-		    confirmDialog.setCloseAction(function() {
-			var result = confirmDialog.getResult();
-			if (result == "Okay") cm.setValue(createSidebar.getPrefixes()  + "\nCONSTRUCT {?s ?p ?o} WHERE {?s ?p ?o}\nLIMIT 10");
-		    });
-		    confirmDialog.show("New Construct Query", "<p>Are you sure you want to abandon the current text?</p>");
-		}
-		else cm.setValue(createSidebar.getPrefixes()  + "\nCONSTRUCT {?s ?p ?o} WHERE {?s ?p ?o}\nLIMIT 10");
-	    }
-	    
-	    this.showAbout = function() {
-		aboutBox.show();
-	    }
-	    
-	    if (!$.browser.msie) {
-		resultsArea.display(editorId);
-		try {
-		    createSidebar.updateProperties(datasetItems.getItem(datasetItems.getEndpoint()));
-		    createSidebar.updateClasses(datasetItems.getItem(datasetItems.getEndpoint()));
-		    createSidebar.updateSamples(datasetItems.getItem(datasetItems.getEndpoint()));				
-		}
-		catch (e) {errorBox.show(e);}
-	    }
-	}
-	catch (e) {alert(e);}
-    }
-
-    function FlintError(editor) {
-	
-	this.show = function(message) {
-			try {
-			
-			editor.getConfirmDialog().setCloseAction();
-			editor.getConfirmDialog().show("Flint Error", "<p>" + message.toString() + "</p>", true);
-			}
-			catch (e) {alert(e);}
-		
-	}
-    }
-
-    function FlintAbout(editor) {
-	
-	this.show = function() {
-	    var aboutText = "<p>" + editor.getTitle() + ", version " + editor.getVersion() + "</p>"
-		+ "<p>Flint is based on Marijn Haverbeke's <a href='http://codemirror.net/'>CodeMirror 2</a>.</p>"
-		+ "<p>Flint has been developed by a team at <a href='http://www.tso.co.uk'>TSO</a>.</p>";
-	    editor.getConfirmDialog().setCloseAction();
-	    editor.getConfirmDialog().show("About Flint", aboutText, true);
-	}
-    }
-
-
-    function FlintDialog() {
-
-	var button = "";
-	var closeAction = {};
-	
-	this.show = function(title, text, closeOnly) {
-		
-		if (!editor.windowClosing) {
-			$('#flint-dialog-title-text').text(title);
-			$('#flint-dialog-text').html(text);
-			if (closeOnly) {
-			$('#flint-dialog-okay-button').css('visibility', 'hidden');
-			}
-			else {
-			$('#flint-dialog-okay-button').css('visibility', 'visible');
-			}
-			$('.flint-dialog-body').css('margin-top', ($('#flint-editor').position().top + 200) + "px");
-			$('#flint-dialog').css('visibility', 'visible');
-		}
-	}
-	
-	this.getResult = function() {
-	    return button;
-	}
-	
-	this.setCloseAction = function(callback) {
-	    if (callback != null) {
-	    	closeAction = callback;
-	    }
-	    else {
-	    	closeAction = function() {}
-	    }
-	};
-	
-	this.display = function(container) {
-	    var aboutText = "<div id='flint-dialog'' class='flint-dialog'><div class='flint-dialog-body'><div class='flint-dialog-body-container'><h2 id='flint-dialog-title'><span id='flint-dialog-close' class='flint-close'></span><span id='flint-dialog-title-text'>Title goes here</span></h2>"
-		+ "<div id='flint-dialog-text'></div>"
-		+ "<div id='flint-dialog-buttons'><span id='flint-dialog-close-button' class='flint-close-button''>Close</span><span id='flint-dialog-okay-button' class='flint-okay-button'>Okay</span></div>"
-		+ "</div></div></div>";
-	    $('#' + container).append(aboutText);
-	    
-	    $('#flint-dialog-close').click(function() {
-		$('#flint-dialog-okay-button').css('visibility', 'hidden');
-		$('#flint-dialog').css('visibility', 'hidden');
-		button = "Close";
-		closeAction();
-	    });
-	    $('#flint-dialog-okay-button').click(function() {
-		try {
-		    $('#flint-dialog-okay-button').css('visibility', 'hidden');
-		    $('#flint-dialog').css('visibility', 'hidden');
-		    button = "Okay";
-		    closeAction();
-		}
-		catch (e) {editor.getErrorBox().show(e);}
-	    });
-	    $('#flint-dialog-close-button').click(function() {
-		$('#flint-dialog-okay-button').css('visibility', 'hidden');
-		$('#flint-dialog').css('visibility', 'hidden');
-		button = "Close";
-		closeAction();
-	    });
-	}
-    }
-
-
-    function FlintStatus() {
-	
-	var line = 0;
-	var position = 0;
-	var queryValid= "valid";
-	
-	this.setLine = function(cursorLine) {line = cursorLine;}
-	
-	this.setQueryValid = function(valid) {
-	    valid ? queryValid = "valid" : queryValid = "invalid";
-	}
-
-	this.setPosition = function(cursorPosition) {position = cursorPosition;}
-	
-	this.display = function(container) {$('#' + container).append("<div id='flint-status'>...</div>");}
-	
-	this.updateStatus = function() {
-	    $('#flint-status').text("Line: " + (line+1) + "; Position: " + (position+1) + "; Query is " + queryValid);
-	}
-    }
-
-    function FlintResults(editor) {
-	
-	var results = "";
-
-    <!-- BEGIN LMF -->
-    this.popup = function(content) {
-        var params  = 'width='+screen.width;
-        params += ', height='+screen.height;
-        params += ', top=0, left=0';
-        params += ', fullscreen=yes,toolbar=yes,scrollbars=yes,resizable=yes';
-
-        var newwin=window.open('','_newtab');
-        newwin.document.write(content);
-        if (window.focus) {
-            newwin.focus()
-        }
-    }
-    <!-- END LMF -->
-
-    <!-- the html parameter is added to the method -->
-	this.setResults = function(text,html) {
-	    results = text;
-	    if (jQuery.isXMLDoc(results)) {
-		if (!window.XMLSerializer )  {results = results.xml;}
-		else {
-		    var serializer = new XMLSerializer();
-		    results = serializer.serializeToString(results);			
-		}
-	    }
-	    this.showLoading(false);
-
-        if(html){
-            this.popup(results);
-            return;
-        }
-
-	    try {$('#flint-results').val(results);}
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-	
-	this.getResults = function() {return results;}
-	
-	this.showLoading = function(showLoader) {
-	    if (showLoader) {
-		$('#flint-results-loader').show();
-		$('#flint-results').hide();
-	    }
-	    else {
-		$('#flint-results-loader').hide();
-		$('#flint-results').show();
-	    }
-	}
-	
-	this.display = function(container) {
-	    $('#' + container).append("<h2 id='flint-results-heading'>Query Results</h2>");
-	    $('#' + container).append("<div id='flint-results-area';><p id='flint-results-loader'><img src='" + editor.getImagesPath()  + "/ajax-loader-red.gif'/> Running query ... please wait</p><textarea id='flint-results' cols='100' rows='10'></textarea></div>");
-	}
-    }
-
-    function FlintMenu(editor) {
-
-	try {
-	    var newMenuItems = new Array();
-	    newMenuItems.push(new FlintMenuItem("EmptyQuery", "Empty Query", "New_16x16.png", true, function() {editor.clearEditorTextArea();}));		
-	    newMenuItems.push(new FlintMenuItem("SelectQuery", "Select", "Properties_16x16.png", true, function() {editor.insertSelectQuery();}));
-	    newMenuItems.push(new FlintMenuItem("ConstructQuery", "Construct", "Key_16x16.png", true, function() {editor.insertConstructQuery();}));
-
-	    var editMenuItems = new Array();
-	    editMenuItems.push(new FlintMenuItem("Undo", "Undo", "Undo_16x16.png", false, function() {editor.undo();}));
-	    editMenuItems.push(new FlintMenuItem("Redo", "Redo", "Redo_16x16.png", false, function() {editor.redo();}));
-	    editMenuItems.push(new FlintMenuItem("Cut", "Cut", "Cut_16x16.png", false, function() {editor.cut();}));
-
-	    var viewMenuItems = new Array();
-	    viewMenuItems.push(new FlintMenuItem("Show Tools", "Show Tools Pane", "Prev_16x16.png", true, function() {editor.toggleTools();}));
-	    viewMenuItems.push(new FlintMenuItem("Hide Tools", "Hide Tools Pane", "Next_16x16.png", false, function() {editor.toggleTools();}));
-	    viewMenuItems.push(new FlintMenuItem("Show Endpoints", "Show Endpoints Bar", "Globe_16x16.png", true, function() {editor.showEndpointBar();}));
-	    viewMenuItems.push(new FlintMenuItem("Show Datasets", "Show Datasets Bar", "Favorites_16x16.png", false, function() {editor.showDataSetsBar();}));
-
-	    var helpMenuItems = new Array();
-	    helpMenuItems.push(new FlintMenuItem("About", "About", "Information_16x16.png", true, function() {editor.showAbout();}));
-
-	    var menuItems = new Array();
-	    
-	    var newMenuItem = new FlintMenuItem("New", "New", true);
-	    newMenuItem.setSubMenu(newMenuItems);
-	    menuItems.push(newMenuItem);
-
-	    var editMenuItem = new FlintMenuItem("Edit", "Edit", true);
-	    editMenuItem.setSubMenu(editMenuItems);
-	    menuItems.push(editMenuItem);
-
-	    var viewMenuItem = new FlintMenuItem("View", "View", true);
-	    viewMenuItem.setSubMenu(viewMenuItems);
-	    menuItems.push(viewMenuItem);
-
-	    var helpMenuItem = new FlintMenuItem("Help", "Help", true);
-	    helpMenuItem.setSubMenu(helpMenuItems);
-	    menuItems.push(helpMenuItem);
-
-	    this.getItems = function() {return menuItems};
-	}
-	catch (e) {editor.getErrorBox().show(e);}
-
-	this.setEnabled = function(id, enabled) {
-	    for (var i = 0; i < menuItems.length; i++) {
-		if (menuItems[i].getSubMenu() != null) {
-		    for (var j = 0; j < menuItems[i].getSubMenu().length; j++) {
-			if (menuItems[i].getSubMenu()[j].getId() == id) {
-			    menuItems[i].getSubMenu()[j].setEnabled(enabled);
-			    if (enabled) $("#flint-submenu-item-" + i + "-" + j).attr("class", "flint-menu-enabled")
-			    else $("#flint-submenu-item-" + i + "-" + j).attr("class", "flint-menu-disabled");
-			    break;
-			}
-		    }				
-		}
-	    }
-	}
-
-	this.display = function(container) {
-	    var listItems = "";
-	    for (var i = 0; i < menuItems.length; i++) {
-		listItems += "<li class='flint-menu-item' id='flint-menu-" + i + "'><span>";
-		listItems += menuItems[i].getLabel();
-		listItems += "</span>"
-		if (menuItems[i].getSubMenu() != null) {
-		    var subList = "";
-		    for (var j = 0; j < menuItems[i].getSubMenu().length; j++) {
-			subList += "<li class='";
-			menuItems[i].getSubMenu()[j].getEnabled() ? subList += "flint-menu-enabled" : subList += "flint-menu-disabled";
-			subList += "' id='flint-submenu-item-" + i + "-" + j + "'><span>";
-			if (menuItems[i].getSubMenu()[j].getIcon() != "") {
-			    subList += "<img src='"+editor.getImagesPath()+"/"+ menuItems[i].getSubMenu()[j].getIcon() + "'/>";
-			}
-			else {
-			    subList += "<span class='flint-menu-filler'></span>";
-			}
-			subList += menuItems[i].getSubMenu()[j].getLabel();
-			subList += "</span></li>";
-		    }				
-		    listItems += "<ul class='flint-submenu' id='flint-submenu-" + i + "'>" + subList + "</ul>";
-		}
-		listItems += "</li>";
-	    }
-	    $('#' + container).append("<ul id='flint-menu'>" + listItems + "</ul>");
-
-	    // Now add events
-	    for (var i = 0; i < menuItems.length; i++) {
-		if (menuItems[i].getSubMenu() != null) {
-		    for (var j = 0; j < menuItems[i].getSubMenu().length; j++) {
-			$("#flint-submenu-item-" + i + "-" + j).click(menuItems[i].getSubMenu()[j].getCallback());
-		    }				
-		}
-	    }
-	}
-    }
-
-    function FlintMenuItem(itemId, itemLabel, itemIcon, itemEnabled, itemCallback) {
-
-	var id = itemId;
-	var subMenu = null;
-	var icon = itemIcon;
-	var callback = itemCallback;
-	var enabled = itemEnabled;
-	
-	this.getId = function() {return id};
-	this.getIcon = function() {return icon};
-	this.getLabel = function() {return itemLabel};
-	this.setSubMenu = function(menu) {subMenu = menu;}
-	this.getSubMenu = function() {return subMenu;}
-	this.getCallback = function() {return callback};
-	this.setEnabled = function(value) {enabled = value};
-	this.getEnabled = function() {return enabled};
-    }
-
-    function FlintToolbar(editor) {
-
-	try {
-	    var toolbarItems = new Array();
-	    toolbarItems.push(new FlintToolbarItem("New", "New empty query", "New_24x24.png", true, function() {editor.clearEditorTextArea()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Select", "New select query", "Properties_24x24.png", true, function() {editor.insertSelectQuery()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Construct", "New construct query", "Key_24x24.png", true, function() {editor.insertConstructQuery()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Undo", "Undo last edit", "Undo_24x24.png", false, function() {editor.undo()}, true));
-	    toolbarItems.push(new FlintToolbarItem("Redo", "Redo last edit", "Redo_24x24.png", false, function() {editor.redo()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Cut", "Cut selected text", "Cut_24x24.png", false, function() {editor.cut()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Show Tools", "Show tools pane", "Prev_24x24.png", true, function() {editor.toggleTools()}, true));
-	    toolbarItems.push(new FlintToolbarItem("Hide Tools", "Hide tools pane", "Next_24x24.png", false, function() {editor.toggleTools()}, false));
-	    toolbarItems.push(new FlintToolbarItem("Show Endpoints", "Show endpoints bar", "Globe_24x24.png", true, function() {editor.showEndpointBar()}, true));
-	    toolbarItems.push(new FlintToolbarItem("Show Datasets", "Show datasets bar", "Favorites_24x24.png", false, function() {editor.showDataSetsBar()}, false));
-	    // toolbarItems.push(new FlintToolbarItem("FR", "Find/Replace", "Find_24x24.png", true, function() {editor.cut()}));
-	    this.getItems = function() {return toolbarItems};
-	}
-	catch (e) {editor.getErrorBox().show(e);}
-	
-	// This is probably a bit inefficient. Need to find a better way
-	this.setEnabled = function(id, enabled) {
-	    for (var i = 0; i < toolbarItems.length; i ++) {
-		if (toolbarItems[i].getId() == id) {
-		    toolbarItems[i].setEnabled(enabled);
-		    var itemClass = "";
-		    if (enabled) itemClass = "flint-toolbar-enabled";
-		    else itemClass = "flint-toolbar-disabled";
-		    if (toolbarItems[i].getStartGroup()) itemClass += " flint-toolbar-start";
-		    $("#flint-toolbar-" + i).attr("class", itemClass);
-		    break;
-		}
-	    }		
-	}
-
-	this.display = function(container) {
-	    var listItems = "";
-	    for (var i = 0; i < toolbarItems.length; i++) {
-		listItems += "<li id='flint-toolbar-" + i + "' class='";
-		toolbarItems[i].getEnabled() ? listItems += "flint-toolbar-enabled" : listItems += "flint-toolbar-disabled";
-		if (toolbarItems[i].getStartGroup()) listItems += " flint-toolbar-start";
-		listItems += "'><img src='"+editor.getImagesPath()+"/"+toolbarItems[i].getIcon() + "' title='" + toolbarItems[i].getLabel() + "' alt='" + toolbarItems[i].getLabel() + "'/></li>";
-	    }
-	    $('#' + container).append("<ul id='flint-toolbar'>" + listItems + "</ul>");
-	    for (var i = 0; i < toolbarItems.length; i++) {
-		$("#flint-toolbar-" + i).click(toolbarItems[i].getCallback());
-	    }
-	}
-    }
-
-    function FlintToolbarItem(itemId, itemLabel, itemIcon, itemEnabled, itemCallback, itemStartGroup) {
-
-	var id = itemId;
-	var label = itemLabel;
-	var icon = itemIcon;
-	var callback = itemCallback;
-	var enabled = itemEnabled;
-	var startGroup = itemStartGroup;
-
-	this.getId = function() {return id};
-	this.getLabel = function() {return label};
-	this.getIcon = function() {return icon};
-	this.getCallback = function() {return callback};
-	this.setEnabled = function(value) {enabled = value};
-	this.getEnabled = function() {return enabled};
-	this.getStartGroup = function() {return startGroup};
-    }
-
-
-    function FlintEndpointBar(config, editor) {
-
-	try {
-	    var barItems = new Array();
-	    barItems.push(new FlintEndpointEntry(config, editor));	
-	    barItems.push(new FlintEndpointQuerySubmitButton(editor));	
-	    barItems.push(new FlintEndpointDataInfoButton(editor));	
-	    barItems.push(new FlintEndpointMimeTypePicker(config, editor));	
-	    this.getItems = function() {return barItems};
-	}
-	catch (e) {editor.getErrorBox().show(e);}
-
-	this.hide = function() {
-	    $('#flint-endpoint-bar').hide();
-		
-		// disable form elements
-		barItems[3].setDisableElements("HIDE");
-	}
-
-	this.show = function() {
-	    $('#flint-endpoint-bar').show();
-		
-		// disable form elements
-		barItems[3].setDisableElements("SHOW");
-	}
-
-	this.display = function(container) {
-	    var listItems = "";
-	    $('#' + container).append("<div id='flint-endpoint-bar'></div>");
-	    for (var i = 0; i < barItems.length; i++) {
-		listItems += barItems[i].display('flint-endpoint-bar');
-	    }
-	}
-    }
-
-
-    function FlintCoolbar(config, editor) {
-
-	try {
-	    var coolbarItems = new Array();
-	    coolbarItems.push(new FlintDatasetPicker(config, editor));	
-	    coolbarItems.push(new FlintDatasetQuerySubmitButton(editor));	
-	    coolbarItems.push(new FlintDatasetMimeTypePicker(config, editor));	
-	    this.getItems = function() {return coolbarItems};
-	}
-	catch (e) {editor.getErrorBox().show(e);}
-
-	this.hide = function() {
-	    $('#flint-coolbar').hide();			
-		coolbarItems[2].setDisableElements("HIDE");
-	}
-
-	this.show = function() {
-	    $('#flint-coolbar').show();		
-		coolbarItems[2].setDisableElements("SHOW");
-	}
-
-	this.display = function(container) {
-	    var listItems = "";
-	    $('#' + container).append("<div id='flint-coolbar'></div>");
-	    for (var i = 0; i < coolbarItems.length; i++) {
-		listItems += coolbarItems[i].display('flint-coolbar');
-	    }
-	}
-    }
-
-    // The endpoint entry item allows for a freeform URL of an endpoint
-    function FlintEndpointEntry(config, editor) {
-
-	try {
-	    var endpointItems = new Array();
-	    
-	    this.addItem = function() {
-		try {
-		    for (var i = 0; i < endpointItems.length; i++) {
-			if (endpointItems[i].uri == this.getEndpoint()) return;
-		    }
-		    var newItem = {};
-		    newItem.uri = this.getEndpoint();
-		    endpointItems.push(newItem);
-		}
-		catch (e) {"EndpointEntryAddItem: " + editor.getErrorBox().show(e);}
-	    }
-	    
-	    this.getItems = function() {return endpointItems};
-	    
-	    this.getItem = function(endpoint) {
-		for (var i = 0; i < endpointItems.length; i++) {
-		    if (endpointItems[i].uri == endpoint) {
-			return endpointItems[i];
-		    }
-		}
-		return null;
-	    }		
-
-	    this.display = function(container) {
-		
-		var endpoint = 'http://semantic.ckan.net/sparql/';
-			
-		$('#' + container).append("<div id='flint-endpoint-input' title='Enter the endpoint that you wish to query'><h2>Endpoint</h2><input id='flint-endpoint-url' type='text' value='" + endpoint + "' name='endpoint'></div>");
-	    }		
-
-	    this.getEndpoint = function() {return $("#flint-endpoint-url").val();}		
-	}
-	catch (e) {"FlintEndpointEntry: " + editor.getErrorBox().show(e);}
-    }
-
-    // The dataset picker allows a user to select the endpoint that they wish to send queries to
-    function FlintDatasetPicker(config, editor) {
-
-	try {
-	    var datasetItems = new Array();
-	    
-	    // config.endpoints contains the list of endpoints that should be made available
-	    for (var i = 0; i < config.endpoints.length; i ++) {datasetItems.push(config.endpoints[i]);}
-
-	    this.getItems = function() {return datasetItems};
-	    
-	    this.getItem = function(endpoint) {
-		for (var i = 0; i < datasetItems.length; i ++) {
-		    if (datasetItems[i].uri == endpoint) return datasetItems[i];
-		}
-	    }		
-
-	    this.display = function(container) {
-		var listItems = "";
-		
-		// if only 1 dataset, display disabled textbox instead of dropdown
-		if (datasetItems.length == 1) {
-			$('#' + container).append("<div id='flint-dataset'><h2>Dataset</h2><input disabled='disabled' type=text id='flint-dataset-select' name='kb' value='" + datasetItems[0].uri  + "' /></div>");
-		}
-		else {
-			for (var i = 0; i < datasetItems.length; i ++) {
-				listItems += "<option value='" + datasetItems[i].uri + "'>" +datasetItems[i].name + "</option>";
-			}
-			$('#' + container).append("<div id='flint-dataset' title='Select the endpoint that you wish to query'><h2>Dataset</h2><select id='flint-dataset-select' name='kb'>" + listItems + "</select></div>");
-			}
-		}
-	    
-	    this.getEndpoint = function() {return $("#flint-dataset-select").val();}
-	    
-	    this.setChangeAction = function(callback) {$('#flint-dataset-select').change(callback);}	
-	}
-	catch (e) {editor.getErrorBox().show(e);}
-    }
-
-    function FlintEndpointDataInfoButton(editor) {
-
-	this.display = function(container) {
-	    try {
-		$('#' + container).append("<input class='flint-info-button' id='flint-endpoint-datainfo' type='button' value='Get Dataset Info' title='Query dataset for properties and classes'/>");
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-	
-	this.setClickAction = function(callback) {$('#flint-endpoint-datainfo').click(callback);}
-    }
-
-    function FlintEndpointQuerySubmitButton(editor) {
-
-	this.disable = function() {$('.flint-submit-button').css('visibility','hidden');}
-
-	this.enable = function() {$('.flint-submit-button').css('visibility','visible');}
-	
-	this.display = function(container) {
-	    try {
-		$('#' + container).append("<input class='flint-submit-button' id='flint-endpoint-submit' type='submit' value='Submit' title='Submit query to endpoint'/>");
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-	
-	this.setSubmitAction = function(callback) {$('#flint-endpoint-submit').click(callback);}
-    }
-
-    function FlintDatasetQuerySubmitButton(editor) {
-
-	this.disable = function() {$('.flint-submit-button').css('visibility','hidden');}
-
-	this.enable = function() {$('.flint-submit-button').css('visibility','visible');}
-	
-	this.display = function(container) {
-	    try {
-		$('#' + container).append("<input class='flint-submit-button' id='flint-dataset-submit' type='submit' value='Submit' title='Submit query to endpoint'/>");
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-	
-	this.setSubmitAction = function(callback) {$('#flint-dataset-submit').click(callback);}
-    }
-
-    function FlintEndpointMimeTypePicker(config, editor) {
-		
-		var lastQueryType;
-		
-		this.setDisableElements = function(queryType)  {
-			try {
-			
-			if (queryType == "SHOW") {
-				queryType = lastQueryType;
-			}
-			else if (queryType == "HIDE") {
-				$('#flint-endpoint-mimeset-select, #flint-endpoint-mimeset-construct').attr('disabled', 'disabled');
-			}
-			
-			if (queryType == "SELECT") {
-				$('#flint-endpoint-mimeset-select-chooser').show(300);			
-				$('#flint-endpoint-mimeset-construct-chooser').hide();
-				
-				if ($('#flint-endpoint-bar').is(':visible')) {
-					$('#flint-endpoint-mimeset-select').attr('disabled', '');
-					$('#flint-endpoint-mimeset-construct').attr('disabled', 'disabled');
-				}
-				else {
-					$('#flint-endpoint-mimeset-select, #flint-endpoint-mimeset-construct').attr('disabled', 'disabled');
-				}
-				
-				lastQueryType = queryType;
-				
-				//$('#flint-endpoint-mimeset-select').removeAttr('disabled');			
-				
-								
-			} 
-			else if (queryType == "CONSTRUCT" || queryType == "DESCRIBE") {
-				$('#flint-endpoint-mimeset-construct-chooser').show(300);			
-				$('#flint-endpoint-mimeset-select-chooser').hide();
-				
-				if ($('#flint-endpoint-bar').is(':visible')) {
-					$('#flint-endpoint-mimeset-construct').attr('disabled', '');
-					$('#flint-endpoint-mimeset-select').attr('disabled', 'disabled');
-				}
-				else {
-					$('#flint-endpoint-mimeset-select, #flint-endpoint-mimeset-construct').attr('disabled', 'disabled');
-				}
-				
-				lastQueryType = queryType;
-				
-				//$('#flint-endpoint-mimeset-construct').removeAttr('disabled');					
-							
-			}			
-			}
-			catch (e) {editor.getErrorBox().show(e);}
-		} ;
-
-	this.display = function(container) {
-	    try {
-		var selectChooser = "";
-		var constructChooser = "";
-		
-		// use output parameter for IE, otherwise accept header mimetype
-		if ($.browser.msie)
-			var type = 'format';
-		else
-			var type = 'type';
-
-		for (var i = 0; i < config.defaultEndpointParameters.selectFormats.length; i++) {
-		    selectChooser += "<option value='" + config.defaultEndpointParameters.selectFormats[i][type] + "'>" +config.defaultEndpointParameters.selectFormats[i].name + "</option>";
-		}
-
-		for (var i = 0; i < config.defaultEndpointParameters.constructFormats.length; i++) {
-		    constructChooser += "<option value='" + config.defaultEndpointParameters.constructFormats[i][type] + "'>" +config.defaultEndpointParameters.constructFormats[i].name + "</option>";
-		}
-
-		$('#' + container).append("<div id='flint-endpoint-output-formats' title='Select the format in which you would like the results to be returned'><h2>Output Format</h2></div>");
-
-		selectChooser = "<div id='flint-endpoint-mimeset-select-chooser' title='Select the output type that you wish to request'><select id='flint-endpoint-mimeset-select' name='output'>" + selectChooser + "</select></div>";
-
-		constructChooser = "<div id='flint-endpoint-mimeset-construct-chooser' title='Select the output type that you wish to request'><select id='flint-endpoint-mimeset-construct' name='output'>" + constructChooser + "</select></div>";
-
-		$('#flint-endpoint-output-formats').append(selectChooser);			
-		$('#flint-endpoint-output-formats').append(constructChooser);		
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-
-	this.getMimeType = function() {
-	    try {
-		if ($("#flint-endpoint-mimeset-select").is(":visible")) return $("#flint-endpoint-mimeset-select").val();
-		else return $("#flint-endpoint-mimeset-construct").val();
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-
-	this.setChangeAction = function(callback) {
-	}
-    }
-
-    function FlintDatasetMimeTypePicker(config, editor) {	
-
-		var lastQueryType;
-		
-		this.setDisableElements = function(queryType)  {
-			
-			try {
-			
-			if (queryType == "SHOW") {
-				queryType = lastQueryType;
-			}
-			else if (queryType == "HIDE") {
-				$('#flint-dataset-mimeset-select, #flint-dataset-mimeset-construct').attr('disabled', 'disabled');
-			}
-			
-			if (queryType == "SELECT") {				
-				
-				$('#flint-dataset-mimeset-select-chooser').show(300);	
-				$('#flint-dataset-mimeset-construct-chooser').hide();
-				
-				if ($('#flint-coolbar').is(':visible')) {
-					$('#flint-dataset-mimeset-select').attr('disabled', '');
-					$('#flint-dataset-mimeset-construct').attr('disabled', 'disabled');
-				}
-				else {
-					$('#flint-dataset-mimeset-select, #flint-dataset-mimeset-construct').attr('disabled', 'disabled');
-				}
-				
-				lastQueryType = queryType;
-				
-					
-			} 
-			else if (queryType == "CONSTRUCT" || queryType == "DESCRIBE") {
-				$('#flint-dataset-mimeset-construct-chooser').show(300);			
-				$('#flint-dataset-mimeset-select-chooser').hide();
-				
-				if ($('#flint-coolbar').is(':visible')) {
-					$('#flint-dataset-mimeset-construct').attr('disabled', '');
-					$('#flint-dataset-mimeset-select').attr('disabled', 'disabled');
-				}
-				else {
-					$('#flint-dataset-mimeset-select, #flint-dataset-mimeset-construct').attr('disabled', 'disabled');
-				}
-				
-				lastQueryType = queryType;
-			}			
-			}		
-			catch (e) {editor.getErrorBox().show(e);}
-		} ;
-
-	this.display = function(container) {
-	    try {
-		var selectChooser = "";
-		var constructChooser = "";
-		
-		// use output parameter for IE, otherwise accept header mimetype
-		if ($.browser.msie)
-			var type = 'format';
-		else
-			var type = 'type';
-
-		for (var i = 0; i < config.defaultEndpointParameters.selectFormats.length; i++) {
-		    selectChooser += "<option value='" + config.defaultEndpointParameters.selectFormats[i][type] + "'>" +config.defaultEndpointParameters.selectFormats[i].name + "</option>";
-		}
-
-		for (var i = 0; i < config.defaultEndpointParameters.constructFormats.length; i++) {
-		    constructChooser += "<option value='" + config.defaultEndpointParameters.constructFormats[i][type] + "'>" +config.defaultEndpointParameters.constructFormats[i].name + "</option>";
-		}
-
-		$('#' + container).append("<div id='flint-dataset-output-formats' title='Select the format in which you would like the results to be returned'><h2>Output Format</h2></div>");
-
-		selectChooser = "<div id='flint-dataset-mimeset-select-chooser' title='Select the output type that you wish to request'><select id='flint-dataset-mimeset-select' name='output'>" + selectChooser + "</select></div>";
-
-		constructChooser = "<div id='flint-dataset-mimeset-construct-chooser' title='Select the output type that you wish to request'><select id='flint-dataset-mimeset-construct' name='output'>" + constructChooser + "</select></div>";
-
-		$('#flint-dataset-output-formats').append(selectChooser);			
-		$('#flint-dataset-output-formats').append(constructChooser);		
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-
-	this.getMimeType = function() {
-	    try {
-		if ($("#flint-dataset-mimeset-select").is(":visible")) return $("#flint-dataset-mimeset-select").val();
-		else return $("#flint-dataset-mimeset-construct").val();
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-
-	this.setChangeAction = function(callback) {
-	}
-    }
-
-
-    function FlintSidebar(editor, config) {
-
-	var activeDataItem;
-	var activeTab = "SPARQL";
-	var allKeywords = editor.allKeywords;
-
-	function displaySparql() {
-	    $('#flint-sidebar-content').text("");
-
-	    var rowsize=4;
-	    var commandList="<table id='flint-command-table' border='0' cellpadding='0' cellspacing='0' border-style='none,none,none,none'>";
-	    for(var i=0; i<allKeywords.length; i+=rowsize)
-	    {
-		commandList+="<tr>";
-		for(var j=0; (j<rowsize) && (i+j<allKeywords.length); ++j) {
-		    commandList+='<td border-style="none"><button type="button" disabled="true" id="flint-keyword-'+allKeywords[i+j]+'-button" class="flint-keyword-button">'+allKeywords[i+j]+'</button></td>';
-		}
-		commandList+="</tr>";
-	    }
-	    commandList+="</table>";
-
-	    /*
-	      var commandList = "<table id='flint-command-table'>"
-	      + "<tr><td>SELECT</td><td>GRAPH</td><td>WHERE</td><td>ISBLANK</td></tr>"
-	      + "<tr><td>CONSTRUCT</td><td>FROM</td><td>OFFSET</td><td>ISURI</td></tr>"
-	      + "<tr><td>DESCRIBE</td><td>FROM NAMED</td><td>LIMIT</td><td>ISLITERAL</td></tr>"
-	      + "<tr><td>ASK</td><td>ORDER BY</td><td>ASC</td><td>ISIRI</td></tr>"
-	      + "<tr><td>DISTINCT</td><td>PREFIX</td><td>DESC</td><td>BOUND</td></tr>"
-	      + "<tr><td>UNION</td><td>OPTIONAL</td><td>REDUCED</td><td>DATATYPE</td></tr>"
-	      + "<tr><td>FILTER</td><td>REGEX</td><td>STR</td><td>SAMETERM</td></tr>"
-	      + "<tr><td>LANGMATCHES</td></tr>"			
-	      + "</table>";
-	    */
-	    
-	    $('#flint-sidebar-content').append(commandList);
-	    /*
-	      $('#flint-command-table td').click(
-	      function(e) {
-	      editor.insert($(this).text());
-	      e.stopPropagation();
-	      }
-	      );
-	    */
-	}
-	
-	function calcPrefixes() {
-	    try {
-		if (config.namespaces != null) {
-		    var listText = "";
-		    var prefixes = new Array();
-		    for (var j = 0; j < config.namespaces.length; j++) {
-			var found = false;
-			if (activeDataItem.properties != null) {
-			    var uri = config.namespaces[j].uri;
-			    var prefix = config.namespaces[j].prefix;
-			    for (var i = 0; i < activeDataItem.properties.results.bindings.length; i++) {
-				if (activeDataItem.properties.results.bindings[i].p.value.indexOf(uri) == 0) {
-				    prefixes.push(config.namespaces[j]);
-				    found = true;
-				    break;
-				}
-			    }
-			}
-			if (!found && activeDataItem.classes != null) {
-			    var uri = config.namespaces[j].uri;
-			    var prefix = config.namespaces[j].prefix;
-			    for (var i = 0; i < activeDataItem.classes.results.bindings.length; i++) {
-				if (activeDataItem.classes.results.bindings[i].o.value.indexOf(uri) == 0) {
-				    prefixes.push(config.namespaces[j])
-				    break;
-				}
-			    }
-			}
-		    }
-		    activeDataItem.prefixes = prefixes;
-		}
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-	
-	this.getPrefixes = function() {
-
-	    if (activeDataItem == null) return "";
-	    
-	    if (activeDataItem.prefixes != null) {
-		var prefixText = "";
-		for (var i = 0; i < activeDataItem.prefixes.length; i++) {
-		    prefixText += "PREFIX " + activeDataItem.prefixes[i].prefix + ": <" + activeDataItem.prefixes[i].uri + ">\n";
-		}
-		return prefixText;
-	    }
-	    else return "";
-	}
-	
-	//SNC
-	this.getActiveDataItem = function() {
-	    return activeDataItem;
-	}
-
-	this.clearActiveItem = function() {
-	    activeDataItem = null;
-	}
-	
-	function displayPrefixes() {
-	    $('#flint-sidebar-content').text("");
-	    if (activeDataItem) {
-		if (activeDataItem.prefixes != null) {
-		    try {
-			var listText = "";
-			for (var i = 0; i < activeDataItem.prefixes.length; i++) {
-			    listText += "<li class='flint-prefix' title='" + activeDataItem.prefixes[i].name + "'>" + activeDataItem.prefixes[i].prefix + "</li>";
-			}
-			listText = "<ul>" + listText + "</ul>";
-			$('#flint-sidebar-content').append(listText);
-			$('.flint-prefix').click(
-			    function(e) {
-				editor.insert($(this).text());
-				e.stopPropagation();
-			    }
-			);	
-		    }
-		    catch (e) {editor.getErrorBox().show(e);}
-		}
-		else $('#flint-sidebar-content').append("<p>No prefixes available</p>");
-	    }
-	    else $('#flint-sidebar-content').append("<p>No prefixes have been retrieved</p>");
-	}
-
-	function displaySamples() {
-	    $('#flint-sidebar-content').text("");
-	    if (activeDataItem) {
-		if (activeDataItem.queries != null) {
-		    try {
-			var sampleText = "";
-			for (var i = 0; i < activeDataItem.queries.length; i++) {
-			    var query = activeDataItem.queries[i].query;
-			    query = query.replace(/</g, "&lt;");
-			    query = query.replace(/>/g, "&gt;");					
-			    sampleText += "<div class='flint-sample' title=''Click to insert sample into editing pane'><h3>" + activeDataItem.queries[i].name + "</h3><p>" + activeDataItem.queries[i].description + "</p><pre class='flint-sample-content'>" + query + "</pre></div>";
-			}
-			sampleText = "<div id='flint-samples'>" + sampleText + "</div>";
-			$('#flint-sidebar-content').append(sampleText);
-			$('.flint-sample-content').click(
-			    function(e) {
-				var okay = true;
-				var sample = $(this);
-				if (editor.getCodeEditor().getValue() != "") {
-				    editor.getConfirmDialog().setCloseAction(function() {
-					var result = editor.getConfirmDialog().getResult();
-					if (result == "Okay") {
-					    var cm= editor.getCodeEditor();
-					    cm.setValue("");
-					    editor.insert(sample.text());
-					    // Format query
-					    var maxlines= cm.lineCount();
-					    for (var ln=0; ln<maxlines; ++ln)
-						cm.indentLine(ln);
-					}
-				    });
-				    editor.getConfirmDialog().show("Insert Sample Query", "<p>Are you sure you want to abandon the current text?</p>");
-				}
-				e.stopPropagation();
-			    }
-			);	
-		    }
-		    catch (e) {editor.getErrorBox().show(e);}
-		}
-		else $('#flint-sidebar-content').append("<p>No samples available</p>");
-	    }
-	    else $('#flint-sidebar-content').append("<p>Samples are not applicable</p>");
-	}
-
-	function displayProperties() {
-	    $('#flint-sidebar-content').text("");
-	    if (activeDataItem) {
-		if (activeDataItem.properties != null) {
-		    try {
-			var listText = "";
-			for (var i = 0; i < activeDataItem.properties.results.bindings.length; i++) {
-			    listText += "<li class='flint-property'>" + activeDataItem.properties.results.bindings[i].p.value + "</li>";
-			}
-			listText = "<ul>" + listText + "</ul>";
-			$('#flint-sidebar-content').append(listText);
-			$('.flint-property').click(
-			    function(e) {
-				editor.insert("<" + $(this).text() + ">");
-				e.stopPropagation();
-			    }
-			);	
-		    }
-		    catch (e) {editor.getErrorBox().show(e);}
-		}
-		else $('#flint-sidebar-content').append("<p>No properties available</p>");
-	    }
-	    else $('#flint-sidebar-content').append("<p>No properties have been retrieved</p>");
-	}
-
-	function displayClasses() {
-	    $('#flint-sidebar-content').text("");
-	    if (activeDataItem) {
-		if (activeDataItem.classes != null) {
-		    try {
-			var listText = "";
-			for (var i = 0; i < activeDataItem.classes.results.bindings.length; i++) {
-			    listText += "<li class='flint-class'>" + activeDataItem.classes.results.bindings[i].o.value + "</li>";
-			}
-			listText = "<ul>" + listText + "</ul>";
-			$('#flint-sidebar-content').append(listText);
-			$('.flint-class').click(
-			    function(e) {
-				editor.insert("<" + $(this).text() + ">");
-				e.stopPropagation();
-			    }
-			);	
-		    }
-		    catch (e) {editor.getErrorBox().show(e);}
-		}
-		else $('#flint-sidebar-content').append("<p>No classes available</p>");
-	    }
-	    else $('#flint-sidebar-content').append("<p>No classes have been retrieved</p>");
-	}
-	
-	function showTab(tabName, id) {
-	    activeTab = tabName;
-	    $('#flint-sidebar-options li').removeAttr("class");
-	    $('#' + id).attr("class", "flint-sidebar-selected");
-	    if (tabName == "Properties") {displayProperties();}
-	    else if (tabName == "Classes") {displayClasses();}
-	    else if (tabName == "Prefixes") {displayPrefixes();}
-	    else if (tabName == "Samples") {displaySamples();}
-	    else displaySparql();
-	}
-	
-	this.showActiveTab = function() {
-	    showTab(activeTab);
-	}
-
-	this.display = function(container) {
-	    var listItems = "";
-	    $('#' + container).append("<div id='flint-sidebar'>"
-				      + "<ul id='flint-sidebar-options''>"
-				      + "<li id='flint-sidebar-sparql' title='View a list of SPARQL commands that can be inserted into the query'>SPARQL</li>"
-				      + "<li id='flint-sidebar-properties' title='View a list of properties for the current dataset'>Properties</li>"
-				      + "<li id='flint-sidebar-classes' title='View a list of classes for the current dataset'>Classes</li>"
-				      + "<li id='flint-sidebar-prefixes' title='View a list of known prefixes for the current dataset'>Prefixes</li>"
-				      + "<li id='flint-sidebar-samples'' title='View sample queries for the current dataset'>Samples</li>"		
-				      + "</ul><div id='flint-sidebar-content'></div></div>"
-				      + "<div id='flint-sidebar-grabber'><span id='flint-sidebar-grabber-button' title='Click to expand/shrink the tools pane'></span></div>");
-	    $('#flint-sidebar-grabber').click(
-		function() {
-		    try {
-			if ($('#flint-sidebar').width() > 50) {
-			    $('#flint-sidebar').css("width", "3%");
-			    $('#flint-sidebar-content').css("overflow", "hidden");
-			    $('#flint-samples').css("white-space", "nowrap");
-			    $('.CodeMirror').css("width", "95%");
-			    if (config.interface.toolbar) {
-				editor.getToolbar().setEnabled("Show Tools", true);				
-				editor.getToolbar().setEnabled("Hide Tools", false);				
-				editor.getMenu().setEnabled("Show Tools", true);
-				editor.getMenu().setEnabled("Hide Tools", false);
-			    }
-			}
-			else {
-			    $('#flint-sidebar').css("width", "50%");
-			    $('#flint-sidebar-content').css("overflow", "auto");
-			    $('#flint-samples').css("white-space", "wrap");
-			    $('.CodeMirror').css("width", "48%");
-			    if (config.interface.toolbar) {
-				editor.getToolbar().setEnabled("Show Tools", false);
-				editor.getToolbar().setEnabled("Hide Tools", true);
-				editor.getMenu().setEnabled("Show Tools", false);
-				editor.getMenu().setEnabled("Hide Tools", true);
-			    }
-			}
-		    }
-		    catch (e) {editor.getErrorBox().show(e);}
-		}
-	    );	
-	    $('#flint-sidebar-sparql').click(
-		function(e) {
-		    showTab("SPARQL", $(this).attr("id"));
-		    e.stopPropagation();
-		}
-	    );	
-	    $('#flint-sidebar-properties').click(
-		function(e) {
-		    showTab("Properties", $(this).attr("id"));
-		    e.stopPropagation();
-		}
-	    );	
-	    $('#flint-sidebar-classes').click(
-		function(e) {
-		    showTab("Classes", $(this).attr("id"));
-		    e.stopPropagation();
-		}
-	    );	
-	    $('#flint-sidebar-prefixes').click(
-		function(e) {
-		    showTab("Prefixes", $(this).attr("id"));
-		    e.stopPropagation();
-		}
-	    );	
-	    $('#flint-sidebar-samples').click(
-		function(e) {
-		    showTab("Samples", $(this).attr("id"));
-		    e.stopPropagation();
-		}
-	    );	
-	}
-	
-	this.updateSamples = function(datasetItem) {
-	    activeDataItem = datasetItem;
-	    if (activeTab == "Samples") displaySamples();
-	}
-	
-	this.updateProperties = function(datasetItem) {
-	    try {
-		if (datasetItem.properties == null) {
-		    activeDataItem = datasetItem;
-		    this.showActiveTab();
-		    var paramsData = {};
-		    paramsData[config.defaultEndpointParameters.queryParameters.query] = "SELECT DISTINCT ?p WHERE {?s ?p ?o} ORDER BY ?p LIMIT 1000";
-		    $.ajax({
-			url: datasetItem.uri,
-			data: paramsData,
-			type: 'post',
-			headers: {"Accept": "application/sparql-results+json"},
-			dataType: 'json',
-			error: function(XMLHttpRequest, textStatus, errorThrown) {
-			    editor.getErrorBox().show("Properties cannot be retrieved. HTTP Status: " + XMLHttpRequest.status + ", " + errorThrown);
-			},
-			success: function(data) {
-			    datasetItem.properties = data;
-			    if (activeTab == "Properties") displayProperties();
-			    calcPrefixes();
-			    if (activeTab == "Prefixes") displayPrefixes();	
-			    if (datasetItem.properties.results.bindings.length == 1000) alert("The maximum number of properties has been reached - 1000");
-			}
-		    });
-		}
-		else {
-		    activeDataItem = datasetItem;
-		    if (activeTab == "Properties") displayProperties();
-		    calcPrefixes();
-		    if (activeTab == "Prefixes") displayPrefixes();				
-		}
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-
-	this.updateClasses = function(datasetItem) {		
-	    try {
-		if (datasetItem.classes == null) {
-		    activeDataItem = datasetItem;
-		    this.showActiveTab();
-		    var paramsData = {};
-		    paramsData[config.defaultEndpointParameters.queryParameters.query] = "SELECT DISTINCT ?o WHERE {?s a ?o} ORDER BY ?o LIMIT 1000";
-		    $.ajax({
-			url: datasetItem.uri,
-			data: paramsData,
-			type: 'post',
-			headers: {"Accept": "application/sparql-results+json"},
-			dataType: 'json',
-			error: function(XMLHttpRequest, textStatus, errorThrown) {
-			    editor.getErrorBox().show("Classes cannot be retrieved. HTTP Status: " + XMLHttpRequest.status + ", " + errorThrown);
-			},
-			success: function(data) {
-			    datasetItem.classes = data;
-			    if (activeTab == "Classes") displayClasses();
-			    calcPrefixes();			
-			    if (activeTab == "Prefixes") displayPrefixes();				
-			    if (datasetItem.classes.results.bindings.length == 1000) alert("The maximum number of classes has been reached - 1000");
-			}
-		    });
-		}
-		else {
-		    activeDataItem = datasetItem;
-		    if (activeTab == "Classes") displayClasses();
-		    calcPrefixes();
-		    if (activeTab == "Prefixes") displayPrefixes();				
-		}
-	    }
-	    catch (e) {editor.getErrorBox().show(e);}
-	}
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cancel_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cancel_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cancel_16x16.png
deleted file mode 100644
index 7832e30..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cancel_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy v2_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy v2_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy v2_16x16.png
deleted file mode 100644
index fb15e96..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy v2_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy_16x16.png
deleted file mode 100644
index f348604..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Copy_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_16x16.png
deleted file mode 100644
index 2701f68..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_24x24.png
deleted file mode 100644
index 16b578c..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Cut_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Delete_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Delete_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Delete_16x16.png
deleted file mode 100644
index 8c7ca75..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Delete_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Edit_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Edit_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Edit_16x16.png
deleted file mode 100644
index c897120..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Edit_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_16x16.png
deleted file mode 100644
index d01ed62..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_24x24.png
deleted file mode 100644
index 1fa69f4..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Favorites_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Find_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Find_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Find_16x16.png
deleted file mode 100644
index 90013f4..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Find_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_16x16.png
deleted file mode 100644
index 4d762ff..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_24x24.png
deleted file mode 100644
index 5350cca..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Globe_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Information_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Information_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Information_16x16.png
deleted file mode 100644
index 1a3cfc5..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Information_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_16x16.png
deleted file mode 100644
index f776ac6..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_24x24.png
deleted file mode 100644
index b611060..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Key_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_16x16.png
deleted file mode 100644
index bf11955..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_24x24.png
deleted file mode 100644
index 8b76bbd..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/New_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_16x16.png
deleted file mode 100644
index 0515066..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_24x24.png
deleted file mode 100644
index 27f16db..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Next_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Open_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Open_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Open_16x16.png
deleted file mode 100644
index 796b822..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Open_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Paste_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Paste_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Paste_16x16.png
deleted file mode 100644
index 91bf4af..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Paste_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_16x16.png
deleted file mode 100644
index f21094e..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_24x24.png
deleted file mode 100644
index 3e355d1..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Prev_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Preview_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Preview_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Preview_16x16.png
deleted file mode 100644
index 53d003b..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Preview_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Previous_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Previous_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Previous_16x16.png
deleted file mode 100644
index 7a65b6f..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Previous_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_16x16.png
deleted file mode 100644
index 5bc3f54..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_24x24.png
deleted file mode 100644
index 1755b18..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Properties_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_16x16.png
deleted file mode 100644
index 8618cdb..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_24x24.png
deleted file mode 100644
index d16e110..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Redo_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Refresh_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Refresh_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Refresh_16x16.png
deleted file mode 100644
index eaf92d2..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Refresh_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Remove_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Remove_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Remove_16x16.png
deleted file mode 100644
index 234f9f5..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Remove_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Text Document_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Text Document_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Text Document_16x16.png
deleted file mode 100644
index 809f7e0..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Text Document_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_16x16.png
deleted file mode 100644
index 2e9da2d..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_16x16.png and /dev/null differ


[26/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/snorql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/snorql.js b/extras/webjars/snorql/src/main/resources/snorql.js
new file mode 100755
index 0000000..620fa1e
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/snorql.js
@@ -0,0 +1,591 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var snorql = new Snorql();
+
+String.prototype.trim = function () {
+    return this.replace(/^\s*/, "").replace(/\s*$/, "");
+}
+
+String.prototype.startsWith = function(str) {
+	return (this.match("^"+str) == str);
+}
+
+function Snorql() {
+    // modify this._endpoint to point to your SPARQL endpoint
+    this._endpoint = _BASIC_URL + 'sparql/select';
+    // modify these to your liking
+    this._poweredByLink = 'http://marmotta.incubator.apache.org';
+    this._poweredByLabel = 'Snorql & Apache Marmotta';
+    this._enableNamedGraphs = false;
+
+    this._browserBase = null;
+    this._namespaces = {};
+    this._graph = null;
+    this._xsltDOM = null;
+
+    this.start = function() {
+        // TODO: Extract a QueryType class
+        this.setBrowserBase(document.location.href.replace(/\?.*/, ''));
+        this._displayEndpointURL();
+        //this._displayPoweredBy();
+        this.updateOutputMode();
+        var match = document.location.href.match(/\?(.*)/);
+        var queryString = match ? match[1] : '';
+        if (!queryString) {
+            document.getElementById('querytext').value = 'SELECT * WHERE {\n  ?s ?p ?o\n}\nLIMIT 10';
+            this._updateGraph(null, false);
+            return;
+        }
+        
+        var graph = queryString.match(/graph=([^&]*)/);
+        graph = graph ? decodeURIComponent(graph[1]) : null;
+        this._updateGraph(graph, false);
+        
+        var browse = queryString.match(/browse=([^&]*)/);
+        if (browse) {
+	        if (browse[1] == 'classes') {
+	            var resultTitle = 'List of all classes:';
+	            var query = 'SELECT DISTINCT ?class\n' +
+	                    'WHERE { [] a ?class }\n' +
+	                    'ORDER BY ?class';
+	        } else if (browse[1] == 'properties') {
+	            var resultTitle = 'List of all properties:';
+	            var query = 'SELECT DISTINCT ?property\n' +
+	                    'WHERE { [] ?property [] }\n' +
+	                    'ORDER BY ?property';
+	        } else if (browse[1] == 'graphs') {
+	            var resultTitle = 'List of all named graphs:';
+	            var query = 'SELECT DISTINCT ?namedgraph ?label\n' +
+	                    'WHERE {\n' +
+	                    '  GRAPH ?namedgraph { ?s ?p ?o }\n' +
+	                    '  OPTIONAL { ?namedgraph rdfs:label ?label }\n' +
+	                    '}\n' +
+	                    'ORDER BY ?namedgraph';
+	        }
+        }
+        
+        var properties = queryString.match(/property=([^&]*)/);
+        if (properties) {
+            var resultTitle = 'All uses of property ' + decodeURIComponent(properties[1]) + ':';
+            var query = 'SELECT DISTINCT ?resource ?value\n' +
+                    'WHERE { ?resource <' + decodeURIComponent(properties[1]) + '> ?value }\n' +
+                    'ORDER BY ?resource ?value';
+        }
+        
+        var classes = queryString.match(/class=([^&]*)/);
+        if (classes) {
+            var resultTitle = 'All instances of class ' + decodeURIComponent(classes[1]) + ':';
+            var query = 'SELECT DISTINCT ?instance\n' +
+                    'WHERE { ?instance a <' + decodeURIComponent(classes[1]) + '> }\n' +
+                    'ORDER BY ?instance';
+        }
+        
+        var describe = queryString.match(/describe=([^&]*)/);
+        if (describe) {
+            var resultTitle = 'Description of ' + decodeURIComponent(describe[1]) + ':';
+            var query = 'SELECT DISTINCT ?property ?hasValue ?isValueOf\n' +
+                    'WHERE {\n' +
+                    '  { <' + decodeURIComponent(describe[1]) + '> ?property ?hasValue }\n' +
+                    '  UNION\n' +
+                    '  { ?isValueOf ?property <' + decodeURIComponent(describe[1]) + '> }\n' +
+                    '}\n' +
+                    'ORDER BY (!BOUND(?hasValue)) ?property ?hasValue ?isValueOf';
+        }
+        
+        var queryMatch = queryString.match(/query=([^&]*)/);
+        if (queryMatch) {
+        	var resultTitle = 'SPARQL results:';
+        	var query = this._betterUnescape(queryMatch[1]);
+        
+        }
+        
+        var prefixes = this._getPrefixes();
+        if (queryString.match(/prefixes=/)) {
+        	prefixes = this._betterUnescape(queryString.match(/prefixes=([^&]*)/)[1]);
+        }
+        
+        var querytext = prefixes + " " + query;
+        document.getElementById('querytext').value = query;
+        this.displayBusyMessage();
+        var service = new SPARQL.Service(this._endpoint);
+        if (this._graph) {
+            service.addDefaultGraph(this._graph);
+        }
+
+        // AndyL changed MIME type and success callback depending on query form...
+        var dummy = this;
+
+   	    var exp = /^\s*(?:PREFIX\s+\w*:\s+<[^>]*>\s*)*(\w+)\s*.*/i;
+   	    var match = exp.exec(query);
+   	    if (match) {
+	        if (match[1].toUpperCase() == 'ASK') {
+	        	service.setOutput('boolean');
+	        	var successFunc = function(value) {
+	                dummy.displayBooleanResult(value, resultTitle);
+	            };
+	        } else if (match[1].toUpperCase() == 'CONSTRUCT' || match[1].toUpperCase() == 'DESCRIBE'){ // construct describe
+	    		service.setOutput('rdf'); // !json
+	    		var successFunc = function(model) {
+	                dummy.displayRDFResult(model, resultTitle);
+	            };
+	        } else {
+	        	service.setRequestHeader('Accept', 'application/sparql-results+json,*/*');
+	        	service.setOutput('json');
+	        	var successFunc = function(json) {
+	        		dummy.displayJSONResult(json, resultTitle);
+	        	};
+	        }
+   	    }
+
+        service.query(querytext, {
+            success: successFunc,
+            failure: function(report) {
+                var message = report.responseText.match(/<pre>([\s\S]*)<\/pre>/);
+                if (message) {
+                    dummy.displayErrorMessage(message[1]);
+                } else {
+                    dummy.displayErrorMessage(report.responseText);
+                }
+            }
+        });
+    }
+
+    this.setBrowserBase = function(url) {
+        this._browserBase = url;
+    }
+
+    this._displayEndpointURL = function() {
+    	var title = document.createElement("span");
+    	title.innerHTML = 'Querying <a href="' + this._endpoint + '">' + this._endpoint + '</a>';
+        this._display(title, 'title');
+        document.title = "Querying " + this._endpoint;
+    }
+
+    this._displayPoweredBy = function() {
+        $('poweredby').href = this._poweredByLink;
+        $('poweredby').update(this._poweredByLabel);
+    }
+
+    this.setNamespaces = function(namespaces) {
+        this._namespaces = namespaces;
+        var prefixes = this._getPrefixes();
+        document.getElementById('prefixes').value = prefixes;
+        this._display(document.createTextNode(prefixes), 'prefixestext');
+    }
+
+    this.switchToGraph = function(uri) {
+        this._updateGraph(uri, true);
+    }
+
+    this.switchToDefaultGraph = function() {
+        this._updateGraph(null, true);
+    }
+
+    this._updateGraph = function(uri, effect) {
+        if (!this._enableNamedGraphs) {
+            $('default-graph-section').hide();
+            $('named-graph-section').hide();
+            $('browse-named-graphs-link').hide();
+            return;
+        }
+        var changed = (uri != this._graph);
+        this._graph = uri;
+        var el = document.getElementById('graph-uri');
+        el.disabled = (this._graph == null);
+        el.value = this._graph;
+        if (this._graph == null) {
+            var show = 'default-graph-section';
+            var hide = 'named-graph-section';
+            $$('a.graph-link').each(function(link) {
+                match = link.href.match(/^(.*)[&?]graph=/);
+                if (match) link.href = match[1];
+            });
+        } else {
+            var show = 'named-graph-section';
+            var hide = 'default-graph-section';
+            $('selected-named-graph').update(this._graph);
+            var uri = this._graph;
+            $$('a.graph-link').each(function(link) {
+                match = link.href.match(/^(.*)[&?]graph=/);
+                if (!match) link.href = link.href + '&graph=' + uri;
+            });
+        }
+        $(hide).hide();
+        $(show).show();
+        if (effect && changed) {
+            new Effect.Highlight(show,
+                {startcolor: '#ffff00', endcolor: '#ccccff', resotrecolor: '#ccccff'});
+        }
+        $('graph-uri').disabled = (this._graph == null);
+        $('graph-uri').value = this._graph;
+    }
+
+    this.updateOutputMode = function() {
+        if (this._xsltDOM == null) {
+            this._xsltDOM = document.getElementById('xsltinput');
+        }
+        var el = document.getElementById('xsltcontainer');
+        while (el.childNodes.length > 0) {
+            el.removeChild(el.firstChild);
+        }
+        if (this._selectedOutputMode() == 'xslt') {
+            el.appendChild(this._xsltDOM);
+        }
+    }
+
+    this.resetQuery = function() {
+        document.location = this._browserBase;
+    }
+
+    this.submitQuery = function() {
+        var mode = this._selectedOutputMode();
+        if (mode == 'browse') {
+            document.getElementById('queryform').action = this._browserBase;
+        } else {
+            document.getElementById('queryform').action = this._endpoint;
+        }
+        document.getElementById('query').value = document.getElementById('querytext').value;
+        document.getElementById('jsonoutput').disabled = (mode != 'json');
+        if(mode == 'html') {
+           document.getElementById('jsonoutput').disabled = false;
+           document.getElementById('jsonoutput').value = 'html';
+        } else if(mode == 'csv') {
+            document.getElementById('jsonoutput').disabled = false;
+            document.getElementById('jsonoutput').value = 'csv';
+        } else if(mode == 'xml') {
+            document.getElementById('jsonoutput').disabled = false;
+            document.getElementById('jsonoutput').value = 'xml';
+        } else {
+           document.getElementById('jsonoutput').value = 'json';
+        }
+        document.getElementById('stylesheet').disabled = (mode != 'xslt' || !document.getElementById('xsltstylesheet').value);
+        if (mode == 'xslt') {
+            document.getElementById('stylesheet').value = document.getElementById('xsltstylesheet').value;
+        }
+        document.getElementById('queryform').submit();
+    }
+
+    this.displayBusyMessage = function() {
+        var busy = document.createElement('div');
+        busy.className = 'busy';
+        busy.appendChild(document.createTextNode('Executing query ...'));
+        this._display(busy, 'result');
+    }
+
+    this.displayErrorMessage = function(message) {
+        var pre = document.createElement('pre');
+        pre.innerHTML = message;
+        this._display(pre, 'result');
+    }
+
+    this.displayBooleanResult = function(value, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        if (value)
+        	div.appendChild(document.createTextNode("TRUE"));
+        else
+        	div.appendChild(document.createTextNode("FALSE"));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result
+    }
+    
+    this.displayRDFResult = function(model, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        div.appendChild(new RDFXMLFormatter(model));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
+    }
+
+    this.displayCSVResult = function(model, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        div.appendChild(new RDFCSVFormatter(model));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
+    }
+
+    this.displayJSONResult = function(json, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        if (json.results.bindings.length == 0) {
+            var p = document.createElement('p');
+            p.className = 'empty';
+            p.appendChild(document.createTextNode('[no results]'));
+            div.appendChild(p);
+        } else {
+            div.appendChild(new SPARQLResultFormatter(json, this._namespaces).toDOM());
+        }
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result
+    }
+
+    this._display = function(node, whereID) {
+        var where = document.getElementById(whereID);
+        if(whereID=='result')where.style.display='block';
+        if (!where) {
+            alert('ID not found: ' + whereID);
+            return;
+        }
+        while (where.firstChild) {
+            where.removeChild(where.firstChild);
+        }
+        if (node == null) return;
+        where.appendChild(node);
+    }
+
+    this._selectedOutputMode = function() {
+        return document.getElementById('selectoutput').value;
+    }
+
+    this._getPrefixes = function() {
+        prefixes = '';
+        for (prefix in this._namespaces) {
+            var uri = this._namespaces[prefix];
+            prefixes = prefixes + 'PREFIX ' + prefix + ': <' + uri + '>\n';
+        }
+        return prefixes;
+    }
+
+    this._betterUnescape = function(s) {
+        return unescape(s.replace(/\+/g, ' '));
+    }
+}
+
+/*
+ * RDFXMLFormatter
+ * 
+ * maybe improve...
+ */
+function RDFXMLFormatter(string) {
+	var pre = document.createElement('pre');
+	pre.appendChild(document.createTextNode(string));
+	return pre;
+}
+
+function RDFCSVFormatter(string) {
+    var pre = document.createElement('pre');
+    pre.appendChild(document.createTextNode(string));
+    return pre;
+}
+
+
+/*
+===========================================================================
+SPARQLResultFormatter: Renders a SPARQL/JSON result set into an HTML table.
+
+var namespaces = { 'xsd': '', 'foaf': 'http://xmlns.com/foaf/0.1' };
+var formatter = new SPARQLResultFormatter(json, namespaces);
+var tableObject = formatter.toDOM();
+*/
+function SPARQLResultFormatter(json, namespaces) {
+    this._json = json;
+    this._variables = this._json.head.vars;
+    this._results = this._json.results.bindings;
+    this._namespaces = namespaces;
+
+    this.toDOM = function() {
+        var table = document.createElement('table');
+        table.className = 'queryresults';
+        table.appendChild(this._createTableHeader());
+        for (var i = 0; i < this._results.length; i++) {
+            table.appendChild(this._createTableRow(this._results[i], i));
+        }
+        return table;
+    }
+
+    // TODO: Refactor; non-standard link makers should be passed into the class by the caller
+    this._getLinkMaker = function(varName) {
+        if (varName == 'property') {
+            return function(uri) { return '?property=' + encodeURIComponent(uri); };
+        } else if (varName == 'class') {
+            return function(uri) { return '?class=' + encodeURIComponent(uri); };
+        } else {
+            return function(uri) { return '?describe=' + encodeURIComponent(uri); };
+        }
+    }
+
+    this._createTableHeader = function() {
+        var tr = document.createElement('tr');
+        var hasNamedGraph = false;
+        for (var i = 0; i < this._variables.length; i++) {
+            var th = document.createElement('th');
+            th.appendChild(document.createTextNode(this._variables[i]));
+            tr.appendChild(th);
+            if (this._variables[i] == 'namedgraph') {
+                hasNamedGraph = true;
+            }
+        }
+        if (hasNamedGraph) {
+            var th = document.createElement('th');
+            th.appendChild(document.createTextNode(' '));
+            tr.insertBefore(th, tr.firstChild);
+        }
+        return tr;
+    }
+
+    this._createTableRow = function(binding, rowNumber) {
+        var tr = document.createElement('tr');
+        if (rowNumber % 2) {
+            tr.className = 'odd';
+        } else {
+            tr.className = 'even';
+        }
+        var namedGraph = null;
+        for (var i = 0; i < this._variables.length; i++) {
+            var varName = this._variables[i];
+            td = document.createElement('td');
+            td.appendChild(this._formatNode(binding[varName], varName));
+            tr.appendChild(td);
+            if (this._variables[i] == 'namedgraph') {
+                namedGraph = binding[varName];
+            }
+        }
+        if (namedGraph) {
+            var link = document.createElement('a');
+            link.href = 'javascript:snorql.switchToGraph(\'' + namedGraph.value + '\')';
+            link.appendChild(document.createTextNode('Switch'));
+            var td = document.createElement('td');
+            td.appendChild(link);
+            tr.insertBefore(td, tr.firstChild);
+        }
+        return tr;
+    }
+
+    this._formatNode = function(node, varName) {
+        if (!node) {
+            return this._formatUnbound(node, varName);
+        }
+        if (node.type == 'uri') {
+            return this._formatURI(node, varName);
+        }
+        if (node.type == 'bnode') {
+            return this._formatBlankNode(node, varName);
+        }
+        if (node.type == 'literal') {
+            return this._formatPlainLiteral(node, varName);
+        }
+        if (node.type == 'typed-literal') {
+            return this._formatTypedLiteral(node, varName);
+        }
+        return document.createTextNode('???');
+    }
+
+    this._formatURI = function(node, varName) {
+        var span = document.createElement('span');
+        span.className = 'uri';
+        var a = document.createElement('a');
+        a.href = this._getLinkMaker(varName)(node.value);
+        a.title = '<' + node.value + '>';
+        a.className = 'graph-link';
+        var qname = this._toQName(node.value);
+        if (qname) {
+            a.appendChild(document.createTextNode(qname));
+            span.appendChild(a);
+        } else {
+            a.appendChild(document.createTextNode(node.value));
+            span.appendChild(document.createTextNode('<'));
+            span.appendChild(a);
+            span.appendChild(document.createTextNode('>'));
+        }
+        match = node.value.match(/^(https?|ftp|mailto|irc|gopher|news):/);
+        if (match) {
+            span.appendChild(document.createTextNode(' '));
+            var externalLink = document.createElement('a');
+            externalLink.href = node.value;
+            img = document.createElement('img');
+            img.src = 'link.png';
+            img.alt = '[' + match[1] + ']';
+            img.title = 'Go to URI directly';
+            externalLink.appendChild(img);
+            span.appendChild(externalLink);
+        }
+        return span;
+    }
+
+    this._formatPlainLiteral = function(node, varName) {
+        var text = '"' + node.value + '"';
+        if (node['xml:lang']) {
+            text += '@' + node['xml:lang'];
+        }
+        return document.createTextNode(text);
+    }
+
+    this._formatTypedLiteral = function(node, varName) {
+        var text = '"' + node.value + '"';
+        if (node.datatype) {
+            text += '^^' + this._toQNameOrURI(node.datatype);
+        }
+        if (this._isNumericXSDType(node.datatype)) {
+            var span = document.createElement('span');
+            span.title = text;
+            span.appendChild(document.createTextNode(node.value));
+            return span;
+        }
+        return document.createTextNode(text);
+    }
+
+    this._formatBlankNode = function(node, varName) {
+        return document.createTextNode('_:' + node.value);
+    }
+
+    this._formatUnbound = function(node, varName) {
+        var span = document.createElement('span');
+        span.className = 'unbound';
+        span.title = 'Unbound'
+        span.appendChild(document.createTextNode('-'));
+        return span;
+    }
+
+    this._toQName = function(uri) {
+        for (prefix in this._namespaces) {
+            var nsURI = this._namespaces[prefix];
+            if (uri.indexOf(nsURI) == 0) {
+                return prefix + ':' + uri.substring(nsURI.length);
+            }
+        }
+        return null;
+    }
+
+    this._toQNameOrURI = function(uri) {
+        var qName = this._toQName(uri);
+        return (qName == null) ? '<' + uri + '>' : qName;
+    }
+
+    this._isNumericXSDType = function(datatypeURI) {
+        for (i = 0; i < this._numericXSDTypes.length; i++) {
+            if (datatypeURI == this._xsdNamespace + this._numericXSDTypes[i]) {
+                return true;
+            }
+        }
+        return false;
+    }
+    this._xsdNamespace = 'http://www.w3.org/2001/XMLSchema#';
+    this._numericXSDTypes = ['long', 'decimal', 'float', 'double', 'int',
+        'short', 'byte', 'integer', 'nonPositiveInteger', 'negativeInteger',
+        'nonNegativeInteger', 'positiveInteger', 'unsignedLong',
+        'unsignedInt', 'unsignedShort', 'unsignedByte'];
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/sparql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/sparql.js b/extras/webjars/snorql/src/main/resources/sparql.js
new file mode 100755
index 0000000..2b34538
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/sparql.js
@@ -0,0 +1,507 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**********************************************************
+  Copyright (c) 2006, 2007
+    Lee Feigenbaum ( lee AT thefigtrees DOT net )
+	Elias Torres   ( elias AT torrez DOT us )
+    Wing Yung      ( wingerz AT gmail DOT com )
+  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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+	SOFTWARE.
+**********************************************************/
+
+/**
+ * Example client interactions
+ *
+ 
+ 	var sparqler = new SPARQL.Service("http://sparql.org/sparql");
+	sparqler.addDefaultGraph("http://thefigtrees.net/lee/ldf-card"); // inherited by all (future) queries
+	sparqler.addNamedGraph("http://torrez.us/elias/foaf.rdf");
+	sparqler.setPrefix("foaf", "http://xmlns.com/foaf/0.1/"); // inherited by all (future) queries
+	sparqler.setPrefix("rdf", "http://xmlns.com/foaf/0.1/");
+	
+	sparqler.setRequestHeader("Authentication", "Basic: " + basicAuthString);
+	
+	//sparqler.wantOutputAs("application/json"); // for now we only do JSON
+
+	var query = sparqler.createQuery();
+	query.addDefualtGraph(...) query.addNamedGraph(...) query.setPrefix(...) query.setRequestHeader(...) // this query only
+
+	// query forms:
+
+	// passes standard JSON results object to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	query.query("SELECT ?who ?mbox WHERE { ldf:LDF foaf:knows ?who . ?who foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(json) { for (var x in json.head.vars) { ... } ...}}
+	);
+
+	// passes boolean value to success callback
+	query.ask("ASK ?person WHERE { ?person foaf:knows [ foaf:name "Dan Connolly" ] }",
+		{failure: onFailure, success: function(bool) { if (bool) ... }}
+	); 
+
+	// passes a single vector (array) of values representing a single column of results to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	var addresses = query.selectValues("SELECT ?mbox WHERE { _:someone foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(values) { for (var i = 0; i < values.length; i++) { ... values[i] ...} } }
+	); 
+
+	// passes a single value representing a single row of a single column (variable) to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	var myAddress = query.selectSingleValue("SELECT ?mbox WHERE {ldf:LDF foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(value) { alert("value is: " + value); } }
+	); 
+	
+	// shortcuts for all of the above (w/o ability to set any query-specific graphs or prefixes)
+	sparqler.query(...) sparqler.ask(...) sparqler.selectValues(...) sparqler.selectSingleValue(...)
+ 
+
+ */
+
+var SPARQL  = {}; // SPARQL namespace
+
+
+/**
+ * Both SPARQL service objects and SPARQL query objects receive one query utility method
+ * per entry in this dictionary. The key is the name of the method, and the value is a function
+ * that transforms the standard JSON output into a more useful form. The return value of a
+ * transformation function is passed into any 'success' callback function provided when the query
+ * is issued. The following transformations are included:
+ *   + query -- identity transform; returns the JSON structure unchanged
+ *   + ask -- for ASK queries; returns a boolean value indicating the answer to the query
+ *   + selectValues -- for SELECT queries with a single variable; returns an array containing
+ *       the answers to the query
+ *   + selectSingleValue -- for SELECT queries returning one column with one row; returns the
+ *       value in the first (and presumably, only) cell in the resultset
+ *   + selectValueArrays -- for SELECT queries returning independent columns; returns a hash
+ *       keyed on variable name with values as arrays of answers for that variable. Useful
+ *       for UNION queries.
+ *   Note that all of the transformations that return values directly lose any type information
+ *   and the ability to distinguish between URIs, blank nodes, and literals.
+ */
+SPARQL._query_transformations = {
+	query: function (o) { return o; },
+	ask: function (o) { return o["boolean"]; },
+	selectValues: function (o) {
+		var v = o.head.vars[0]; // assume one variable
+		var values = [];
+		for (var i = 0; i < o.results.bindings.length; i++)
+			values.push(o.results.bindings[i][v].value);
+		return values;
+	},
+	selectSingleValue: function(o) { return o.results.bindings[0][o.head.vars[0]].value; },
+	selectValueArrays: function(o) {
+		// factor by value (useful for UNION queries)
+		var ret = {};
+		for (var i = 0; i < o.head.vars.length; i++)
+			ret[o.head.vars[i]] = [];
+		for (var i = 0; i < o.results.bindings.length; i++)
+			for (var v in o.results.bindings[i])
+				if (ret[v] instanceof Array) ret[v].push(o.results.bindings[i][v].value);
+		return ret;
+	},
+    selectValueHashes: function(o) {
+        var hashes = [];
+        for (var i = 0; i < o.results.bindings.length; i++) {
+            var hash = {};
+            for (var v in o.results.bindings[i])
+                hash[v] = o.results.bindings[i][v].value;
+            hashes.push(hash);
+        }
+        return hashes;
+    }
+};
+
+SPARQL.statistics = {
+	queries_sent : 0,
+	successes    : 0,
+	failures     : 0
+};
+
+// A SPARQL service represents a single endpoint which implements the HTTP (GET or POST) 
+// bindings of the SPARQL Protocol. It provides convenience methods to set dataset and
+// prefix options for all queries created for this endpoint.
+SPARQL.Service = function(endpoint) {
+	//---------------
+	// private fields
+	var _endpoint = endpoint;
+	var _default_graphs = [];
+	var _named_graphs = [];
+	var _prefix_map = {};
+    var _method = 'POST';
+	var _output = 'json';
+	var _max_simultaneous = 0;
+	var _request_headers = {};
+
+	//----------
+	// accessors
+	this.endpoint = function() { return _endpoint; };
+	this.defaultGraphs = function() { return _default_graphs; };
+	this.namedGraphs = function() { return _named_graphs; };
+	this.prefixes = function() { return _prefix_map; };
+    this.method = function() { return _method; };
+    this.output = function() { return _output; };
+	this.maxSimultaneousQueries = function() { return _max_simultaneous; };
+	this.requestHeaders = function() { return _request_headers; };
+	
+	//---------
+	// mutators
+	function _add_graphs(toAdd, arr) {
+		if (toAdd instanceof Array)
+			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
+		else
+			arr.push(toAdd);
+	}
+	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
+	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
+	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
+	this.createQuery = function(p) { return new SPARQL.Query(this, p); };
+    this.setMethod = function(m) {
+        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
+        _method = m;
+    };
+	this.setOutput = function(o) { _output = o; };
+	this.setMaxSimultaneousQueries = function(m) { _max_simultaneous = m; };
+	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
+	
+	//---------------
+	// protected methods (should only be called within this module
+	this._active_queries = 0;
+	this._queued_queries = [];
+	this._next_in_queue  = 0;
+	this._canRun = function() { return this.maxSimultaneousQueries() <= 0 || this._active_queries < this.maxSimultaneousQueries();};
+	this._queue  = function(q,f, p) { 
+		if (!p) p = 0; 
+		if (p > 0) {
+			for (var i = 0; i < this._queued_queries.length; i++) {
+				if (this._queued_queries[i] != null && this._queued_queries[i][2] < p) {
+					this._queued_queries.splice(i, 0, [q, f, p]);
+					return;
+				}
+			}
+		}
+		this._queued_queries.push([q,f,p]); 
+	};
+	this._markRunning = function(q) { this._active_queries++; };
+	this._markDone    = function(q) { 
+		this._active_queries--; 
+		//document.getElementById('log').innerHTML+="query done. " + this._active_queries + " queries still active.<br>";
+		if (this._queued_queries[this._next_in_queue] != null && this._canRun()) {
+			var a = this._queued_queries[this._next_in_queue];
+			this._queued_queries[this._next_in_queue++] = null;
+			// a[0] is query object, a[1] is function to run query
+			//document.getElementById('log').innerHTML += "running query from Q<br>";
+			a[1]();
+		}
+	};
+
+	//---------------
+	// public methods
+
+	// use our varied transformations to create the various shortcut methods of actually 
+	// issuing queries without explicitly creating a query object
+	for (var query_form in SPARQL._query_transformations) {
+		// need the extra function to properly scope query_form (qf)
+		this[query_form] = (function(qf) {
+			return function(queryString, callback) {
+				var q = this.createQuery();
+				q._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
+			};
+		})(query_form);
+	}
+	
+	//------------
+	// constructor
+    
+	if (!_endpoint)
+		return null;
+	
+	return this;
+}
+
+/**
+ * A SPARQL query object should be created using the createQuery method of a SPARQL
+ * service object. It allows prefixes and datasets to be defined specifically for
+ * a single query, and provides introspective methods to see the query string and the
+ * full (HTTP GET) URL of the query.
+ */
+SPARQL.Query = function(service, priority) {
+	//---------------
+	// private fields
+	var _conn = null;
+	var _service = service;
+	var _default_graphs = clone_obj(service.defaultGraphs()); // prevent future updates from affecting us
+	var _named_graphs = clone_obj(service.namedGraphs());
+	var _prefix_map = clone_obj(service.prefixes());
+	var _user_query = ''; // doesn't include auto-generated prefix declarations
+    var _method = service.method();
+	var _output = service.output();
+	var _priority = priority || 0;
+	var _request_headers = clone_obj(service.requestHeaders());
+
+	//------------------
+	// private functions
+	function _create_json(text) {
+		if (!text)
+			return null;
+		// make sure this is safe JSON
+		// see: http://www.ietf.org/internet-drafts/draft-crockford-jsonorg-json-03.txt
+
+		// (1) strip out quoted strings
+		var no_strings = text.replace(/"(\\.|[^"\\])*"/g, '');
+		// (2) make sure that all the characters are explicitly part of the JSON grammar
+		// (in particular, note as discussed in the IETF submission, there are no assignments
+		//  or function invocations allowed by this reg. exp.)
+		var hasBadCharacter = /[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(no_strings);
+		// (3) evaluate the JSON string, returning its contents
+		if (!hasBadCharacter) {
+			try {
+				return eval('(' + text + ')');
+			} catch (e) {
+				return null;
+			}
+		}
+		return null;
+	}
+
+	function clone_obj(o) {
+		var o2 = o instanceof Array ? [] : {};
+		for(var x in o) {o2[x] = o[x];}
+		return o2;
+	}
+
+	//----------------
+	// private methods
+	this._doCallback = function(cb, which, arg) {
+		//document.getElementById('log').innerHTML += "_doCallback ... <br>";
+		var user_data = "argument" in cb ? cb.argument : null;
+		if (which in cb) {
+			if (cb.scope) {
+                cb[which].apply(cb.scope, [arg, user_data]);
+			} else {
+				cb[which](arg, user_data);
+			}
+		}
+	}
+
+	this._queryFailure = function(xhr, arg) {
+		SPARQL.statistics.failures++;
+		_service._markDone(this);
+		this._doCallback(arg.callback, 'failure', xhr /* just pass through the connection response object */);
+	};
+	this._querySuccess = function(xhr, arg) {
+        //alert(xhr.responseText);
+		SPARQL.statistics.successes++;
+		_service._markDone(this);
+		this._doCallback(arg.callback, 'success', arg.transformer(
+			_output == 'json' ? _create_json(xhr.responseText) : xhr.responseText
+		));
+	};
+
+	function getXmlHttpRequest(url) {
+		// right now, this only does Firefox (Opera? Safari?)
+		return new XMLHttpRequest();
+	}
+
+	this._doQuery = function(queryString, callback, transformer) {
+		_user_query = queryString;
+		if (_service._canRun()) {
+			try {
+				if (_method != 'POST' && _method != 'GET')
+					throw("HTTP methods other than GET and POST are not supported.");
+
+				var url = _method == 'GET' ? this.queryUrl() : this.service().endpoint();
+				var xhr = getXmlHttpRequest(url);
+				var content = null;
+
+				try {
+                    if (!document.domain || ((url.match(/^http:\/\//) && url.slice(7, document.domain.length + 7) != document.domain || url.match(/^https:\/\//) && url.slice(8, document.domain.length + 8) != document.domain) && window.netscape && netscape.security && netscape.security.PrivilegeManager)) {
+						netscape.security.PrivilegeManager.enablePrivilege( "UniversalBrowserRead");
+						netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect");
+					}
+				} catch(e) {
+					alert("Cross-site requests prohibited. You will only be able to SPARQL the origin site: " + e);
+                    return;
+				}
+
+				xhr.open(_method, url, true /* async */);
+
+				// set the headers, including the content-type for POSTed queries
+				for (var header in this.requestHeaders())
+                    if (typeof(this.requestHeaders()[header]) != "function")
+	    				xhr.setRequestHeader(header, this.requestHeaders()[header]);
+				if (_method == 'POST') {
+					xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+					content = this.queryParameters();
+				}
+
+				SPARQL.statistics.queries_sent++;
+				_service._markRunning(this);
+
+				var callbackData = {
+					scope: this,
+					success: this._querySuccess,
+					failure: this._queryFailure,
+					argument: {
+						transformer: transformer,
+						callback: callback
+					}
+				};
+
+				// I've seen some strange race-condition behavior (strange since normally
+				// JS is single-threaded, so synchronization conditions don't occur barring
+				// reentrancy) with onreadystatechange. Instead, we poll asynchronously to
+				// determine when the request is done.
+				var token = window.setInterval(
+					function () {
+						if (xhr.readyState == 4) { // ready!
+							// clear this handler
+							window.clearInterval(token);
+							// we check the status to know which callback to call
+							if (xhr.status >= 200 && xhr.status < 300)
+								callbackData.success.apply(callbackData.scope, [xhr, callbackData.argument]);
+							else
+								callbackData.failure.apply(callbackData.scope, [xhr, callbackData.argument]);
+						}
+					},
+					200 /* maybe this should be customizable */
+				);
+
+				xhr.send(content);
+			} catch (e) {
+				alert("Error sending SPARQL query: " + e);
+			}
+		} else {
+			var self = this;
+			_service._queue(self, function() { self._doQuery(queryString, callback, transformer); }, _priority);
+		}
+	};
+
+
+	//----------
+	// accessors
+	this.request = function() { return _conn; };
+	this.service = function() { return _service; };
+	this.defaultGraphs = function() { return _default_graphs; };
+	this.namedGraphs = function() { return _named_graphs; };
+	this.prefixes = function() { return _prefix_map; };
+    this.method = function() { return _method; };
+    this.requestHeaders = function() { return _request_headers; };
+
+
+    /**
+     * Returns the SPARQL query represented by this object. The parameter, which can
+     * be omitted, determines whether or not auto-generated PREFIX clauses are included
+     * in the returned query string.
+     */
+	this.queryString = function(excludePrefixes) {
+		var preamble = '';
+		if (!excludePrefixes) {
+			for (var prefix in this.prefixes()) {
+				if(typeof(this.prefixes()[prefix]) != 'string') continue;
+				preamble += 'PREFIX ' + prefix + ': <' + this.prefixes()[prefix] + '> ';
+			}
+		}
+		return preamble + _user_query;
+	};
+
+    /**
+     * Returns the HTTP query parameters to invoke this query. This includes entries for
+     * all of the default graphs, the named graphs, the SPARQL query itself, and an
+     * output parameter to specify JSON (or other) output is desired.
+     */
+	this.queryParameters = function () {
+		var urlQueryString = '';
+		var i;
+
+		// add default and named graphs to the protocol invocation
+		for (i = 0; i < this.defaultGraphs().length; i++) urlQueryString += 'default-graph-uri=' + encodeURIComponent(this.defaultGraphs()[i]) + '&';
+		for (i = 0; i < this.namedGraphs().length; i++) urlQueryString += 'named-graph-uri=' + encodeURIComponent(this.namedGraphs()[i]) + '&';
+
+		// specify JSON output (currently output= supported by latest Joseki) (or other output)
+		urlQueryString += 'output=' + _output + '&';
+		return urlQueryString + 'query=' + encodeURIComponent(this.queryString());
+	}
+	
+    /**
+     * Returns the HTTP GET URL to invoke this query. (Note that this returns a full HTTP GET URL 
+     * even if this query is set to actually use POST.)
+     */
+	this.queryUrl = function() {
+		var url = this.service().endpoint() + '?';
+		return url + this.queryParameters();
+	};
+	
+	//---------
+	// mutators
+	function _add_graphs(toAdd, arr) {
+		if (toAdd instanceof Array)
+			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
+		else
+			arr.push(toAdd);
+	}
+	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
+	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
+	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
+    this.setMethod = function(m) {
+        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
+        _method = m;
+    };
+	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
+	
+	//---------------
+	// public methods
+
+	// use our varied transformations to create the various methods of actually issuing 
+	// queries
+	for (var query_form in SPARQL._query_transformations) {
+		// need the extra function to properly scope query_form (qf)
+		this[query_form] = (function(qf) {
+			return function(queryString, callback) {
+				this._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
+			};
+		})(query_form);
+	}
+	
+
+	//------------
+	// constructor
+	
+	return this;
+}
+
+// Nothing to see here, yet.
+SPARQL.QueryUtilities = {
+};
+

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/style.css
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/style.css b/extras/webjars/snorql/src/main/resources/style.css
new file mode 100755
index 0000000..acc8746
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/style.css
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.snorql {
+    background: none repeat scroll 0 0 #eeeeee;
+    font-family: sans-serif;
+    padding: 1em 1em 5em 1em;
+    border: 2px solid #000000;
+    border-radius: 5px;
+    margin: 2em auto 10em auto;
+}
+#footer_snorql { font-size: 60%; margin: 10px 0; text-align: center; }
+.subtitle { text-align: center; margin-top: 0; }
+form { margin: 0; }
+textarea { width: 100%; margin: 10px 0;border:1px solid #999; }
+.snorql pre#prefixestext { color: #555; margin: 10px 0;  width: auto; color: inherit; background-color: inherit; border: 0; }
+img { border: none; }
+.section { margin: 15px 0 0; padding: 0; }
+.busy { color: #888; }
+.link { background: url("link.png") center right no-repeat; padding-right: 13px; }
+.queryresults { border-collapse: collapse; margin-top: 0.3em; border: 1px solid gray;}
+.queryresults td, .queryresults th { padding: 0.2em 0.4em; vertical-align: top; }
+.uri { white-space: nowrap; }
+.uri a, a.uri { text-decoration: none; }
+.unbound { color: #888; }
+.queryresults a small { font-size: 100%; }
+.queryresults small { font-size: 100%; color: #666; }
+.queryresults .property { white-space: nowrap; }
+#rdficon { float: right; margin: 0.6em 1em; }
+.directory li { margin-bottom: 0.5em; }
+.directory small { font-size: 80%; color: #666; }
+
+.snorql h2 {
+   color: #666666;
+   margin: 0;
+   padding: 0;
+}
+.result h2 {
+    margin: 5px 0;
+    color: #666666;
+}
+/* .snorql #snorql_header, .snorql .section { background: #ccf; } */
+.snorql table.queryresults th { background: #666666; color: #ffffff; font-weight: bold; }
+.snorql table.queryresults tr.odd td { background-color: #aaaaaa !important; }
+.snorql table.queryresults tr.even td { background-color: #cccccc !important; }
+
+.browser h1, .browser h2 { color: #666666; }
+.browser #header, .browser .section { background: #666666; }
+.browser table.queryresults th { background: none repeat scroll 0 0 gray; color: white; }
+.browser table.queryresults tr.odd td { background-color: #aaaaaa !important; }
+.browser table.queryresults tr.even td { background-color: #cccccc !important; }
+
+#result {
+    border: 1px solid #999;
+    font-size: 12px;
+    overflow-x: auto;
+    padding: 5px;
+    width: 98%;
+    display:none;
+    background-color: white;
+}
+
+.snorql div.CodeMirror-scroll {
+    height: auto !important;
+    overflow-y: hidden !important;
+    overflow-x: auto !important;
+}
+
+.snorql div.CodeMirror-gutter pre, .snorql div.CodeMirror-lines pre {
+    overflow: inherit !important;
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/xml-to-html.xsl b/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
new file mode 100755
index 0000000..1333027
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
@@ -0,0 +1,183 @@
+<?xml version="1.0"?>
+
+<!--
+
+XSLT script to format SPARQL Query Results XML Format into xhtml
+
+Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
+Institute of Technology, European Research Consortium for
+Informatics and Mathematics, Keio University). All Rights
+Reserved. This work is distributed under the W3C® Software
+License [1] 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.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+Version 1 : Dave Beckett (DAWG)
+Version 2 : Jeen Broekstra (DAWG)
+Customization for SPARQler: Andy Seaborne
+
+-->
+
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns="http://www.w3.org/1999/xhtml"
+		xmlns:res="http://www.w3.org/2005/sparql-results#"
+		exclude-result-prefixes="res xsl">
+
+  <!--
+    <xsl:output
+    method="html"
+    media-type="text/html"
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+    indent="yes"
+    encoding="UTF-8"/>
+  -->
+
+  <!-- or this? -->
+
+  <xsl:output
+   method="xml" 
+   indent="yes"
+   encoding="UTF-8" 
+   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+   omit-xml-declaration="no" />
+
+
+  <xsl:template name="header">
+    <div>
+      <h2>Header</h2>
+      <xsl:for-each select="res:head/res:link"> 
+	<p>Link to <xsl:value-of select="@href"/></p>
+      </xsl:for-each>
+    </div>
+  </xsl:template>
+
+  <xsl:template name="boolean-result">
+    <div>
+      <!--      
+	<h2>Boolean Result</h2>
+      -->      
+      <p>ASK => <xsl:value-of select="res:boolean"/></p>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template name="vb-result">
+    <div>
+      <!--
+	<h2>Variable Bindings Result</h2>
+	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
+	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
+      -->
+
+      <table>
+	<xsl:text>
+	</xsl:text>
+	<tr>
+	  <xsl:for-each select="res:head/res:variable">
+	    <th><xsl:value-of select="@name"/></th>
+	  </xsl:for-each>
+	</tr>
+	<xsl:text>
+	</xsl:text>
+	<xsl:for-each select="res:results/res:result">
+	  <tr>
+	    <xsl:apply-templates select="."/>
+	  </tr>
+	</xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="res:result">
+    <xsl:variable name="current" select="."/>
+    <xsl:for-each select="//res:head/res:variable">
+      <xsl:variable name="name" select="@name"/>
+      <td>
+	<xsl:choose>
+	  <xsl:when test="$current/res:binding[@name=$name]">
+	    <!-- apply template for the correct value type (bnode, uri, literal) -->
+	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!-- no binding available for this variable in this solution -->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </td>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="res:bnode">
+    <xsl:text>_:</xsl:text>
+    <xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template match="res:uri">
+    <xsl:variable name="uri" select="text()"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="$uri"/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="res:literal">
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="text()"/>
+    <xsl:text>"</xsl:text>
+
+    <xsl:choose>
+      <xsl:when test="@datatype">
+	<!-- datatyped literal value -->
+	^^&lt;<xsl:value-of select="@datatype"/>&gt;
+      </xsl:when>
+      <xsl:when test="@xml:lang">
+	<!-- lang-string -->
+	@<xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="res:sparql">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+      <head>
+	<title>SPARQL Query Results</title>
+	<style>
+	  <![CDATA[
+	  h1 { font-size: 150% ; }
+	  h2 { font-size: 125% ; }
+	  table { border-collapse: collapse ; border: 1px solid black ; }
+	  td, th
+ 	  { border: 1px solid black ;
+	    padding-left:0.5em; padding-right: 0.5em; 
+	    padding-top:0.2ex ; padding-bottom:0.2ex 
+	  }
+	  ]]>
+	</style>
+      </head>
+      <body>
+
+
+	<h1>SPARQL Query Results</h1>
+
+	<xsl:if test="res:head/res:link">
+	  <xsl:call-template name="header"/>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="res:boolean">
+	    <xsl:call-template name="boolean-result" />
+	  </xsl:when>
+
+	  <xsl:when test="res:results">
+	    <xsl:call-template name="vb-result" />
+	  </xsl:when>
+
+	</xsl:choose>
+
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d8b89a8..f6ef3f8 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -905,6 +905,26 @@
                 <version>1.8.2</version>
             </dependency>
             <dependency>
+                <groupId>org.webjars</groupId>
+                <artifactId>jquery-ui</artifactId>
+                <version>1.8.21</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.marmotta.webjars</groupId>
+                <artifactId>codemirror</artifactId>
+                <version>2.24</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.marmotta.webjars</groupId>
+                <artifactId>snorql</artifactId>
+                <version>1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.marmotta.webjars</groupId>
+                <artifactId>sgvizler</artifactId>
+                <version>0.5.1</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.marmotta</groupId>
                 <artifactId>marmotta-client-js</artifactId>
                 <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/pom.xml b/platform/marmotta-core/pom.xml
index 6f4c57c..aceb0fa 100644
--- a/platform/marmotta-core/pom.xml
+++ b/platform/marmotta-core/pom.xml
@@ -311,6 +311,10 @@
             <artifactId>jquery</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>sgvizler</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.marmotta</groupId>
             <artifactId>marmotta-client-js</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/configuration.html b/platform/marmotta-core/src/main/resources/web/admin/configuration.html
index 928a336..63dc95c 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/configuration.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/configuration.html
@@ -22,7 +22,7 @@
 <!--###BEGIN_HEAD###-->
     <title>Core Module Configuration</title>
     <link type="text/css" rel="stylesheet" href="../public/js/widgets/configurator/style.css">
-    <script type="text/javascript" src="../public/js/lib/jquery-1.7.2.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="../public/js/widgets/configurator/configurator.js"></script>
     <script type="text/javascript" src="js/widgets/database.js"></script>
     <script type="text/javascript">

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/dataview.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/dataview.html b/platform/marmotta-core/src/main/resources/web/admin/dataview.html
index eec7574..850534f 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/dataview.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/dataview.html
@@ -23,9 +23,9 @@
 <!--###BEGIN_HEAD###-->
     <title>Data Views</title>
     <meta charset="UTF-8"/>
-    <script type="text/javascript" src="../public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="https://www.google.com/jsapi"></script>
-    <script type="text/javascript" src="js/lib/sgvizler.pack.js"></script>
+    <script type="text/javascript" src="../../webjars/sgvizler/0.5.1/sgvizler.js" id="sgvzlr_script" ></script>
     <script type="text/javascript">
 
         var HAS_DATA = true;
@@ -36,7 +36,7 @@
                         'blue','red','orange','green','navy','Crimson','DarkGreen','DarkTurquoise','DodgerBlue','OliveDrab','pink','violet',
                         'GoldenRod','Fuchsia','Darkorange','DarkSlateBlue','GreenYellow','LightSeaGreen','Maroon','MediumVioletRed']
 
-        sgvizler.option.libfolder = "js/lib/";
+        sgvizler.option.libfolder = "../../webjars/sgvizler/0.5.1/lib";
 
         sgvizler.option.stylepath = _SERVER_URL + _CURRENT_STYLE;
 
@@ -237,7 +237,7 @@
                 drawGraphs();
                 drawClasses();
             }
-        });
+    });
 
     </script>
     <style type="text/css">

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/export.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/export.html b/platform/marmotta-core/src/main/resources/web/admin/export.html
index cb9f40d..295fa56 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/export.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/export.html
@@ -21,7 +21,7 @@
 <head>
 <!--###BEGIN_HEAD###-->
     <title>Exporter</title>
-    <script type="text/javascript" src="../public/js/lib/jquery-1.7.2.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
 
     <script type="text/javascript">
         var updateDownloadLink = function() {


[04/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.js
deleted file mode 100755
index 620fa1e..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.js
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var snorql = new Snorql();
-
-String.prototype.trim = function () {
-    return this.replace(/^\s*/, "").replace(/\s*$/, "");
-}
-
-String.prototype.startsWith = function(str) {
-	return (this.match("^"+str) == str);
-}
-
-function Snorql() {
-    // modify this._endpoint to point to your SPARQL endpoint
-    this._endpoint = _BASIC_URL + 'sparql/select';
-    // modify these to your liking
-    this._poweredByLink = 'http://marmotta.incubator.apache.org';
-    this._poweredByLabel = 'Snorql & Apache Marmotta';
-    this._enableNamedGraphs = false;
-
-    this._browserBase = null;
-    this._namespaces = {};
-    this._graph = null;
-    this._xsltDOM = null;
-
-    this.start = function() {
-        // TODO: Extract a QueryType class
-        this.setBrowserBase(document.location.href.replace(/\?.*/, ''));
-        this._displayEndpointURL();
-        //this._displayPoweredBy();
-        this.updateOutputMode();
-        var match = document.location.href.match(/\?(.*)/);
-        var queryString = match ? match[1] : '';
-        if (!queryString) {
-            document.getElementById('querytext').value = 'SELECT * WHERE {\n  ?s ?p ?o\n}\nLIMIT 10';
-            this._updateGraph(null, false);
-            return;
-        }
-        
-        var graph = queryString.match(/graph=([^&]*)/);
-        graph = graph ? decodeURIComponent(graph[1]) : null;
-        this._updateGraph(graph, false);
-        
-        var browse = queryString.match(/browse=([^&]*)/);
-        if (browse) {
-	        if (browse[1] == 'classes') {
-	            var resultTitle = 'List of all classes:';
-	            var query = 'SELECT DISTINCT ?class\n' +
-	                    'WHERE { [] a ?class }\n' +
-	                    'ORDER BY ?class';
-	        } else if (browse[1] == 'properties') {
-	            var resultTitle = 'List of all properties:';
-	            var query = 'SELECT DISTINCT ?property\n' +
-	                    'WHERE { [] ?property [] }\n' +
-	                    'ORDER BY ?property';
-	        } else if (browse[1] == 'graphs') {
-	            var resultTitle = 'List of all named graphs:';
-	            var query = 'SELECT DISTINCT ?namedgraph ?label\n' +
-	                    'WHERE {\n' +
-	                    '  GRAPH ?namedgraph { ?s ?p ?o }\n' +
-	                    '  OPTIONAL { ?namedgraph rdfs:label ?label }\n' +
-	                    '}\n' +
-	                    'ORDER BY ?namedgraph';
-	        }
-        }
-        
-        var properties = queryString.match(/property=([^&]*)/);
-        if (properties) {
-            var resultTitle = 'All uses of property ' + decodeURIComponent(properties[1]) + ':';
-            var query = 'SELECT DISTINCT ?resource ?value\n' +
-                    'WHERE { ?resource <' + decodeURIComponent(properties[1]) + '> ?value }\n' +
-                    'ORDER BY ?resource ?value';
-        }
-        
-        var classes = queryString.match(/class=([^&]*)/);
-        if (classes) {
-            var resultTitle = 'All instances of class ' + decodeURIComponent(classes[1]) + ':';
-            var query = 'SELECT DISTINCT ?instance\n' +
-                    'WHERE { ?instance a <' + decodeURIComponent(classes[1]) + '> }\n' +
-                    'ORDER BY ?instance';
-        }
-        
-        var describe = queryString.match(/describe=([^&]*)/);
-        if (describe) {
-            var resultTitle = 'Description of ' + decodeURIComponent(describe[1]) + ':';
-            var query = 'SELECT DISTINCT ?property ?hasValue ?isValueOf\n' +
-                    'WHERE {\n' +
-                    '  { <' + decodeURIComponent(describe[1]) + '> ?property ?hasValue }\n' +
-                    '  UNION\n' +
-                    '  { ?isValueOf ?property <' + decodeURIComponent(describe[1]) + '> }\n' +
-                    '}\n' +
-                    'ORDER BY (!BOUND(?hasValue)) ?property ?hasValue ?isValueOf';
-        }
-        
-        var queryMatch = queryString.match(/query=([^&]*)/);
-        if (queryMatch) {
-        	var resultTitle = 'SPARQL results:';
-        	var query = this._betterUnescape(queryMatch[1]);
-        
-        }
-        
-        var prefixes = this._getPrefixes();
-        if (queryString.match(/prefixes=/)) {
-        	prefixes = this._betterUnescape(queryString.match(/prefixes=([^&]*)/)[1]);
-        }
-        
-        var querytext = prefixes + " " + query;
-        document.getElementById('querytext').value = query;
-        this.displayBusyMessage();
-        var service = new SPARQL.Service(this._endpoint);
-        if (this._graph) {
-            service.addDefaultGraph(this._graph);
-        }
-
-        // AndyL changed MIME type and success callback depending on query form...
-        var dummy = this;
-
-   	    var exp = /^\s*(?:PREFIX\s+\w*:\s+<[^>]*>\s*)*(\w+)\s*.*/i;
-   	    var match = exp.exec(query);
-   	    if (match) {
-	        if (match[1].toUpperCase() == 'ASK') {
-	        	service.setOutput('boolean');
-	        	var successFunc = function(value) {
-	                dummy.displayBooleanResult(value, resultTitle);
-	            };
-	        } else if (match[1].toUpperCase() == 'CONSTRUCT' || match[1].toUpperCase() == 'DESCRIBE'){ // construct describe
-	    		service.setOutput('rdf'); // !json
-	    		var successFunc = function(model) {
-	                dummy.displayRDFResult(model, resultTitle);
-	            };
-	        } else {
-	        	service.setRequestHeader('Accept', 'application/sparql-results+json,*/*');
-	        	service.setOutput('json');
-	        	var successFunc = function(json) {
-	        		dummy.displayJSONResult(json, resultTitle);
-	        	};
-	        }
-   	    }
-
-        service.query(querytext, {
-            success: successFunc,
-            failure: function(report) {
-                var message = report.responseText.match(/<pre>([\s\S]*)<\/pre>/);
-                if (message) {
-                    dummy.displayErrorMessage(message[1]);
-                } else {
-                    dummy.displayErrorMessage(report.responseText);
-                }
-            }
-        });
-    }
-
-    this.setBrowserBase = function(url) {
-        this._browserBase = url;
-    }
-
-    this._displayEndpointURL = function() {
-    	var title = document.createElement("span");
-    	title.innerHTML = 'Querying <a href="' + this._endpoint + '">' + this._endpoint + '</a>';
-        this._display(title, 'title');
-        document.title = "Querying " + this._endpoint;
-    }
-
-    this._displayPoweredBy = function() {
-        $('poweredby').href = this._poweredByLink;
-        $('poweredby').update(this._poweredByLabel);
-    }
-
-    this.setNamespaces = function(namespaces) {
-        this._namespaces = namespaces;
-        var prefixes = this._getPrefixes();
-        document.getElementById('prefixes').value = prefixes;
-        this._display(document.createTextNode(prefixes), 'prefixestext');
-    }
-
-    this.switchToGraph = function(uri) {
-        this._updateGraph(uri, true);
-    }
-
-    this.switchToDefaultGraph = function() {
-        this._updateGraph(null, true);
-    }
-
-    this._updateGraph = function(uri, effect) {
-        if (!this._enableNamedGraphs) {
-            $('default-graph-section').hide();
-            $('named-graph-section').hide();
-            $('browse-named-graphs-link').hide();
-            return;
-        }
-        var changed = (uri != this._graph);
-        this._graph = uri;
-        var el = document.getElementById('graph-uri');
-        el.disabled = (this._graph == null);
-        el.value = this._graph;
-        if (this._graph == null) {
-            var show = 'default-graph-section';
-            var hide = 'named-graph-section';
-            $$('a.graph-link').each(function(link) {
-                match = link.href.match(/^(.*)[&?]graph=/);
-                if (match) link.href = match[1];
-            });
-        } else {
-            var show = 'named-graph-section';
-            var hide = 'default-graph-section';
-            $('selected-named-graph').update(this._graph);
-            var uri = this._graph;
-            $$('a.graph-link').each(function(link) {
-                match = link.href.match(/^(.*)[&?]graph=/);
-                if (!match) link.href = link.href + '&graph=' + uri;
-            });
-        }
-        $(hide).hide();
-        $(show).show();
-        if (effect && changed) {
-            new Effect.Highlight(show,
-                {startcolor: '#ffff00', endcolor: '#ccccff', resotrecolor: '#ccccff'});
-        }
-        $('graph-uri').disabled = (this._graph == null);
-        $('graph-uri').value = this._graph;
-    }
-
-    this.updateOutputMode = function() {
-        if (this._xsltDOM == null) {
-            this._xsltDOM = document.getElementById('xsltinput');
-        }
-        var el = document.getElementById('xsltcontainer');
-        while (el.childNodes.length > 0) {
-            el.removeChild(el.firstChild);
-        }
-        if (this._selectedOutputMode() == 'xslt') {
-            el.appendChild(this._xsltDOM);
-        }
-    }
-
-    this.resetQuery = function() {
-        document.location = this._browserBase;
-    }
-
-    this.submitQuery = function() {
-        var mode = this._selectedOutputMode();
-        if (mode == 'browse') {
-            document.getElementById('queryform').action = this._browserBase;
-        } else {
-            document.getElementById('queryform').action = this._endpoint;
-        }
-        document.getElementById('query').value = document.getElementById('querytext').value;
-        document.getElementById('jsonoutput').disabled = (mode != 'json');
-        if(mode == 'html') {
-           document.getElementById('jsonoutput').disabled = false;
-           document.getElementById('jsonoutput').value = 'html';
-        } else if(mode == 'csv') {
-            document.getElementById('jsonoutput').disabled = false;
-            document.getElementById('jsonoutput').value = 'csv';
-        } else if(mode == 'xml') {
-            document.getElementById('jsonoutput').disabled = false;
-            document.getElementById('jsonoutput').value = 'xml';
-        } else {
-           document.getElementById('jsonoutput').value = 'json';
-        }
-        document.getElementById('stylesheet').disabled = (mode != 'xslt' || !document.getElementById('xsltstylesheet').value);
-        if (mode == 'xslt') {
-            document.getElementById('stylesheet').value = document.getElementById('xsltstylesheet').value;
-        }
-        document.getElementById('queryform').submit();
-    }
-
-    this.displayBusyMessage = function() {
-        var busy = document.createElement('div');
-        busy.className = 'busy';
-        busy.appendChild(document.createTextNode('Executing query ...'));
-        this._display(busy, 'result');
-    }
-
-    this.displayErrorMessage = function(message) {
-        var pre = document.createElement('pre');
-        pre.innerHTML = message;
-        this._display(pre, 'result');
-    }
-
-    this.displayBooleanResult = function(value, resultTitle) {
-        var div = document.createElement('div');
-        var title = document.createElement('h2');
-        title.appendChild(document.createTextNode(resultTitle));
-        div.appendChild(title);
-        if (value)
-        	div.appendChild(document.createTextNode("TRUE"));
-        else
-        	div.appendChild(document.createTextNode("FALSE"));
-        this._display(div, 'result');
-        this._updateGraph(this._graph); // refresh links in new result
-    }
-    
-    this.displayRDFResult = function(model, resultTitle) {
-        var div = document.createElement('div');
-        var title = document.createElement('h2');
-        title.appendChild(document.createTextNode(resultTitle));
-        div.appendChild(title);
-        div.appendChild(new RDFXMLFormatter(model));
-        this._display(div, 'result');
-        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
-    }
-
-    this.displayCSVResult = function(model, resultTitle) {
-        var div = document.createElement('div');
-        var title = document.createElement('h2');
-        title.appendChild(document.createTextNode(resultTitle));
-        div.appendChild(title);
-        div.appendChild(new RDFCSVFormatter(model));
-        this._display(div, 'result');
-        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
-    }
-
-    this.displayJSONResult = function(json, resultTitle) {
-        var div = document.createElement('div');
-        var title = document.createElement('h2');
-        title.appendChild(document.createTextNode(resultTitle));
-        div.appendChild(title);
-        if (json.results.bindings.length == 0) {
-            var p = document.createElement('p');
-            p.className = 'empty';
-            p.appendChild(document.createTextNode('[no results]'));
-            div.appendChild(p);
-        } else {
-            div.appendChild(new SPARQLResultFormatter(json, this._namespaces).toDOM());
-        }
-        this._display(div, 'result');
-        this._updateGraph(this._graph); // refresh links in new result
-    }
-
-    this._display = function(node, whereID) {
-        var where = document.getElementById(whereID);
-        if(whereID=='result')where.style.display='block';
-        if (!where) {
-            alert('ID not found: ' + whereID);
-            return;
-        }
-        while (where.firstChild) {
-            where.removeChild(where.firstChild);
-        }
-        if (node == null) return;
-        where.appendChild(node);
-    }
-
-    this._selectedOutputMode = function() {
-        return document.getElementById('selectoutput').value;
-    }
-
-    this._getPrefixes = function() {
-        prefixes = '';
-        for (prefix in this._namespaces) {
-            var uri = this._namespaces[prefix];
-            prefixes = prefixes + 'PREFIX ' + prefix + ': <' + uri + '>\n';
-        }
-        return prefixes;
-    }
-
-    this._betterUnescape = function(s) {
-        return unescape(s.replace(/\+/g, ' '));
-    }
-}
-
-/*
- * RDFXMLFormatter
- * 
- * maybe improve...
- */
-function RDFXMLFormatter(string) {
-	var pre = document.createElement('pre');
-	pre.appendChild(document.createTextNode(string));
-	return pre;
-}
-
-function RDFCSVFormatter(string) {
-    var pre = document.createElement('pre');
-    pre.appendChild(document.createTextNode(string));
-    return pre;
-}
-
-
-/*
-===========================================================================
-SPARQLResultFormatter: Renders a SPARQL/JSON result set into an HTML table.
-
-var namespaces = { 'xsd': '', 'foaf': 'http://xmlns.com/foaf/0.1' };
-var formatter = new SPARQLResultFormatter(json, namespaces);
-var tableObject = formatter.toDOM();
-*/
-function SPARQLResultFormatter(json, namespaces) {
-    this._json = json;
-    this._variables = this._json.head.vars;
-    this._results = this._json.results.bindings;
-    this._namespaces = namespaces;
-
-    this.toDOM = function() {
-        var table = document.createElement('table');
-        table.className = 'queryresults';
-        table.appendChild(this._createTableHeader());
-        for (var i = 0; i < this._results.length; i++) {
-            table.appendChild(this._createTableRow(this._results[i], i));
-        }
-        return table;
-    }
-
-    // TODO: Refactor; non-standard link makers should be passed into the class by the caller
-    this._getLinkMaker = function(varName) {
-        if (varName == 'property') {
-            return function(uri) { return '?property=' + encodeURIComponent(uri); };
-        } else if (varName == 'class') {
-            return function(uri) { return '?class=' + encodeURIComponent(uri); };
-        } else {
-            return function(uri) { return '?describe=' + encodeURIComponent(uri); };
-        }
-    }
-
-    this._createTableHeader = function() {
-        var tr = document.createElement('tr');
-        var hasNamedGraph = false;
-        for (var i = 0; i < this._variables.length; i++) {
-            var th = document.createElement('th');
-            th.appendChild(document.createTextNode(this._variables[i]));
-            tr.appendChild(th);
-            if (this._variables[i] == 'namedgraph') {
-                hasNamedGraph = true;
-            }
-        }
-        if (hasNamedGraph) {
-            var th = document.createElement('th');
-            th.appendChild(document.createTextNode(' '));
-            tr.insertBefore(th, tr.firstChild);
-        }
-        return tr;
-    }
-
-    this._createTableRow = function(binding, rowNumber) {
-        var tr = document.createElement('tr');
-        if (rowNumber % 2) {
-            tr.className = 'odd';
-        } else {
-            tr.className = 'even';
-        }
-        var namedGraph = null;
-        for (var i = 0; i < this._variables.length; i++) {
-            var varName = this._variables[i];
-            td = document.createElement('td');
-            td.appendChild(this._formatNode(binding[varName], varName));
-            tr.appendChild(td);
-            if (this._variables[i] == 'namedgraph') {
-                namedGraph = binding[varName];
-            }
-        }
-        if (namedGraph) {
-            var link = document.createElement('a');
-            link.href = 'javascript:snorql.switchToGraph(\'' + namedGraph.value + '\')';
-            link.appendChild(document.createTextNode('Switch'));
-            var td = document.createElement('td');
-            td.appendChild(link);
-            tr.insertBefore(td, tr.firstChild);
-        }
-        return tr;
-    }
-
-    this._formatNode = function(node, varName) {
-        if (!node) {
-            return this._formatUnbound(node, varName);
-        }
-        if (node.type == 'uri') {
-            return this._formatURI(node, varName);
-        }
-        if (node.type == 'bnode') {
-            return this._formatBlankNode(node, varName);
-        }
-        if (node.type == 'literal') {
-            return this._formatPlainLiteral(node, varName);
-        }
-        if (node.type == 'typed-literal') {
-            return this._formatTypedLiteral(node, varName);
-        }
-        return document.createTextNode('???');
-    }
-
-    this._formatURI = function(node, varName) {
-        var span = document.createElement('span');
-        span.className = 'uri';
-        var a = document.createElement('a');
-        a.href = this._getLinkMaker(varName)(node.value);
-        a.title = '<' + node.value + '>';
-        a.className = 'graph-link';
-        var qname = this._toQName(node.value);
-        if (qname) {
-            a.appendChild(document.createTextNode(qname));
-            span.appendChild(a);
-        } else {
-            a.appendChild(document.createTextNode(node.value));
-            span.appendChild(document.createTextNode('<'));
-            span.appendChild(a);
-            span.appendChild(document.createTextNode('>'));
-        }
-        match = node.value.match(/^(https?|ftp|mailto|irc|gopher|news):/);
-        if (match) {
-            span.appendChild(document.createTextNode(' '));
-            var externalLink = document.createElement('a');
-            externalLink.href = node.value;
-            img = document.createElement('img');
-            img.src = 'link.png';
-            img.alt = '[' + match[1] + ']';
-            img.title = 'Go to URI directly';
-            externalLink.appendChild(img);
-            span.appendChild(externalLink);
-        }
-        return span;
-    }
-
-    this._formatPlainLiteral = function(node, varName) {
-        var text = '"' + node.value + '"';
-        if (node['xml:lang']) {
-            text += '@' + node['xml:lang'];
-        }
-        return document.createTextNode(text);
-    }
-
-    this._formatTypedLiteral = function(node, varName) {
-        var text = '"' + node.value + '"';
-        if (node.datatype) {
-            text += '^^' + this._toQNameOrURI(node.datatype);
-        }
-        if (this._isNumericXSDType(node.datatype)) {
-            var span = document.createElement('span');
-            span.title = text;
-            span.appendChild(document.createTextNode(node.value));
-            return span;
-        }
-        return document.createTextNode(text);
-    }
-
-    this._formatBlankNode = function(node, varName) {
-        return document.createTextNode('_:' + node.value);
-    }
-
-    this._formatUnbound = function(node, varName) {
-        var span = document.createElement('span');
-        span.className = 'unbound';
-        span.title = 'Unbound'
-        span.appendChild(document.createTextNode('-'));
-        return span;
-    }
-
-    this._toQName = function(uri) {
-        for (prefix in this._namespaces) {
-            var nsURI = this._namespaces[prefix];
-            if (uri.indexOf(nsURI) == 0) {
-                return prefix + ':' + uri.substring(nsURI.length);
-            }
-        }
-        return null;
-    }
-
-    this._toQNameOrURI = function(uri) {
-        var qName = this._toQName(uri);
-        return (qName == null) ? '<' + uri + '>' : qName;
-    }
-
-    this._isNumericXSDType = function(datatypeURI) {
-        for (i = 0; i < this._numericXSDTypes.length; i++) {
-            if (datatypeURI == this._xsdNamespace + this._numericXSDTypes[i]) {
-                return true;
-            }
-        }
-        return false;
-    }
-    this._xsdNamespace = 'http://www.w3.org/2001/XMLSchema#';
-    this._numericXSDTypes = ['long', 'decimal', 'float', 'double', 'int',
-        'short', 'byte', 'integer', 'nonPositiveInteger', 'negativeInteger',
-        'nonNegativeInteger', 'positiveInteger', 'unsignedLong',
-        'unsignedInt', 'unsignedShort', 'unsignedByte'];
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/sparql.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/sparql.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/sparql.js
deleted file mode 100755
index 2b34538..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/sparql.js
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**********************************************************
-  Copyright (c) 2006, 2007
-    Lee Feigenbaum ( lee AT thefigtrees DOT net )
-	Elias Torres   ( elias AT torrez DOT us )
-    Wing Yung      ( wingerz AT gmail DOT com )
-  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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-	SOFTWARE.
-**********************************************************/
-
-/**
- * Example client interactions
- *
- 
- 	var sparqler = new SPARQL.Service("http://sparql.org/sparql");
-	sparqler.addDefaultGraph("http://thefigtrees.net/lee/ldf-card"); // inherited by all (future) queries
-	sparqler.addNamedGraph("http://torrez.us/elias/foaf.rdf");
-	sparqler.setPrefix("foaf", "http://xmlns.com/foaf/0.1/"); // inherited by all (future) queries
-	sparqler.setPrefix("rdf", "http://xmlns.com/foaf/0.1/");
-	
-	sparqler.setRequestHeader("Authentication", "Basic: " + basicAuthString);
-	
-	//sparqler.wantOutputAs("application/json"); // for now we only do JSON
-
-	var query = sparqler.createQuery();
-	query.addDefualtGraph(...) query.addNamedGraph(...) query.setPrefix(...) query.setRequestHeader(...) // this query only
-
-	// query forms:
-
-	// passes standard JSON results object to success callback
-	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
-	query.query("SELECT ?who ?mbox WHERE { ldf:LDF foaf:knows ?who . ?who foaf:mbox ?mbox }",
-		{failure: onFailure, success: function(json) { for (var x in json.head.vars) { ... } ...}}
-	);
-
-	// passes boolean value to success callback
-	query.ask("ASK ?person WHERE { ?person foaf:knows [ foaf:name "Dan Connolly" ] }",
-		{failure: onFailure, success: function(bool) { if (bool) ... }}
-	); 
-
-	// passes a single vector (array) of values representing a single column of results to success callback
-	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
-	var addresses = query.selectValues("SELECT ?mbox WHERE { _:someone foaf:mbox ?mbox }",
-		{failure: onFailure, success: function(values) { for (var i = 0; i < values.length; i++) { ... values[i] ...} } }
-	); 
-
-	// passes a single value representing a single row of a single column (variable) to success callback
-	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
-	var myAddress = query.selectSingleValue("SELECT ?mbox WHERE {ldf:LDF foaf:mbox ?mbox }",
-		{failure: onFailure, success: function(value) { alert("value is: " + value); } }
-	); 
-	
-	// shortcuts for all of the above (w/o ability to set any query-specific graphs or prefixes)
-	sparqler.query(...) sparqler.ask(...) sparqler.selectValues(...) sparqler.selectSingleValue(...)
- 
-
- */
-
-var SPARQL  = {}; // SPARQL namespace
-
-
-/**
- * Both SPARQL service objects and SPARQL query objects receive one query utility method
- * per entry in this dictionary. The key is the name of the method, and the value is a function
- * that transforms the standard JSON output into a more useful form. The return value of a
- * transformation function is passed into any 'success' callback function provided when the query
- * is issued. The following transformations are included:
- *   + query -- identity transform; returns the JSON structure unchanged
- *   + ask -- for ASK queries; returns a boolean value indicating the answer to the query
- *   + selectValues -- for SELECT queries with a single variable; returns an array containing
- *       the answers to the query
- *   + selectSingleValue -- for SELECT queries returning one column with one row; returns the
- *       value in the first (and presumably, only) cell in the resultset
- *   + selectValueArrays -- for SELECT queries returning independent columns; returns a hash
- *       keyed on variable name with values as arrays of answers for that variable. Useful
- *       for UNION queries.
- *   Note that all of the transformations that return values directly lose any type information
- *   and the ability to distinguish between URIs, blank nodes, and literals.
- */
-SPARQL._query_transformations = {
-	query: function (o) { return o; },
-	ask: function (o) { return o["boolean"]; },
-	selectValues: function (o) {
-		var v = o.head.vars[0]; // assume one variable
-		var values = [];
-		for (var i = 0; i < o.results.bindings.length; i++)
-			values.push(o.results.bindings[i][v].value);
-		return values;
-	},
-	selectSingleValue: function(o) { return o.results.bindings[0][o.head.vars[0]].value; },
-	selectValueArrays: function(o) {
-		// factor by value (useful for UNION queries)
-		var ret = {};
-		for (var i = 0; i < o.head.vars.length; i++)
-			ret[o.head.vars[i]] = [];
-		for (var i = 0; i < o.results.bindings.length; i++)
-			for (var v in o.results.bindings[i])
-				if (ret[v] instanceof Array) ret[v].push(o.results.bindings[i][v].value);
-		return ret;
-	},
-    selectValueHashes: function(o) {
-        var hashes = [];
-        for (var i = 0; i < o.results.bindings.length; i++) {
-            var hash = {};
-            for (var v in o.results.bindings[i])
-                hash[v] = o.results.bindings[i][v].value;
-            hashes.push(hash);
-        }
-        return hashes;
-    }
-};
-
-SPARQL.statistics = {
-	queries_sent : 0,
-	successes    : 0,
-	failures     : 0
-};
-
-// A SPARQL service represents a single endpoint which implements the HTTP (GET or POST) 
-// bindings of the SPARQL Protocol. It provides convenience methods to set dataset and
-// prefix options for all queries created for this endpoint.
-SPARQL.Service = function(endpoint) {
-	//---------------
-	// private fields
-	var _endpoint = endpoint;
-	var _default_graphs = [];
-	var _named_graphs = [];
-	var _prefix_map = {};
-    var _method = 'POST';
-	var _output = 'json';
-	var _max_simultaneous = 0;
-	var _request_headers = {};
-
-	//----------
-	// accessors
-	this.endpoint = function() { return _endpoint; };
-	this.defaultGraphs = function() { return _default_graphs; };
-	this.namedGraphs = function() { return _named_graphs; };
-	this.prefixes = function() { return _prefix_map; };
-    this.method = function() { return _method; };
-    this.output = function() { return _output; };
-	this.maxSimultaneousQueries = function() { return _max_simultaneous; };
-	this.requestHeaders = function() { return _request_headers; };
-	
-	//---------
-	// mutators
-	function _add_graphs(toAdd, arr) {
-		if (toAdd instanceof Array)
-			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
-		else
-			arr.push(toAdd);
-	}
-	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
-	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
-	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
-	this.createQuery = function(p) { return new SPARQL.Query(this, p); };
-    this.setMethod = function(m) {
-        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
-        _method = m;
-    };
-	this.setOutput = function(o) { _output = o; };
-	this.setMaxSimultaneousQueries = function(m) { _max_simultaneous = m; };
-	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
-	
-	//---------------
-	// protected methods (should only be called within this module
-	this._active_queries = 0;
-	this._queued_queries = [];
-	this._next_in_queue  = 0;
-	this._canRun = function() { return this.maxSimultaneousQueries() <= 0 || this._active_queries < this.maxSimultaneousQueries();};
-	this._queue  = function(q,f, p) { 
-		if (!p) p = 0; 
-		if (p > 0) {
-			for (var i = 0; i < this._queued_queries.length; i++) {
-				if (this._queued_queries[i] != null && this._queued_queries[i][2] < p) {
-					this._queued_queries.splice(i, 0, [q, f, p]);
-					return;
-				}
-			}
-		}
-		this._queued_queries.push([q,f,p]); 
-	};
-	this._markRunning = function(q) { this._active_queries++; };
-	this._markDone    = function(q) { 
-		this._active_queries--; 
-		//document.getElementById('log').innerHTML+="query done. " + this._active_queries + " queries still active.<br>";
-		if (this._queued_queries[this._next_in_queue] != null && this._canRun()) {
-			var a = this._queued_queries[this._next_in_queue];
-			this._queued_queries[this._next_in_queue++] = null;
-			// a[0] is query object, a[1] is function to run query
-			//document.getElementById('log').innerHTML += "running query from Q<br>";
-			a[1]();
-		}
-	};
-
-	//---------------
-	// public methods
-
-	// use our varied transformations to create the various shortcut methods of actually 
-	// issuing queries without explicitly creating a query object
-	for (var query_form in SPARQL._query_transformations) {
-		// need the extra function to properly scope query_form (qf)
-		this[query_form] = (function(qf) {
-			return function(queryString, callback) {
-				var q = this.createQuery();
-				q._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
-			};
-		})(query_form);
-	}
-	
-	//------------
-	// constructor
-    
-	if (!_endpoint)
-		return null;
-	
-	return this;
-}
-
-/**
- * A SPARQL query object should be created using the createQuery method of a SPARQL
- * service object. It allows prefixes and datasets to be defined specifically for
- * a single query, and provides introspective methods to see the query string and the
- * full (HTTP GET) URL of the query.
- */
-SPARQL.Query = function(service, priority) {
-	//---------------
-	// private fields
-	var _conn = null;
-	var _service = service;
-	var _default_graphs = clone_obj(service.defaultGraphs()); // prevent future updates from affecting us
-	var _named_graphs = clone_obj(service.namedGraphs());
-	var _prefix_map = clone_obj(service.prefixes());
-	var _user_query = ''; // doesn't include auto-generated prefix declarations
-    var _method = service.method();
-	var _output = service.output();
-	var _priority = priority || 0;
-	var _request_headers = clone_obj(service.requestHeaders());
-
-	//------------------
-	// private functions
-	function _create_json(text) {
-		if (!text)
-			return null;
-		// make sure this is safe JSON
-		// see: http://www.ietf.org/internet-drafts/draft-crockford-jsonorg-json-03.txt
-
-		// (1) strip out quoted strings
-		var no_strings = text.replace(/"(\\.|[^"\\])*"/g, '');
-		// (2) make sure that all the characters are explicitly part of the JSON grammar
-		// (in particular, note as discussed in the IETF submission, there are no assignments
-		//  or function invocations allowed by this reg. exp.)
-		var hasBadCharacter = /[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(no_strings);
-		// (3) evaluate the JSON string, returning its contents
-		if (!hasBadCharacter) {
-			try {
-				return eval('(' + text + ')');
-			} catch (e) {
-				return null;
-			}
-		}
-		return null;
-	}
-
-	function clone_obj(o) {
-		var o2 = o instanceof Array ? [] : {};
-		for(var x in o) {o2[x] = o[x];}
-		return o2;
-	}
-
-	//----------------
-	// private methods
-	this._doCallback = function(cb, which, arg) {
-		//document.getElementById('log').innerHTML += "_doCallback ... <br>";
-		var user_data = "argument" in cb ? cb.argument : null;
-		if (which in cb) {
-			if (cb.scope) {
-                cb[which].apply(cb.scope, [arg, user_data]);
-			} else {
-				cb[which](arg, user_data);
-			}
-		}
-	}
-
-	this._queryFailure = function(xhr, arg) {
-		SPARQL.statistics.failures++;
-		_service._markDone(this);
-		this._doCallback(arg.callback, 'failure', xhr /* just pass through the connection response object */);
-	};
-	this._querySuccess = function(xhr, arg) {
-        //alert(xhr.responseText);
-		SPARQL.statistics.successes++;
-		_service._markDone(this);
-		this._doCallback(arg.callback, 'success', arg.transformer(
-			_output == 'json' ? _create_json(xhr.responseText) : xhr.responseText
-		));
-	};
-
-	function getXmlHttpRequest(url) {
-		// right now, this only does Firefox (Opera? Safari?)
-		return new XMLHttpRequest();
-	}
-
-	this._doQuery = function(queryString, callback, transformer) {
-		_user_query = queryString;
-		if (_service._canRun()) {
-			try {
-				if (_method != 'POST' && _method != 'GET')
-					throw("HTTP methods other than GET and POST are not supported.");
-
-				var url = _method == 'GET' ? this.queryUrl() : this.service().endpoint();
-				var xhr = getXmlHttpRequest(url);
-				var content = null;
-
-				try {
-                    if (!document.domain || ((url.match(/^http:\/\//) && url.slice(7, document.domain.length + 7) != document.domain || url.match(/^https:\/\//) && url.slice(8, document.domain.length + 8) != document.domain) && window.netscape && netscape.security && netscape.security.PrivilegeManager)) {
-						netscape.security.PrivilegeManager.enablePrivilege( "UniversalBrowserRead");
-						netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect");
-					}
-				} catch(e) {
-					alert("Cross-site requests prohibited. You will only be able to SPARQL the origin site: " + e);
-                    return;
-				}
-
-				xhr.open(_method, url, true /* async */);
-
-				// set the headers, including the content-type for POSTed queries
-				for (var header in this.requestHeaders())
-                    if (typeof(this.requestHeaders()[header]) != "function")
-	    				xhr.setRequestHeader(header, this.requestHeaders()[header]);
-				if (_method == 'POST') {
-					xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-					content = this.queryParameters();
-				}
-
-				SPARQL.statistics.queries_sent++;
-				_service._markRunning(this);
-
-				var callbackData = {
-					scope: this,
-					success: this._querySuccess,
-					failure: this._queryFailure,
-					argument: {
-						transformer: transformer,
-						callback: callback
-					}
-				};
-
-				// I've seen some strange race-condition behavior (strange since normally
-				// JS is single-threaded, so synchronization conditions don't occur barring
-				// reentrancy) with onreadystatechange. Instead, we poll asynchronously to
-				// determine when the request is done.
-				var token = window.setInterval(
-					function () {
-						if (xhr.readyState == 4) { // ready!
-							// clear this handler
-							window.clearInterval(token);
-							// we check the status to know which callback to call
-							if (xhr.status >= 200 && xhr.status < 300)
-								callbackData.success.apply(callbackData.scope, [xhr, callbackData.argument]);
-							else
-								callbackData.failure.apply(callbackData.scope, [xhr, callbackData.argument]);
-						}
-					},
-					200 /* maybe this should be customizable */
-				);
-
-				xhr.send(content);
-			} catch (e) {
-				alert("Error sending SPARQL query: " + e);
-			}
-		} else {
-			var self = this;
-			_service._queue(self, function() { self._doQuery(queryString, callback, transformer); }, _priority);
-		}
-	};
-
-
-	//----------
-	// accessors
-	this.request = function() { return _conn; };
-	this.service = function() { return _service; };
-	this.defaultGraphs = function() { return _default_graphs; };
-	this.namedGraphs = function() { return _named_graphs; };
-	this.prefixes = function() { return _prefix_map; };
-    this.method = function() { return _method; };
-    this.requestHeaders = function() { return _request_headers; };
-
-
-    /**
-     * Returns the SPARQL query represented by this object. The parameter, which can
-     * be omitted, determines whether or not auto-generated PREFIX clauses are included
-     * in the returned query string.
-     */
-	this.queryString = function(excludePrefixes) {
-		var preamble = '';
-		if (!excludePrefixes) {
-			for (var prefix in this.prefixes()) {
-				if(typeof(this.prefixes()[prefix]) != 'string') continue;
-				preamble += 'PREFIX ' + prefix + ': <' + this.prefixes()[prefix] + '> ';
-			}
-		}
-		return preamble + _user_query;
-	};
-
-    /**
-     * Returns the HTTP query parameters to invoke this query. This includes entries for
-     * all of the default graphs, the named graphs, the SPARQL query itself, and an
-     * output parameter to specify JSON (or other) output is desired.
-     */
-	this.queryParameters = function () {
-		var urlQueryString = '';
-		var i;
-
-		// add default and named graphs to the protocol invocation
-		for (i = 0; i < this.defaultGraphs().length; i++) urlQueryString += 'default-graph-uri=' + encodeURIComponent(this.defaultGraphs()[i]) + '&';
-		for (i = 0; i < this.namedGraphs().length; i++) urlQueryString += 'named-graph-uri=' + encodeURIComponent(this.namedGraphs()[i]) + '&';
-
-		// specify JSON output (currently output= supported by latest Joseki) (or other output)
-		urlQueryString += 'output=' + _output + '&';
-		return urlQueryString + 'query=' + encodeURIComponent(this.queryString());
-	}
-	
-    /**
-     * Returns the HTTP GET URL to invoke this query. (Note that this returns a full HTTP GET URL 
-     * even if this query is set to actually use POST.)
-     */
-	this.queryUrl = function() {
-		var url = this.service().endpoint() + '?';
-		return url + this.queryParameters();
-	};
-	
-	//---------
-	// mutators
-	function _add_graphs(toAdd, arr) {
-		if (toAdd instanceof Array)
-			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
-		else
-			arr.push(toAdd);
-	}
-	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
-	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
-	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
-    this.setMethod = function(m) {
-        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
-        _method = m;
-    };
-	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
-	
-	//---------------
-	// public methods
-
-	// use our varied transformations to create the various methods of actually issuing 
-	// queries
-	for (var query_form in SPARQL._query_transformations) {
-		// need the extra function to properly scope query_form (qf)
-		this[query_form] = (function(qf) {
-			return function(queryString, callback) {
-				this._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
-			};
-		})(query_form);
-	}
-	
-
-	//------------
-	// constructor
-	
-	return this;
-}
-
-// Nothing to see here, yet.
-SPARQL.QueryUtilities = {
-};
-

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/style.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/style.css b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/style.css
deleted file mode 100755
index f94ce4b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/style.css
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.snorql {
-    background: none repeat scroll 0 0 #eeeeee;
-    font-family: sans-serif;
-    padding: 1em 1em 5em 1em;
-    border: 2px solid #000000;
-    border-radius: 5px;
-    margin: 2em auto 10em auto;
-}
-#footer_snorql { font-size: 60%; margin: 10px 0; text-align: center; }
-.subtitle { text-align: center; margin-top: 0; }
-form { margin: 0; }
-textarea { width: 100%; margin: 10px 0;border:1px solid #999; }
-.snorql pre#prefixestext { color: #555; margin: 10px 0;  width: auto; color: inherit; background-color: inherit; border: 0; }
-img { border: none; }
-.section { margin: 15px 0 0; padding: 0; }
-.busy { color: #888; }
-.link { background: url(link.png) center right no-repeat; padding-right: 13px; }
-.queryresults { border-collapse: collapse; margin-top: 0.3em; border: 1px solid gray;}
-.queryresults td, .queryresults th { padding: 0.2em 0.4em; vertical-align: top; }
-.uri { white-space: nowrap; }
-.uri a, a.uri { text-decoration: none; }
-.unbound { color: #888; }
-.queryresults a small { font-size: 100%; }
-.queryresults small { font-size: 100%; color: #666; }
-.queryresults .property { white-space: nowrap; }
-#rdficon { float: right; margin: 0.6em 1em; }
-.directory li { margin-bottom: 0.5em; }
-.directory small { font-size: 80%; color: #666; }
-
-.snorql h2 {
-   color: #666666;
-   margin: 0;
-   padding: 0;
-}
-.result h2 {
-    margin: 5px 0;
-    color: #666666;
-}
-/* .snorql #snorql_header, .snorql .section { background: #ccf; } */
-.snorql table.queryresults th { background: #666666; color: #ffffff; font-weight: bold; }
-.snorql table.queryresults tr.odd td { background-color: #aaaaaa !important; }
-.snorql table.queryresults tr.even td { background-color: #cccccc !important; }
-
-.browser h1, .browser h2 { color: #666666; }
-.browser #header, .browser .section { background: #666666; }
-.browser table.queryresults th { background: none repeat scroll 0 0 gray; color: white; }
-.browser table.queryresults tr.odd td { background-color: #aaaaaa !important; }
-.browser table.queryresults tr.even td { background-color: #cccccc !important; }
-
-#result {
-    border: 1px solid #999;
-    font-size: 12px;
-    overflow-x: auto;
-    padding: 5px;
-    width: 98%;
-    display:none;
-    background-color: white;
-}
-
-.snorql div.CodeMirror-scroll {
-    height: auto !important;
-    overflow-y: hidden !important;
-    overflow-x: auto !important;
-}
-
-.snorql div.CodeMirror-gutter pre, .snorql div.CodeMirror-lines pre {
-    overflow: inherit !important;
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/xml-to-html.xsl
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/xml-to-html.xsl b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/xml-to-html.xsl
deleted file mode 100755
index 1333027..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/xml-to-html.xsl
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-
-XSLT script to format SPARQL Query Results XML Format into xhtml
-
-Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
-Institute of Technology, European Research Consortium for
-Informatics and Mathematics, Keio University). All Rights
-Reserved. This work is distributed under the W3C® Software
-License [1] 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.
-
-[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-Version 1 : Dave Beckett (DAWG)
-Version 2 : Jeen Broekstra (DAWG)
-Customization for SPARQler: Andy Seaborne
-
--->
-
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns="http://www.w3.org/1999/xhtml"
-		xmlns:res="http://www.w3.org/2005/sparql-results#"
-		exclude-result-prefixes="res xsl">
-
-  <!--
-    <xsl:output
-    method="html"
-    media-type="text/html"
-    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-    indent="yes"
-    encoding="UTF-8"/>
-  -->
-
-  <!-- or this? -->
-
-  <xsl:output
-   method="xml" 
-   indent="yes"
-   encoding="UTF-8" 
-   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
-   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-   omit-xml-declaration="no" />
-
-
-  <xsl:template name="header">
-    <div>
-      <h2>Header</h2>
-      <xsl:for-each select="res:head/res:link"> 
-	<p>Link to <xsl:value-of select="@href"/></p>
-      </xsl:for-each>
-    </div>
-  </xsl:template>
-
-  <xsl:template name="boolean-result">
-    <div>
-      <!--      
-	<h2>Boolean Result</h2>
-      -->      
-      <p>ASK => <xsl:value-of select="res:boolean"/></p>
-    </div>
-  </xsl:template>
-
-
-  <xsl:template name="vb-result">
-    <div>
-      <!--
-	<h2>Variable Bindings Result</h2>
-	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
-	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
-      -->
-
-      <table>
-	<xsl:text>
-	</xsl:text>
-	<tr>
-	  <xsl:for-each select="res:head/res:variable">
-	    <th><xsl:value-of select="@name"/></th>
-	  </xsl:for-each>
-	</tr>
-	<xsl:text>
-	</xsl:text>
-	<xsl:for-each select="res:results/res:result">
-	  <tr>
-	    <xsl:apply-templates select="."/>
-	  </tr>
-	</xsl:for-each>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="res:result">
-    <xsl:variable name="current" select="."/>
-    <xsl:for-each select="//res:head/res:variable">
-      <xsl:variable name="name" select="@name"/>
-      <td>
-	<xsl:choose>
-	  <xsl:when test="$current/res:binding[@name=$name]">
-	    <!-- apply template for the correct value type (bnode, uri, literal) -->
-	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <!-- no binding available for this variable in this solution -->
-	  </xsl:otherwise>
-	</xsl:choose>
-      </td>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="res:bnode">
-    <xsl:text>_:</xsl:text>
-    <xsl:value-of select="text()"/>
-  </xsl:template>
-
-  <xsl:template match="res:uri">
-    <xsl:variable name="uri" select="text()"/>
-    <xsl:text>&lt;</xsl:text>
-    <xsl:value-of select="$uri"/>
-    <xsl:text>&gt;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="res:literal">
-    <xsl:text>"</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"</xsl:text>
-
-    <xsl:choose>
-      <xsl:when test="@datatype">
-	<!-- datatyped literal value -->
-	^^&lt;<xsl:value-of select="@datatype"/>&gt;
-      </xsl:when>
-      <xsl:when test="@xml:lang">
-	<!-- lang-string -->
-	@<xsl:value-of select="@xml:lang"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="res:sparql">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-      <head>
-	<title>SPARQL Query Results</title>
-	<style>
-	  <![CDATA[
-	  h1 { font-size: 150% ; }
-	  h2 { font-size: 125% ; }
-	  table { border-collapse: collapse ; border: 1px solid black ; }
-	  td, th
- 	  { border: 1px solid black ;
-	    padding-left:0.5em; padding-right: 0.5em; 
-	    padding-top:0.2ex ; padding-bottom:0.2ex 
-	  }
-	  ]]>
-	</style>
-      </head>
-      <body>
-
-
-	<h1>SPARQL Query Results</h1>
-
-	<xsl:if test="res:head/res:link">
-	  <xsl:call-template name="header"/>
-	</xsl:if>
-
-	<xsl:choose>
-	  <xsl:when test="res:boolean">
-	    <xsl:call-template name="boolean-result" />
-	  </xsl:when>
-
-	  <xsl:when test="res:results">
-	    <xsl:call-template name="vb-result" />
-	  </xsl:when>
-
-	</xsl:choose>
-
-
-      </body>
-    </html>
-  </xsl:template>
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/update.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/update.html b/platform/marmotta-sparql/src/main/resources/web/admin/update.html
index 901c4b4..c42c522 100644
--- a/platform/marmotta-sparql/src/main/resources/web/admin/update.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/update.html
@@ -22,8 +22,7 @@
     <!--###BEGIN_HEAD###-->
     <title>SPARQL Update</title>
     <link href="../style/sparql.css" rel="stylesheet" type="text/css" />
-    <link href="../cm/codemirror.css" rel="stylesheet" type="text/css" />
-    <link href="../cm/simple-hint.css" rel="stylesheet" type="text/css" />
+    <link href="../../webjars/codemirror/2.24/codemirror.css" rel="stylesheet" type="text/css" />
     <style type="text/css">
         #refesh_box {
             display: inline-block;
@@ -62,13 +61,11 @@
         <input type="submit" value="execute update query"/>
       </p>                      
     </fieldset>
-  </form>    
+  </form>
 
-  <script type="text/javascript" src="../../core/public/js/lib/jquery-1.7.2.js"></script>
-  <script type="text/javascript" src="../../core/public/js/lib/jquery-ui-1.8.21.js"></script>
-  <script type="text/javascript" src="../cm/codemirror.js"></script>
-  <script type="text/javascript" src="../cm/simple-hint.js"></script>
-  <script type="text/javascript" src="../cm/sparql.js"></script>
+<script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+<script type="text/javascript" src="../../webjars/jquery-ui/1.8.21/jquery-ui.min.js"></script>
+<script type="text/javascript" src="../../webjars/codemirror/2.24/codemirror.js"></script>
 
 <script type="text/javascript"> 
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.css b/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.css
deleted file mode 100644
index b5385d7..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.css
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#center .CodeMirror, .CodeMirror {
-  line-height: 1em;
-  font-family: monospace;
-}
-
-#center .CodeMirror-scroll, .CodeMirror-scroll {
-  overflow: auto;
-  height: 300px;
-  /* This is needed to prevent an IE[67] bug where the scrolled content
-     is visible outside of the scrolling box. */
-  position: relative;
-  outline: none;
-}
-
-#center .CodeMirror-gutter, .CodeMirror-gutter {
-  position: absolute; left: 0; top: 0;
-  z-index: 10;
-  background-color: #f7f7f7;
-  border-right: 1px solid #eee;
-  min-width: 2em;
-  height: 100%;
-}
-#center .CodeMirror-gutter-text, .CodeMirror-gutter-text {
-  color: #aaa;
-  text-align: right;
-  padding: .4em .2em .4em .4em;
-  white-space: pre !important;
-}
-#center .CodeMirror-lines, .CodeMirror-lines {
-  padding: .4em;
-  white-space: pre;
-}
-
-#center .CodeMirror pre, .CodeMirror pre {
-  -moz-border-radius: 0;
-  -webkit-border-radius: 0;
-  -o-border-radius: 0;
-  border-radius: 0;
-  border-width: 0; margin: 0; padding: 0; background: transparent;
-  font-family: inherit;
-  font-size: inherit;
-  padding: 0; margin: 0;
-  white-space: pre;
-  word-wrap: normal;
-  line-height: inherit;
-  width: auto;
-}
-
-#center .CodeMirror-wrap pre, .CodeMirror-wrap pre {
-  word-wrap: break-word;
-  white-space: pre-wrap;
-  word-break: normal;
-}
-#center .CodeMirror-wrap .CodeMirror-scroll, .CodeMirror-wrap .CodeMirror-scroll {
-  overflow-x: hidden;
-}
-
-#center .CodeMirror textarea, .CodeMirror textarea {
-  outline: none !important;
-}
-
-#center .CodeMirror pre.CodeMirror-cursor, .CodeMirror pre.CodeMirror-cursor {
-  z-index: 10;
-  position: absolute;
-  visibility: hidden;
-  border-left: 1px solid black;
-  border-right:none;
-  width:0;
-}
-#center .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite, .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
-#center .CodeMirror-focused pre.CodeMirror-cursor, .CodeMirror-focused pre.CodeMirror-cursor {
-  visibility: visible;
-}
-
-#center div.CodeMirror-selected, div.CodeMirror-selected { background: #d9d9d9; }
-#center .CodeMirror-focused div.CodeMirror-selected, .CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
-
-#center .CodeMirror-searching, .CodeMirror-searching {
-  background: #ffa;
-  background: rgba(255, 255, 0, .4);
-}
-
-/* Default theme */
-
-.cm-s-default span.cm-keyword {color: #708;}
-.cm-s-default span.cm-atom {color: #219;}
-.cm-s-default span.cm-number {color: #164;}
-.cm-s-default span.cm-def {color: #00f;}
-.cm-s-default span.cm-variable {color: black;}
-.cm-s-default span.cm-variable-2 {color: #05a;}
-.cm-s-default span.cm-variable-3 {color: #085;}
-.cm-s-default span.cm-property {color: black;}
-.cm-s-default span.cm-operator {color: black;}
-.cm-s-default span.cm-comment {color: #a50;}
-.cm-s-default span.cm-string {color: #a11;}
-.cm-s-default span.cm-string-2 {color: #f50;}
-.cm-s-default span.cm-meta {color: #555;}
-.cm-s-default span.cm-error {color: #f00;}
-.cm-s-default span.cm-qualifier {color: #555;}
-.cm-s-default span.cm-builtin {color: #30a;}
-.cm-s-default span.cm-bracket {color: #cc7;}
-.cm-s-default span.cm-tag {color: #170;}
-.cm-s-default span.cm-attribute {color: #00c;}
-.cm-s-default span.cm-header {color: #a0a;}
-.cm-s-default span.cm-quote {color: #090;}
-.cm-s-default span.cm-hr {color: #999;}
-.cm-s-default span.cm-link {color: #00c;}
-
-span.cm-header, span.cm-strong {font-weight: bold;}
-span.cm-em {font-style: italic;}
-span.cm-emstrong {font-style: italic; font-weight: bold;}
-span.cm-link {text-decoration: underline;}
-
-#center div.CodeMirror span.CodeMirror-matchingbracket, div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-#center div.CodeMirror span.CodeMirror-nonmatchingbracket, div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}


[31/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/lib/raphael-dracula.pack.min.js
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/lib/raphael-dracula.pack.min.js b/extras/webjars/sgvizler/src/main/resources/lib/raphael-dracula.pack.min.js
new file mode 100644
index 0000000..1bf619e
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/lib/raphael-dracula.pack.min.js
@@ -0,0 +1,7 @@
+/*
+ * Raphael 1.3.1 - JavaScript Vector Library
+ *
+ * Copyright (c) 2008 - 2009 Dmitry Baranovskiy (http://raphaeljs.com)
+ * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
+ */function log(a){console.log&&console.log(a)}Raphael=function(){function Q(a,b,c){function d(){var e=Array[r].slice.call(arguments,0),f=e[p]("►"),g=d.cache=d.cache||{},h=d.count=d.count||[];return g[o](f)?c?c(g[f]):g[f]:(h[q]>=1e3&&delete g[h.shift()],h[B](f),g[f]=a[i](b,e),c?c(g[f]):g[f])}return d}function bE(){return this.x+l+this.y}function bO(a){return function(b,c,d,e){var g={back:a};return f.is(d,"function")?e=d:g.rot=d,b&&b.constructor==br&&(b=b.attrs.path),b&&(g.along=b),this.animate(g,c,e)}}var a=/[, ]+/,b=/^(circle|rect|path|ellipse|text|image)$/,c=document,d=window,e={was:"Raphael"in d,is:d.Raphael},f=function(){if(f.is(arguments[0],"array")){var a=arguments[0],c=by[i](f,a.splice(0,3+f.is(a[0],w))),d=c.set();for(var e=0,g=a[q];e<g;e++){var h=a[e]||{};b.test(h.type)&&d[B](c[h.type]().attr(h))}return d}return by[i](f,arguments)},g=function(){},h="appendChild",i="apply",j="concat",k="",l=" ",m="split",n="click dblclick mousedown mousemove mouseout mouseover mouseup"[m](l
 ),o="hasOwnProperty",p="join",q="length",r="prototype",s=String[r].toLowerCase,t=Math,u=t.max,v=t.min,w="number",x="toString",y=Object[r][x],z={},A=t.pow,B="push",C=/^(?=[\da-f]$)/,D=/^url\(['"]?([^\)]+)['"]?\)$/i,E=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,F=t.round,G="setAttribute",H=parseFloat,I=parseInt,J=String[r].toUpperCase,K={"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,targe
 t:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},L={along:"along","clip-rect":"csv",cx:w,cy:w,fill:"colour","fill-opacity":w,"font-size":w,height:w,opacity:w,path:"path",r:w,rotation:"csv",rx:w,ry:w,scale:"csv",stroke:"colour","stroke-opacity":w,"stroke-width":w,translation:"csv",width:w,x:w,y:w},M="replace";f.version="1.3.1",f.type=d.SVGAngle||c.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(f.type=="VML"){var N=document.createElement("div");N.innerHTML="<!--[if vml]><br><br><![endif]-->";if(N.childNodes[q]!=2)return null}f.svg=!(f.vml=f.type=="VML"),g[r]=f[r],f._id=0,f._oid=0,f.fn={},f.is=function(a,b){return b=s.call(b),(b=="object"||b=="undefined")&&typeof a==b||a==null&&b=="null"||s.call(y.call(a).slice(8,-1))==b},f.setWindow=function(a){d=a,c=d.document};var O=function(a){if(f.vml){var b=/^\s+|\s+$/g;O=Q(function(a){var c;a=(a+k)[M](b,k);try{var d=new ActiveXObject("htmlfile");d.write("<bo
 dy>"),d.close(),c=d.body}catch(e){c=createPopup().document.body}var f=c.createTextRange();try{c.style.color=a;var g=f.queryCommandValue("ForeColor");return g=(g&255)<<16|g&65280|(g&16711680)>>>16,"#"+("000000"+g[x](16)).slice(-6)}catch(e){return"none"}})}else{var d=c.createElement("i");d.title="Raphaël Colour Picker",d.style.display="none",c.body[h](d),O=Q(function(a){return d.style.color=a,c.defaultView.getComputedStyle(d,k).getPropertyValue("color")})}return O(a)};f.hsb2rgb=Q(function(a,b,c){f.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h);var d,e,g;if(c==0)return{r:0,g:0,b:0,hex:"#000"};if(a>1||b>1||c>1)a/=255,b/=255,c/=255;var h=~~(a*6),i=a*6-h,j=c*(1-b),k=c*(1-b*i),l=c*(1-b*(1-i));d=[c,k,j,j,l,c,c][h],e=[l,c,c,k,j,j,l][h],g=[j,j,l,c,c,k,j][h],d*=255,e*=255,g*=255;var m={r:d,g:e,b:g},n=(~~d)[x](16),o=(~~e)[x](16),p=(~~g)[x](16);return n=n[M](C,"0"),o=o[M](C,"0"),p=p[M](C,"0"),m.hex="#"+n+o+p,m},f),f.rgb2hsb=Q(function(a,b,c){f.is(a,"object")&&"r"in a&&"g"in a&&"
 b"in a&&(c=a.b,b=a.g,a=a.r);if(f.is(a,"string")){var d=f.getRGB(a);a=d.r,b=d.g,c=d.b}if(a>1||b>1||c>1)a/=255,b/=255,c/=255;var e=u(a,b,c),g=v(a,b,c),h,i,j=e;if(g==e)return{h:0,s:0,b:e};var k=e-g;return i=k/e,a==e?h=(b-c)/k:b==e?h=2+(c-a)/k:h=4+(a-b)/k,h/=6,h<0&&h++,h>1&&h--,{h:h,s:i,b:j}},f);var P=/,?([achlmqrstvxz]),?/gi;f._path2string=function(){return this.join(",")[M](P,"$1")},f.getRGB=Q(function(a){if(!a||!!((a+=k).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!{hs:1,rg:1}[o](a.substring(0,2))&&a.charAt()!="#"&&(a=O(a));var b,c,d,e,g,h=a.match(E);if(h){h[2]&&(e=I(h[2].substring(5),16),d=I(h[2].substring(3,5),16),c=I(h[2].substring(1,3),16)),h[3]&&(e=I((g=h[3].charAt(3))+g,16),d=I((g=h[3].charAt(2))+g,16),c=I((g=h[3].charAt(1))+g,16)),h[4]&&(h=h[4][m](/\s*,\s*/),c=H(h[0]),d=H(h[1]),e=H(h[2])),h[5]&&(h=h[5][m](/\s*,\s*/),c=H(h[0])*2.55,d=H(h[1])*2.55,e=H(h[2])*2.55);if(h[6])return h=h[6][m](/\s*,\s*/),c=H(h[0]),d=H(h[1]),
 e=H(h[2]),f.hsb2rgb(c,d,e);if(h[7])return h=h[7][m](/\s*,\s*/),c=H(h[0])*2.55,d=H(h[1])*2.55,e=H(h[2])*2.55,f.hsb2rgb(c,d,e);h={r:c,g:d,b:e};var i=(~~c)[x](16),j=(~~d)[x](16),l=(~~e)[x](16);return i=i[M](C,"0"),j=j[M](C,"0"),l=l[M](C,"0"),h.hex="#"+i+j+l,h}return{r:-1,g:-1,b:-1,hex:"none",error:1}},f),f.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},f.getColor.reset=function(){delete this.start},f.parsePathString=Q(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];return f.is(a,"array")&&f.is(a[0],"array")&&(c=S(a)),c[q]||(a+k)[M](/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(a,d,e){var f=[],g=s.call(d);e[M](/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(a,b){b&&f[B](+b)});while(f[q]>=b[g]){c[B]([d][j](f.splice(0,b[g])));if(!b[g])break}}),c[x]=f._path2string,c}),f.
 findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,l=A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h,m=a+2*i*(c-a)+i*i*(e-2*c+a),n=b+2*i*(d-b)+i*i*(f-2*d+b),o=c+2*i*(e-c)+i*i*(g-2*e+c),p=d+2*i*(f-d)+i*i*(h-2*f+d),q=(1-i)*a+i*c,r=(1-i)*b+i*d,s=(1-i)*e+i*g,u=(1-i)*f+i*h,v=90-t.atan((m-o)/(n-p))*180/t.PI;return(m>o||n<p)&&(v+=180),{x:k,y:l,m:{x:m,y:n},n:{x:o,y:p},start:{x:q,y:r},end:{x:s,y:u},alpha:v}};var R=Q(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=$(a);var b=0,c=0,d=[],e=[],f;for(var g=0,h=a[q];g<h;g++){f=a[g];if(f[0]=="M")b=f[1],c=f[2],d[B](b),e[B](c);else{var k=Z(b,c,f[1],f[2],f[3],f[4],f[5],f[6]);d=d[j](k.min.x,k.max.x),e=e[j](k.min.y,k.max.y),b=f[5],c=f[6]}}var l=v[i](0,d),m=v[i](0,e);return{x:l,y:m,width:u[i](0,d)-l,height:u[i](0,e)-m}}),S=function(a){var b=[];if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);for(var c=0,d=a[q];c<d;c++){b[c]=[];for(var e=0,g=a[c][q];e<g;e++)b[c][e]=a[c][e]}return b[x]=f._path
 2string,b},T=Q(function(a){if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);var b=[],c=0,d=0,e=0,g=0,h=0;a[0][0]=="M"&&(c=a[0][1],d=a[0][2],e=c,g=d,h++,b[B](["M",c,d]));for(var i=h,j=a[q];i<j;i++){var k=b[i]=[],l=a[i];if(l[0]!=s.call(l[0])){k[0]=s.call(l[0]);switch(k[0]){case"a":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]-c).toFixed(3),k[7]=+(l[7]-d).toFixed(3);break;case"v":k[1]=+(l[1]-d).toFixed(3);break;case"m":e=l[1],g=l[2];default:for(var m=1,n=l[q];m<n;m++)k[m]=+(l[m]-(m%2?c:d)).toFixed(3)}}else{k=b[i]=[],l[0]=="m"&&(e=l[1]+c,g=l[2]+d);for(var o=0,p=l[q];o<p;o++)b[i][o]=l[o]}var r=b[i][q];switch(b[i][0]){case"z":c=e,d=g;break;case"h":c+=+b[i][r-1];break;case"v":d+=+b[i][r-1];break;default:c+=+b[i][r-2],d+=+b[i][r-1]}}return b[x]=f._path2string,b},0,S),U=Q(function(a){if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);var b=[],c=0,d=0,e=0,g=0,h=0;a[0][0]=="M"&&(c=+a[0][1],d=+a[0][2],e=c,g=d,h++,b[0]=["M",c,d]);for(var i=h,j=a[
 q];i<j;i++){var k=b[i]=[],l=a[i];if(l[0]!=J.call(l[0])){k[0]=J.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+c),k[7]=+(l[7]+d);break;case"V":k[1]=+l[1]+d;break;case"H":k[1]=+l[1]+c;break;case"M":e=+l[1]+c,g=+l[2]+d;default:for(var m=1,n=l[q];m<n;m++)k[m]=+l[m]+(m%2?c:d)}}else for(var o=0,p=l[q];o<p;o++)b[i][o]=l[o];switch(k[0]){case"Z":c=e,d=g;break;case"H":c=k[1];break;case"V":d=k[1];break;default:c=b[i][b[i][q]-2],d=b[i][b[i][q]-1]}}return b[x]=f._path2string,b},null,S),V=function(a,b,c,d){return[a,b,c,d,c,d]},W=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},X=function(a,b,c,d,e,f,g,h,i,k){var l=t.PI,n=l*120/180,o=l/180*(+e||0),r=[],s,v=Q(function(a,b,c){var d=a*t.cos(c)-b*t.sin(c),e=a*t.sin(c)+b*t.cos(c);return{x:d,y:e}});if(!k){s=v(a,b,-o),a=s.x,b=s.y,s=v(h,i,-o),h=s.x,i=s.y;var w=t.cos(l/180*e),x=t.sin(l/180*e),y=(a-h)/2,z=(b-i)/2;c=u(c,t.abs(y)),d=u(d,t.abs(z));var A=y*y/(c*c)+z*z/(d*d);A>1&&(c
 =t.sqrt(A)*c,d=t.sqrt(A)*d);var B=c*c,C=d*d,D=(f==g?-1:1)*t.sqrt(t.abs((B*C-B*z*z-C*y*y)/(B*z*z+C*y*y))),E=D*c*z/d+(a+h)/2,F=D*-d*y/c+(b+i)/2,G=t.asin(((b-F)/d).toFixed(7)),H=t.asin(((i-F)/d).toFixed(7));G=a<E?l-G:G,H=h<E?l-H:H,G<0&&(G=l*2+G),H<0&&(H=l*2+H),g&&G>H&&(G-=l*2),!g&&H>G&&(H-=l*2)}else G=k[0],H=k[1],E=k[2],F=k[3];var I=H-G;if(t.abs(I)>n){var J=H,K=h,L=i;H=G+n*(g&&H>G?1:-1),h=E+c*t.cos(H),i=F+d*t.sin(H),r=X(h,i,c,d,e,0,g,K,L,[H,J,E,F])}I=H-G;var M=t.cos(G),N=t.sin(G),O=t.cos(H),P=t.sin(H),R=t.tan(I/4),S=4/3*c*R,T=4/3*d*R,U=[a,b],V=[a+S*N,b-T*M],W=[h+S*P,i-T*O],Y=[h,i];V[0]=2*U[0]-V[0],V[1]=2*U[1]-V[1];if(k)return[V,W,Y][j](r);r=[V,W,Y][j](r)[p]()[m](",");var Z=[];for(var $=0,_=r[q];$<_;$++)Z[$]=$%2?v(r[$-1],r[$],o).y:v(r[$],r[$+1],o).x;return Z},Y=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},Z=Q(function(a,b,c,d,e,f,g,h){var j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+t.sqrt(k*k-4
 *j*l))/2/j,n=(-k-t.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g],q;return t.abs(m)>1e12&&(m=.5),t.abs(n)>1e12&&(n=.5),m>0&&m<1&&(q=Y(a,b,c,d,e,f,g,h,m),p[B](q.x),o[B](q.y)),n>0&&n<1&&(q=Y(a,b,c,d,e,f,g,h,n),p[B](q.x),o[B](q.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+t.sqrt(k*k-4*j*l))/2/j,n=(-k-t.sqrt(k*k-4*j*l))/2/j,t.abs(m)>1e12&&(m=.5),t.abs(n)>1e12&&(n=.5),m>0&&m<1&&(q=Y(a,b,c,d,e,f,g,h,m),p[B](q.x),o[B](q.y)),n>0&&n<1&&(q=Y(a,b,c,d,e,f,g,h,n),p[B](q.x),o[B](q.y)),{min:{x:v[i](0,p),y:v[i](0,o)},max:{x:u[i](0,p),y:u[i](0,o)}}}),$=Q(function(a,b){var c=U(a),d=b&&U(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][j](X[i](0,[b.x,b.y][j](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][j](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.
 x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][j](W(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][j](W(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][j](V(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][j](V(b.x,b.y,a[1],b.y));break;case"V":a=["C"][j](V(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][j](V(b.x,b.y,b.X,b.Y))}return a},h=function(a,b){if(a[b][q]>7){a[b].shift();var e=a[b];while(e[q])a.splice(b++,0,["C"][j](e.splice(0,6)));a.splice(b,1),m=u(c[q],d&&d[q]||0)}},k=function(a,b,e,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),e.bx=0,e.by=0,e.x=a[g][1],e.y=a[g][2],m=u(c[q],d&&d[q]||0))};for(var l=0,m=u(c[q],d&&d[q]||0);l<m;l++){c[l]=g(c[l],e),h(c,l),d&&(d[l]=g(d[l],f)),d&&h(d,l),k(c,d,e,f,l),k(d,c,f,e,l);var n=c[l],o=d&&d[l],p=n[q],r=d&&o[q];e.x=n[p-2],e.y=n[p-1],e.bx=H(n[p-4])||e.x,e.by=H(n[p-3])||e.y,f.bx=d&&(H(o[r-4])||f.x),f.by=d&&(H(o[r-3])||f.y),f.x=d&&o[r-2],f.y=d&&o[r-1]}return d?[c,d]:c},null,S),_=Q(function(a){var b=[];for(var c=0,d=a
 [q];c<d;c++){var e={},g=a[c].match(/^([^:]*):?([\d\.]*)/);e.color=f.getRGB(g[1]);if(e.color.error)return null;e.color=e.color.hex,g[2]&&(e.offset=g[2]+"%"),b[B](e)}for(var c=1,d=b[q]-1;c<d;c++)if(!b[c].offset){var h=H(b[c-1].offset||0),i=0;for(var j=c+1;j<d;j++)if(b[j].offset){i=b[j].offset;break}i||(i=100,j=d),i=H(i);var k=(i-h)/(j-c+1);for(;c<j;c++)h+=k,b[c].offset=h+"%"}return b}),ba=function(){var a,b,d,e,g;if(f.is(arguments[0],"string")||f.is(arguments[0],"object")){f.is(arguments[0],"string")?a=c.getElementById(arguments[0]):a=arguments[0];if(a.tagName)return arguments[1]==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:arguments[1],height:arguments[2]}}else if(f.is(arguments[0],w)&&arguments[q]>3)return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]}},bb=function(a,b){var c=this;for(var d in b)if(b[o](d)&&!(d in a))switch(typeof b[d]){case"function":(function(b){a[d]=a==
 =c?b:function(){return b[i](c,arguments)}})(b[d]);break;case"object":a[d]=a[d]||{},bb.call(this,a[d],b[d]);break;default:a[d]=b[d]}},bc=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)},bd=function(a,b){if(b.top===a)return;bc(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a},be=function(a,b){if(b.bottom===a)return;bc(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a},bf=function(a,b,c){bc(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bg=function(a,b,c){bc(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bh=function(a){return function(){throw new Error("Raphaël: you are calling to method “"+a+"” of removed object")}},bi=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(f.svg){g[r].svgns="http://www.w3.org/2000/svg",g[r].xlink="http://www.w3.org/1999/xlink";var F=function(a){return+a+(~~a===a)*.5},bj=function(a){for(var b=0,c
 =a[q];b<c;b++)if(s.call(a[b][0])!="a")for(var d=1,e=a[b][q];d<e;d++)a[b][d]=F(a[b][d]);else a[b][6]=F(a[b][6]),a[b][7]=F(a[b][7]);return a},bk=function(a,b){if(!b)return c.createElementNS(g[r].svgns,a);for(var d in b)b[o](d)&&a[G](d,b[d])};f[x]=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var bl=function(a,b){var c=bk("path");b.canvas&&b.canvas[h](c);var d=new br(c,b);return d.type="path",bo(d,{fill:"none",stroke:"#000",path:a}),d},bm=function(a,b,c){var d="linear",e=.5,g=.5,i=a.style;b=(b+k)[M](bi,function(a,b,c){d="radial";if(b&&c){e=H(b),g=H(c);var f=(g>.5)*2-1;A(e-.5,2)+A(g-.5,2)>.25&&(g=t.sqrt(.25-A(e-.5,2))*f+.5)&&g!=.5&&(g=g.toFixed(5)-1e-5*f)}return k}),b=b[m](/\s*\-\s*/);if(d=="linear"){var j=b.shift();j=-H(j);if(isNaN(j))return null;var l=[0,0,t.cos(j*t.PI/180),t.sin(j*t.PI/180)],n=1/(u(t.abs(l[2]),t.abs(l[3]))||1);l[2]*=n,l[3]*=n,l[2]<0&&(l[0]=-l[2],l[2]=0),l[3]<0&&(l[1]=-l[3],l[3]=0)}var o=_(b);if(!o)return null;var p=bk(d+"Gradi
 ent");p.id="r"+(f._id++)[x](36),bk(p,d=="radial"?{fx:e,fy:g}:{x1:l[0],y1:l[1],x2:l[2],y2:l[3]}),c.defs[h](p);for(var r=0,s=o[q];r<s;r++){var v=bk("stop");bk(v,{offset:o[r].offset?o[r].offset:r?"100%":"0%","stop-color":o[r].color||"#fff"}),p[h](v)}return bk(a,{fill:"url(#"+p.id+")",opacity:1,"fill-opacity":1}),i.fill=k,i.opacity=1,i.fillOpacity=1,1},bn=function(a){var b=a.getBBox();bk(a.pattern,{patternTransform:f.format("translate({0},{1})",b.x,b.y)})},bo=function(b,d){var e={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},g=b.node,i=b.attrs,j=b.rotate(),n=function(a,b){b=e[s.call(b)];if(b){var c=a.attrs["stroke-width"]||"1",f={round:c,square:c,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,h=[],i=b[q];while(i--)h[i]=b[i]*c+(i%2?1:-1)*f;bk(g,{"stroke-dasharray":h[p](",")})}};d[o]("rotation")&&(j=d.rotation);var r=(j+k)[m](a);r.length-1?(r[1]=+r[1],r[2]=+r[2]):r=n
 ull,H(j)&&b.rotate(0,!0);for(var t in d)if(d[o](t)){if(!K[o](t))continue;var u=d[t];i[t]=u;switch(t){case"rotation":b.rotate(u,!0);break;case"href":case"title":case"target":var v=g.parentNode;if(s.call(v.tagName)!="a"){var w=bk("a");v.insertBefore(w,g),w[h](g),v=w}v.setAttributeNS(b.paper.xlink,t,u);break;case"cursor":g.style.cursor=u;break;case"clip-rect":var y=(u+k)[m](a);if(y[q]==4){b.clip&&b.clip.parentNode.parentNode.removeChild(b.clip.parentNode);var z=bk("clipPath"),A=bk("rect");z.id="r"+(f._id++)[x](36),bk(A,{x:y[0],y:y[1],width:y[2],height:y[3]}),z[h](A),b.paper.defs[h](z),bk(g,{"clip-path":"url(#"+z.id+")"}),b.clip=A}if(!u){var B=c.getElementById(g.getAttribute("clip-path")[M](/(^url\(#|\)$)/g,k));B&&B.parentNode.removeChild(B),bk(g,{"clip-path":k}),delete b.clip}break;case"path":u&&b.type=="path"&&(i.path=bj(U(u)),bk(g,{d:i.path}));break;case"width":g[G](t,u);if(i.fx)t="x",u=i.x;else break;case"x":i.fx&&(u=-i.x-(i.width||0));case"rx":if(t=="rx"&&b.type=="rect")break;case"
 cx":r&&(t=="x"||t=="cx")&&(r[1]+=u-i[t]),g[G](t,F(u)),b.pattern&&bn(b);break;case"height":g[G](t,u);if(i.fy)t="y",u=i.y;else break;case"y":i.fy&&(u=-i.y-(i.height||0));case"ry":if(t=="ry"&&b.type=="rect")break;case"cy":r&&(t=="y"||t=="cy")&&(r[2]+=u-i[t]),g[G](t,F(u)),b.pattern&&bn(b);break;case"r":b.type=="rect"?bk(g,{rx:u,ry:u}):g[G](t,u);break;case"src":b.type=="image"&&g.setAttributeNS(b.paper.xlink,"href",u);break;case"stroke-width":g.style.strokeWidth=u,g[G](t,u),i["stroke-dasharray"]&&n(b,i["stroke-dasharray"]);break;case"stroke-dasharray":n(b,u);break;case"translation":var C=(u+k)[m](a);C[0]=+C[0]||0,C[1]=+C[1]||0,r&&(r[1]+=C[0],r[2]+=C[1]),bN.call(b,C[0],C[1]);break;case"scale":var C=(u+k)[m](a);b.scale(+C[0]||1,+C[1]||+C[0]||1,+C[2]||null,+C[3]||null);break;case"fill":var E=(u+k).match(D);if(E){var z=bk("pattern"),L=bk("image");z.id="r"+(f._id++)[x](36),bk(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),bk(L,{x:0,y:0}),L.setAttributeNS(b.paper.xlink,"href",E[1]
 ),z[h](L);var N=c.createElement("img");N.style.cssText="position:absolute;left:-9999em;top-9999em",N.onload=function(){bk(z,{width:this.offsetWidth,height:this.offsetHeight}),bk(L,{width:this.offsetWidth,height:this.offsetHeight}),c.body.removeChild(this),b.paper.safari()},c.body[h](N),N.src=E[1],b.paper.defs[h](z),g.style.fill="url(#"+z.id+")",bk(g,{fill:"url(#"+z.id+")"}),b.pattern=z,b.pattern&&bn(b);break}if(!f.getRGB(u).error)delete d.gradient,delete i.gradient,!f.is(i.opacity,"undefined")&&f.is(d.opacity,"undefined")&&bk(g,{opacity:i.opacity}),!f.is(i["fill-opacity"],"undefined")&&f.is(d["fill-opacity"],"undefined")&&bk(g,{"fill-opacity":i["fill-opacity"]});else if(({circle:1,ellipse:1}[o](b.type)||(u+k).charAt()!="r")&&bm(g,u,b.paper)){i.gradient=u,i.fill="none";break};case"stroke":g[G](t,f.getRGB(u).hex);break;case"gradient":((({circle:1,ellipse:1}))[o](b.type)||(u+k).charAt()!="r")&&bm(g,u,b.paper);break;case"opacity":case"fill-opacity":if(i.gradient){var O=c.getElementById(
 g.getAttribute("fill")[M](/^url\(#|\)$/g,k));if(O){var P=O.getElementsByTagName("stop");P[P[q]-1][G]("stop-opacity",u)}break};default:t=="font-size"&&(u=I(u,10)+"px");var Q=t[M](/(\-.)/g,function(a){return J.call(a.substring(1))});g.style[Q]=u,g[G](t,u)}}bq(b,d),r?b.rotate(r.join(l)):H(j)&&b.rotate(j,!0)},bp=1.2,bq=function(a,b){if(a.type!="text"||!(b[o]("text")||b[o]("font")||b[o]("font-size")||b[o]("x")||b[o]("y")))return;var d=a.attrs,e=a.node,f=e.firstChild?I(c.defaultView.getComputedStyle(e.firstChild,k).getPropertyValue("font-size"),10):10;if(b[o]("text")){d.text=b.text;while(e.firstChild)e.removeChild(e.firstChild);var g=(b.text+k)[m]("\n");for(var i=0,j=g[q];i<j;i++)if(g[i]){var l=bk("tspan");i&&bk(l,{dy:f*bp,x:d.x}),l[h](c.createTextNode(g[i])),e[h](l)}}else{var g=e.getElementsByTagName("tspan");for(var i=0,j=g[q];i<j;i++)i&&bk(g[i],{dy:f*bp,x:d.x})}bk(e,{y:d.y});var n=a.getBBox(),p=d.y-(n.y+n.height/2);p&&isFinite(p)&&bk(e,{y:d.y+p})},br=function(a,b){var c=0,d=0;this[0]=a
 ,this.id=f._oid++,this.node=a,a.raphael=this,this.paper=b,this.attrs=this.attrs||{},this.transformations=[],this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null};br[r].rotate=function(b,c,d){if(this.removed)return this;if(b==null)return this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][p](l):this._.rt.deg;var e=this.getBBox();return b=(b+k)[m](a),b[q]-1&&(c=H(b[1]),d=H(b[2])),b=H(b[0]),c!=null?this._.rt.deg=b:this._.rt.deg+=b,d==null&&(c=null),this._.rt.cx=c,this._.rt.cy=d,c=c==null?e.x+e.width/2:c,d=d==null?e.y+e.height/2:d,this._.rt.deg?(this.transformations[0]=f.format("rotate({0} {1} {2})",this._.rt.deg,c,d),this.clip&&bk(this.clip,{transform:f.format("rotate({0} {1} {2})",-this._.rt.deg,c,d)})):(this.transformations[0]=k,this.clip&&bk(this.clip,{transform:k})),bk(this.node,{transform:this.transformations[p](l)}),this},br[r].hide=function(){return!this.removed&&(this.node.style.displa
 y="none"),this},br[r].show=function(){return!this.removed&&(this.node.style.display=""),this},br[r].remove=function(){if(this.removed)return;bc(this,this.paper),this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=!0},br[r].getBBox=function(){if(this.removed)return this;if(this.type=="path")return R(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var d=0,e=this.node.getNumberOfChars();d<e;d++){var f=this.node.getExtentOfChar(d);f.y<b.y&&(b.y=f.y),f.y+f.height-b.y>b.height&&(b.height=f.y+f.height-b.y),f.x+f.width-b.x>b.width&&(b.width=f.x+f.width-b.x)}}return a&&this.hide(),b},br[r].attr=function(){if(this.removed)return this;if(arguments[q]==0){var a={};for(var b in this.attrs)this.attrs[o](b)&&(a[b]=this.attrs[b]);return this._.rt.deg&&(a.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(a.sc
 ale=this.scale()),a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient,a}if(arguments[q]==1&&f.is(arguments[0],"string"))return arguments[0]=="translation"?bN.call(this):arguments[0]=="rotation"?this.rotate():arguments[0]=="scale"?this.scale():arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[arguments[0]];if(arguments[q]==1&&f.is(arguments[0],"array")){var c={};for(var d in arguments[0])arguments[0][o](d)&&(c[arguments[0][d]]=this.attrs[arguments[0][d]]);return c}if(arguments[q]==2){var e={};e[arguments[0]]=arguments[1],bo(this,e)}else arguments[q]==1&&f.is(arguments[0],"object")&&bo(this,arguments[0]);return this},br[r].toFront=function(){if(this.removed)return this;this.node.parentNode[h](this.node);var a=this.paper;return a.top!=this&&bd(this,a),this},br[r].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.first
 Child),be(this,this.paper);var a=this.paper}return this},br[r].insertAfter=function(a){if(this.removed)return this;var b=a.node;return b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[h](this.node),bf(this,a,this.paper),this},br[r].insertBefore=function(a){if(this.removed)return this;var b=a.node;return b.parentNode.insertBefore(this.node,b),bg(this,a,this.paper),this};var bs=function(a,b,c,d){b=F(b),c=F(c);var e=bk("circle");a.canvas&&a.canvas[h](e);var f=new br(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",bk(e,f.attrs),f},bt=function(a,b,c,d,e,f){b=F(b),c=F(c);var g=bk("rect");a.canvas&&a.canvas[h](g);var i=new br(g,a);return i.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},i.type="rect",bk(g,i.attrs),i},bu=function(a,b,c,d,e){b=F(b),c=F(c);var f=bk("ellipse");a.canvas&&a.canvas[h](f);var g=new br(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",bk(f
 ,g.attrs),g},bv=function(a,b,c,d,e,f){var g=bk("image");bk(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(a.xlink,"href",b),a.canvas&&a.canvas[h](g);var i=new br(g,a);return i.attrs={x:c,y:d,width:e,height:f,src:b},i.type="image",i},bw=function(a,b,c,d){var e=bk("text");bk(e,{x:b,y:c,"text-anchor":"middle"}),a.canvas&&a.canvas[h](e);var f=new br(e,a);return f.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:K.font,stroke:"none",fill:"#000"},f.type="text",bo(f,f.attrs),f},bx=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas[G]("width",this.width),this.canvas[G]("height",this.height),this},by=function(){var a=ba[i](null,arguments),b=a&&a.container,d=a.x,e=a.y,j=a.width,k=a.height;if(!b)throw new Error("SVG container not found.");var l=bk("svg");return j=j||512,k=k||342,bk(l,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:j,height:k}),b==1?(l.style.cssText="position:absolute;left:"+d+"px;top:"+e+"px",c.body[h](l)):b.f
 irstChild?b.insertBefore(l,b.firstChild):b[h](l),b=new g,b.width=j,b.height=k,b.canvas=l,bb.call(b,b,f.fn),b.clear(),b};g[r].clear=function(){var a=this.canvas;while(a.firstChild)a.removeChild(a.firstChild);this.bottom=this.top=null,(this.desc=bk("desc"))[h](c.createTextNode("Created with Raphaël")),a[h](this.desc),a[h](this.defs=bk("defs"))},g[r].remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bh(a)}}if(f.vml){var bz=function(a){var b=/[ahqstv]/ig,c=U;(a+k).match(b)&&(c=$),b=/[clmz]/g;if(c==U&&!(a+k).match(b)){var d={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},e=/([clmz]),?([^clmz]*)/gi,f=/-?[^,\s-]+/g,g=(a+k)[M](e,function(a,b,c){var e=[];return c[M](f,function(a){e[B](F(a))}),d[b]+e});return g}var h=c(a),i,g=[],j;for(var m=0,n=h[q];m<n;m++){i=h[m],j=s.call(h[m][0]),j=="z"&&(j="x");for(var o=1,r=i[q];o<r;o++)j+=F(i[o])+(o!=r-1?",":k);g[B](j)}return g[p](l)};f[x]=function(){return"Your browser doesn’t suppo
 rt SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var bl=function(a,b){var c=bA("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px",c.coordsize=b.coordsize,c.coordorigin=b.coordorigin;var d=bA("shape"),e=d.style;e.width=b.width+"px",e.height=b.height+"px",d.coordsize=this.coordsize,d.coordorigin=this.coordorigin,c[h](d);var f=new br(d,c,b);return f.isAbsolute=!0,f.type="path",f.path=[],f.Path=k,a&&bo(f,{fill:"none",stroke:"#000",path:a}),b.canvas[h](c),f},bo=function(b,d){b.attrs=b.attrs||{};var e=b.node,g=b.attrs,i=e.style,j,l=b;for(var n in d)d[o](n)&&(g[n]=d[n]);d.href&&(e.href=d.href),d.title&&(e.title=d.title),d.target&&(e.target=d.target),d.cursor&&(i.cursor=d.cursor),d.path&&b.type=="path"&&(g.path=d.path,e.path=bz(g.path)),d.rotation!=null&&b.rotate(d.rotation,!0),d.translation&&(j=(d.translation+k)[m](a),bN.call(b,j[0],j[1]),b._.rt.cx!=null&&(b._.rt.cx+=+j[0],b._.rt.cy+=+j[1],b.setBox(b.attrs,j[0],j[1]))),
 d.scale&&(j=(d.scale+k)[m](a),b.scale(+j[0]||1,+j[1]||+j[0]||1,+j[2]||null,+j[3]||null));if("clip-rect"in d){var p=(d["clip-rect"]+k)[m](a);if(p[q]==4){p[2]=+p[2]+ +p[0],p[3]=+p[3]+ +p[1];var r=e.clipRect||c.createElement("div"),s=r.style,t=e.parentNode;s.clip=f.format("rect({1}px {2}px {3}px {0}px)",p),e.clipRect||(s.position="absolute",s.top=0,s.left=0,s.width=b.paper.width+"px",s.height=b.paper.height+"px",t.parentNode.insertBefore(r,t),r[h](t),e.clipRect=r)}d["clip-rect"]||e.clipRect&&(e.clipRect.style.clip=k)}b.type=="image"&&d.src&&(e.src=d.src),b.type=="image"&&d.opacity&&(e.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+d.opacity*100+")",i.filter=(e.filterMatrix||k)+(e.filterOpacity||k)),d.font&&(i.font=d.font),d["font-family"]&&(i.fontFamily='"'+d["font-family"][m](",")[0][M](/^['"]+|['"]+$/g,k)+'"'),d["font-size"]&&(i.fontSize=d["font-size"]),d["font-weight"]&&(i.fontWeight=d["font-weight"]),d["font-style"]&&(i.fontStyle=d["font-style"]);if(d.opacity!=nu
 ll||d["stroke-width"]!=null||d.fill!=null||d.stroke!=null||d["stroke-width"]!=null||d["stroke-opacity"]!=null||d["fill-opacity"]!=null||d["stroke-dasharray"]!=null||d["stroke-miterlimit"]!=null||d["stroke-linejoin"]!=null||d["stroke-linecap"]!=null){e=b.shape||e;var u=e.getElementsByTagName("fill")&&e.getElementsByTagName("fill")[0],v=!1;!u&&(v=u=bA("fill"));if("fill-opacity"in d||"opacity"in d){var w=((+g["fill-opacity"]+1||2)-1)*((+g.opacity+1||2)-1);w<0&&(w=0),w>1&&(w=1),u.opacity=w}d.fill&&(u.on=!0);if(u.on==null||d.fill=="none")u.on=!1;if(u.on&&d.fill){var x=d.fill.match(D);x?(u.src=x[1],u.type="tile"):(u.color=f.getRGB(d.fill).hex,u.src=k,u.type="solid",f.getRGB(d.fill).error&&(l.type in{circle:1,ellipse:1}||(d.fill+k).charAt()!="r")&&bm(l,d.fill)&&(g.fill="none",g.gradient=d.fill))}v&&e[h](u);var y=e.getElementsByTagName("stroke")&&e.getElementsByTagName("stroke")[0],z=!1;!y&&(z=y=bA("stroke"));if(d.stroke&&d.stroke!="none"||d["stroke-width"]||d["stroke-opacity"]!=null||d["st
 roke-dasharray"]||d["stroke-miterlimit"]||d["stroke-linejoin"]||d["stroke-linecap"])y.on=!0;(d.stroke=="none"||y.on==null||d.stroke==0||d["stroke-width"]==0)&&(y.on=!1),y.on&&d.stroke&&(y.color=f.getRGB(d.stroke).hex);var w=((+g["stroke-opacity"]+1||2)-1)*((+g.opacity+1||2)-1),A=(H(d["stroke-width"])||1)*.75;w<0&&(w=0),w>1&&(w=1),d["stroke-width"]==null&&(A=g["stroke-width"]),d["stroke-width"]&&(y.weight=A),A&&A<1&&(w*=A)&&(y.weight=1),y.opacity=w,d["stroke-linejoin"]&&(y.joinstyle=d["stroke-linejoin"]||"miter"),y.miterlimit=d["stroke-miterlimit"]||8,d["stroke-linecap"]&&(y.endcap=d["stroke-linecap"]=="butt"?"flat":d["stroke-linecap"]=="square"?"square":"round");if(d["stroke-dasharray"]){var B={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};y.dashstyle=B[o](d["stroke-dasharray"])?B[d["stroke-dasharray"]]:k}z&&e[h](y)}if(l.type=="text"){var i=l.paper.span.st
 yle;g.font&&(i.font=g.font),g["font-family"]&&(i.fontFamily=g["font-family"]),g["font-size"]&&(i.fontSize=g["font-size"]),g["font-weight"]&&(i.fontWeight=g["font-weight"]),g["font-style"]&&(i.fontStyle=g["font-style"]),l.node.string&&(l.paper.span.innerHTML=(l.node.string+k)[M](/</g,"&#60;")[M](/&/g,"&#38;")[M](/\n/g,"<br>")),l.W=g.w=l.paper.span.offsetWidth,l.H=g.h=l.paper.span.offsetHeight,l.X=g.x,l.Y=g.y+F(l.H/2);switch(g["text-anchor"]){case"start":l.node.style["v-text-align"]="left",l.bbx=F(l.W/2);break;case"end":l.node.style["v-text-align"]="right",l.bbx=-F(l.W/2);break;default:l.node.style["v-text-align"]="center"}}},bm=function(a,b){a.attrs=a.attrs||{};var c=a.attrs,d=a.node.getElementsByTagName("fill"),e="linear",f=".5 .5";a.attrs.gradient=b,b=(b+k)[M](bi,function(a,b,c){return e="radial",b&&c&&(b=H(b),c=H(c),A(b-.5,2)+A(c-.5,2)>.25&&(c=t.sqrt(.25-A(b-.5,2))*((c>.5)*2-1)+.5),f=b+l+c),k}),b=b[m](/\s*\-\s*/);if(e=="linear"){var g=b.shift();g=-H(g);if(isNaN(g))return null}var 
 h=_(b);if(!h)return null;a=a.shape||a.node,d=d[0]||bA("fill");if(h[q]){d.on=!0,d.method="none",d.type=e=="radial"?"gradientradial":"gradient",d.color=h[0].color,d.color2=h[h[q]-1].color;var i=[];for(var j=0,n=h[q];j<n;j++)h[j].offset&&i[B](h[j].offset+l+h[j].color);d.colors&&(d.colors.value=i[q]?i[p](","):"0% "+d.color),e=="radial"?(d.focus="100%",d.focussize=f,d.focusposition=f):d.angle=(270-g)%360}return 1},br=function(a,b,c){var d=0,e=0,g=0,h=1;this[0]=a,this.id=f._oid++,this.node=a,a.raphael=this,this.X=0,this.Y=0,this.attrs={},this.Group=b,this.paper=c,this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null};br[r].rotate=function(b,c,d){return this.removed?this:b==null?this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][p](l):this._.rt.deg:(b=(b+k)[m](a),b[q]-1&&(c=H(b[1]),d=H(b[2])),b=H(b[0]),c!=null?this._.rt.deg=b:this._.rt.deg+=b,d==null&&(c=null),this._.rt.cx=c,this._.rt.cy=d,this.setBox(this.
 attrs,c,d),this.Group.style.rotation=this._.rt.deg,this)},br[r].setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,e=this.shape&&this.shape.style||this.node.style;a=a||{};for(var f in a)a[o](f)&&(this.attrs[f]=a[f]);b=b||this._.rt.cx,c=c||this._.rt.cy;var g=this.attrs,i,j,l,m;switch(this.type){case"circle":i=g.cx-g.r,j=g.cy-g.r,l=m=g.r*2;break;case"ellipse":i=g.cx-g.rx,j=g.cy-g.ry,l=g.rx*2,m=g.ry*2;break;case"rect":case"image":i=+g.x,j=+g.y,l=g.width||0,m=g.height||0;break;case"text":this.textpath.v=["m",F(g.x),", ",F(g.y-2),"l",F(g.x)+1,", ",F(g.y-2)][p](k),i=g.x-F(this.W/2),j=g.y-this.H/2,l=this.W,m=this.H;break;case"path":if(!this.attrs
+.path)i=0,j=0,l=this.paper.width,m=this.paper.height;else{var n=R(this.attrs.path);i=n.x,j=n.y,l=n.width,m=n.height}break;default:i=0,j=0,l=this.paper.width,m=this.paper.height}b=b==null?i+l/2:b,c=c==null?j+m/2:c;var r=b-this.paper.width/2,s=c-this.paper.height/2;if(this.type=="path"||this.type=="text")d.left!=r+"px"&&(d.left=r+"px"),d.top!=s+"px"&&(d.top=s+"px"),this.X=this.type=="text"?i:-r,this.Y=this.type=="text"?j:-s,this.W=l,this.H=m,e.left!=-r+"px"&&(e.left=-r+"px"),e.top!=-s+"px"&&(e.top=-s+"px");else{d.left!=r+"px"&&(d.left=r+"px"),d.top!=s+"px"&&(d.top=s+"px"),this.X=i,this.Y=j,this.W=l,this.H=m,d.width!=this.paper.width+"px"&&(d.width=this.paper.width+"px"),d.height!=this.paper.height+"px"&&(d.height=this.paper.height+"px"),e.left!=i-r+"px"&&(e.left=i-r+"px"),e.top!=j-s+"px"&&(e.top=j-s+"px"),e.width!=l+"px"&&(e.width=l+"px"),e.height!=m+"px"&&(e.height=m+"px");var t=(+a.r||0)/v(l,m);if(this.type=="rect"&&this.arcsize.toFixed(4)!=t.toFixed(4)&&(t||this.arcsize)){var u=bA(
 "roundrect"),w={},f=0,x=this.events&&this.events[q];u.arcsize=t,u.raphael=this,this.Group[h](u),this.Group.removeChild(this.node),this[0]=this.node=u,this.arcsize=t;for(var f in g)w[f]=g[f];delete w.scale,this.attr(w);if(this.events)for(;f<x;f++)this.events[f].unbind=bC(this.node,this.events[f].name,this.events[f].f,this)}}},br[r].hide=function(){return!this.removed&&(this.Group.style.display="none"),this},br[r].show=function(){return!this.removed&&(this.Group.style.display="block"),this},br[r].getBBox=function(){return this.removed?this:this.type=="path"?R(this.attrs.path):{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}},br[r].remove=function(){if(this.removed)return;bc(this,this.paper),this.node.parentNode.removeChild(this.node),this.Group.parentNode.removeChild(this.Group),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=!0},br[r].attr=function(){if(this.removed)return this;if(arguments[q]==0){var a={};for(var b 
 in this.attrs)this.attrs[o](b)&&(a[b]=this.attrs[b]);return this._.rt.deg&&(a.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale()),a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient,a}if(arguments[q]==1&&f.is(arguments[0],"string"))return arguments[0]=="translation"?bN.call(this):arguments[0]=="rotation"?this.rotate():arguments[0]=="scale"?this.scale():arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[arguments[0]];if(this.attrs&&arguments[q]==1&&f.is(arguments[0],"array")){var c={};for(var b=0,d=arguments[0][q];b<d;b++)c[arguments[0][b]]=this.attrs[arguments[0][b]];return c}var e;return arguments[q]==2&&(e={},e[arguments[0]]=arguments[1]),arguments[q]==1&&f.is(arguments[0],"object")&&(e=arguments[0]),e&&(e.text&&this.type=="text"&&(this.node.string=e.text),bo(this,e),e.gradient&&({circle:1,ellipse:1}[o](this.type)||(e.gradient+k).charAt()!="r")&&bm(this,e.gradient),(this.type!="path"||this._.rt.
 deg)&&this.setBox(this.attrs)),this},br[r].toFront=function(){return!this.removed&&this.Group.parentNode[h](this.Group),this.paper.top!=this&&bd(this,this.paper),this},br[r].toBack=function(){return this.removed?this:(this.Group.parentNode.firstChild!=this.Group&&(this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild),be(this,this.paper)),this)},br[r].insertAfter=function(a){return this.removed?this:(a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[h](this.Group),bf(this,a,this.paper),this)},br[r].insertBefore=function(a){return this.removed?this:(a.Group.parentNode.insertBefore(this.Group,a.Group),bg(this,a,this.paper),this)};var bs=function(a,b,c,d){var e=bA("group"),f=bA("oval"),g=f.style;e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",e.coordsize=a.coordsize,e.coordorigin=a.coordorigin,e[h](f);var i=new br(f,e,a);return i.type="circle",bo(i,{stroke:"#000",fil
 l:"none"}),i.attrs.cx=b,i.attrs.cy=c,i.attrs.r=d,i.setBox({x:b-d,y:c-d,width:d*2,height:d*2}),a.canvas[h](e),i},bt=function(a,b,c,d,e,f){var g=bA("group"),i=bA("roundrect"),j=(+f||0)/v(d,e);g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",g.coordsize=a.coordsize,g.coordorigin=a.coordorigin,g[h](i),i.arcsize=j;var k=new br(i,g,a);return k.type="rect",bo(k,{stroke:"#000"}),k.arcsize=j,k.setBox({x:b,y:c,width:d,height:e,r:f}),a.canvas[h](g),k},bu=function(a,b,c,d,e){var f=bA("group"),g=bA("oval"),i=g.style;f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",f.coordsize=a.coordsize,f.coordorigin=a.coordorigin,f[h](g);var j=new br(g,f,a);return j.type="ellipse",bo(j,{stroke:"#000"}),j.attrs.cx=b,j.attrs.cy=c,j.attrs.rx=d,j.attrs.ry=e,j.setBox({x:b-d,y:c-e,width:d*2,height:e*2}),a.canvas[h](f),j},bv=function(a,b,c,d,e,f){var g=bA("group"),i=bA("image"),j=i.style;g.style.cssText="position:absolute;left:0;top:0
 ;width:"+a.width+"px;height:"+a.height+"px",g.coordsize=a.coordsize,g.coordorigin=a.coordorigin,i.src=b,g[h](i);var k=new br(i,g,a);return k.type="image",k.attrs.src=b,k.attrs.x=c,k.attrs.y=d,k.attrs.w=e,k.attrs.h=f,k.setBox({x:c,y:d,width:e,height:f}),a.canvas[h](g),k},bw=function(a,b,c,d){var e=bA("group"),g=bA("shape"),i=g.style,j=bA("path"),l=j.style,m=bA("textpath");e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",e.coordsize=a.coordsize,e.coordorigin=a.coordorigin,j.v=f.format("m{0},{1}l{2},{1}",F(b),F(c),F(b)+1),j.textpathok=!0,i.width=a.width,i.height=a.height,m.string=d+k,m.on=!0,g[h](m),g[h](j),e[h](g);var n=new br(m,e,a);return n.shape=g,n.textpath=j,n.type="text",n.attrs.text=d,n.attrs.x=b,n.attrs.y=c,n.attrs.w=1,n.attrs.h=1,bo(n,{font:K.font,stroke:"none",fill:"#000"}),n.setBox(),a.canvas[h](e),n},bx=function(a,b){var c=this.canvas.style;return a==+a&&(a+="px"),b==+b&&(b+="px"),c.width=a,c.height=b,c.clip="rect(0 "+a+" "+b+" 0)"
 ,this},bA;c.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!c.namespaces.rvml&&c.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),bA=function(a){return c.createElement("<rvml:"+a+' class="rvml">')}}catch(bB){bA=function(a){return c.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}var by=function(){var a=ba[i](null,arguments),b=a.container,d=a.height,e,j=a.width,k=a.x,l=a.y;if(!b)throw new Error("VML container not found.");var m=new g,n=m.canvas=c.createElement("div"),o=n.style;return j=j||512,d=d||342,j==+j&&(j+="px"),d==+d&&(d+="px"),m.width=1e3,m.height=1e3,m.coordsize="1000 1000",m.coordorigin="0 0",m.span=c.createElement("span"),m.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",n[h](m.span),o.cssText=f.format("width:{0};height:{1};position:absolute;clip:rect(0 {0} {1} 0);overflow:hidden",j,d),b==1?(c.body[h](n),o.left=k+"px",o.top=l+"px"):(b.style.width=j,b.st
 yle.height=d,b.firstChild?b.insertBefore(n,b.firstChild):b[h](n)),bb.call(m,m,f.fn),m};g[r].clear=function(){this.canvas.innerHTML=k,this.span=c.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas[h](this.span),this.bottom=this.top=null},g[r].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bh(a)}}/^Apple|^Google/.test(navigator.vendor)&&!(navigator.userAgent.indexOf("Version/4.0")+1)?g[r].safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99);setTimeout(function(){a.remove()})}:g[r].safari=function(){};var bC=function(){if(c.addEventListener)return function(a,b,c,d){var e=function(a){return c.call(d,a)};return a.addEventListener(b,e,!1),function(){return a.removeEventListener(b,e,!1),!0}};if(c.attachEvent)return function(a,b,c,e){var f=function(a){return c.call(e,a||d.event)};a.attachEvent("on"+b,f);var g=function(){return a
 .detachEvent("on"+b,f),!0};return g}}();for(var bD=n[q];bD--;)(function(a){br[r][a]=function(b){return f.is(b,"function")&&(this.events=this.events||[],this.events.push({name:a,f:b,unbind:bC(this.shape||this.node,a,b,this)})),this},br[r]["un"+a]=function(b){var c=this.events,d=c[q];while(d--)if(c[d].name==a&&c[d].f==b)return c[d].unbind(),c.splice(d,1),!c.length&&delete this.events,this;return this}})(n[bD]);br[r].hover=function(a,b){return this.mouseover(a).mouseout(b)},br[r].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)},g[r].circle=function(a,b,c){return bs(this,a||0,b||0,c||0)},g[r].rect=function(a,b,c,d,e){return bt(this,a||0,b||0,c||0,d||0,e||0)},g[r].ellipse=function(a,b,c,d){return bu(this,a||0,b||0,c||0,d||0)},g[r].path=function(a){return a&&!f.is(a,"string")&&!f.is(a[0],"array")&&(a+=k),bl(f.format[i](f,arguments),this)},g[r].image=function(a,b,c,d,e){return bv(this,a||"about:blank",b||0,c||0,d||0,e||0)},g[r].text=function(a,b,c){return bw(this,a||0,b||0,c
 ||k)},g[r].set=function(a){return arguments[q]>1&&(a=Array[r].splice.call(arguments,0,arguments[q])),new bP(a)},g[r].setSize=bx,g[r].top=g[r].bottom=null,g[r].raphael=f,br[r].scale=function(a,b,c,d){if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:bE};b=b||a,!+b&&(b=a);var e,f,g,h,i=this.attrs;if(a!=0){var m=this.getBBox(),n=m.x+m.width/2,o=m.y+m.height/2,r=a/this._.sx,s=b/this._.sy;c=+c||c==0?c:n,d=+d||d==0?d:o;var u=~~(a/t.abs(a)),w=~~(b/t.abs(b)),x=this.node.style,y=c+(n-c)*r,z=d+(o-d)*s;switch(this.type){case"rect":case"image":var A=i.width*u*r,B=i.height*w*s;this.attr({height:B,r:i.r*v(u*r,w*s),width:A,x:y-A/2,y:z-B/2});break;case"circle":case"ellipse":this.attr({rx:i.rx*u*r,ry:i.ry*w*s,r:i.r*v(u*r,w*s),cx:y,cy:z});break;case"path":var C=T(i.path),D=!0;for(var E=0,F=C[q];E<F;E++){var H=C[E],I,K=J.call(H[0]);if(K=="M"&&D)continue;D=!1;if(K=="A")H[C[E][q]-2]*=r,H[C[E][q]-1]*=s,H[1]*=u*r,H[2]*=w*s,H[5]=+(u+w?!!+H[5]:!+H[5]);else if(K=="H")for(I=1,jj=H[q];I<jj;I++)H[I]*=
 r;else if(K=="V")for(I=1,jj=H[q];I<jj;I++)H[I]*=s;else for(I=1,jj=H[q];I<jj;I++)H[I]*=I%2?r:s}var L=R(C),e=y-L.x-L.width/2,f=z-L.y-L.height/2;C[0][1]+=e,C[0][2]+=f,this.attr({path:C})}this.type in{text:1,image:1}&&(u!=1||w!=1)?this.transformations?(this.transformations[2]="scale("[j](u,",",w,")"),this.node[G]("transform",this.transformations[p](l)),e=u==-1?-i.x-(A||0):i.x,f=w==-1?-i.y-(B||0):i.y,this.attr({x:e,y:f}),i.fx=u-1,i.fy=w-1):(this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11="[j](u,", M12=0, M21=0, M22=",w,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')"),x.filter=(this.node.filterMatrix||k)+(this.node.filterOpacity||k)):this.transformations?(this.transformations[2]=k,this.node[G]("transform",this.transformations[p](l)),i.fx=0,i.fy=0):(this.node.filterMatrix=k,x.filter=(this.node.filterMatrix||k)+(this.node.filterOpacity||k)),i.scale=[a,b,c,d][p](l),this._.sx=a,this._.sy=b}return this},br[r].clone=function(){var a=this.attr();return de
 lete a.scale,delete a.translation,this.paper[this.type]().attr(a)};var bF=function(a,b){return function(c,d,e){c=$(c);var g,h,i,j,k="",l={},m,n=0;for(var o=0,q=c.length;o<q;o++){i=c[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=bG(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>d){if(b&&!l.start){m=f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],(d-n)/j),k+=["C",m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(e)return k;l.start=k,k=["M",m.x,m.y+"C",m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]][p](),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!b)return m=f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],(d-n)/j),{x:m.x,y:m.y,alpha:m.alpha}}n+=j,g=+i[5],h=+i[6]}k+=i}return l.end=k,m=a?n:b?l:f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha}),m}},bG=Q(function(a,b,c,d,e,f,g,h){var i={x:0,y:0},j=0;for(var k=0;k<1.01;k+=.01){var l=Y(a,b,c,d,e,f,g,h,k);k&&(j+=t.sqrt(A(i.x-l.x,2)+A(i.y-l.y,2))),i=l}return j}),bH=bF(1),bI=bF(),bJ=bF(0,1);br[r].getTotalLength=functio
 n(){if(this.type!="path")return;return bH(this.attrs.path)},br[r].getPointAtLength=function(a){if(this.type!="path")return;return bI(this.attrs.path,a)},br[r].getSubpath=function(a,b){if(this.type!="path")return;if(t.abs(this.getTotalLength()-b)<1e-6)return bJ(this.attrs.path,a).end;var c=bJ(this.attrs.path,b,1);return a?bJ(c,a).end:c},f.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,3)},">":function(a){return A(a-1,3)+1},"<>":function(a){return a*=2,a<1?A(a,3)/2:(a-=2,(A(a,3)+2)/2)},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=.3,c=b/4;return A(2,-10*a)*t.sin((a-c)*2*t.PI/b)+1},bounce:function(a){var b=7.5625,c=2.75,d;return a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375),d}};var bK={length:0},bL=function(){var a=+(new Date);for(var b in bK)if(b!="length"&&bK[o](b)){var c=bK[
 b];if(c.stop){delete bK[b],bK[q]--;continue}var d=a-c.start,e=c.ms,g=c.easing,h=c.from,i=c.diff,j=c.to,m=c.t,n=c.prev||0,r=c.el,s=c.callback,t={},u;if(d<e){var v=f.easing_formulas[g]?f.easing_formulas[g](d/e):d/e;for(var w in h)if(h[o](w)){switch(L[w]){case"along":u=v*e*i[w],j.back&&(u=j.len-u);var x=bI(j[w],u);r.translate(i.sx-i.x||0,i.sy-i.y||0),i.x=x.x,i.y=x.y,r.translate(x.x-i.sx,x.y-i.sy),j.rot&&r.rotate(i.r+x.alpha,x.x,x.y);break;case"number":u=+h[w]+v*e*i[w];break;case"colour":u="rgb("+[bM(F(h[w].r+v*e*i[w].r)),bM(F(h[w].g+v*e*i[w].g)),bM(F(h[w].b+v*e*i[w].b))][p](",")+")";break;case"path":u=[];for(var y=0,z=h[w][q];y<z;y++){u[y]=[h[w][y][0]];for(var A=1,B=h[w][y][q];A<B;A++)u[y][A]=+h[w][y][A]+v*e*i[w][y][A];u[y]=u[y][p](l)}u=u[p](l);break;case"csv":switch(w){case"translation":var C=i[w][0]*(d-n),D=i[w][1]*(d-n);m.x+=C,m.y+=D,u=C+l+D;break;case"rotation":u=+h[w][0]+v*e*i[w][0],h[w][1]&&(u+=","+h[w][1]+","+h[w][2]);break;case"scale":u=[+h[w][0]+v*e*i[w][0],+h[w][1]+v*e*i[w][1
 ],2 in j[w]?j[w][2]:k,3 in j[w]?j[w][3]:k][p](l);break;case"clip-rect":u=[];var y=4;while(y--)u[y]=+h[w][y]+v*e*i[w][y]}}t[w]=u}r.attr(t),r._run&&r._run.call(r)}else{if(j.along){var x=bI(j.along,j.len*!j.back);r.translate(i.sx-(i.x||0)+x.x-i.sx,i.sy-(i.y||0)+x.y-i.sy),j.rot&&r.rotate(i.r+x.alpha,x.x,x.y)}(m.x||m.y)&&r.translate(-m.x,-m.y),j.scale&&(j.scale=j.scale+k),r.attr(j),delete bK[b],bK[q]--,r.in_animation=null,f.is(s,"function")&&s.call(r)}c.prev=d}f.svg&&r&&r.paper.safari(),bK[q]&&setTimeout(bL)},bM=function(a){return a>255?255:a<0?0:a},bN=function(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:bE};this._.tx+=+a,this._.ty+=+b;switch(this.type){case"circle":case"ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case"path":var c=T(this.attrs.path);c[0][1]+=+a,c[0][2]+=+b,this.attr({path:c})}return this};br[r].animateWith=function(a,b,c,d,e){return bK[a.id]&&(b.st
 art=bK[a.id].start),this.animate(b,c,d,e)},br[r].animateAlong=bO(),br[r].animateAlongBack=bO(1),br[r].onAnimation=function(a){return this._run=a||0,this},br[r].animate=function(b,c,d,e){if(f.is(d,"function")||!d)e=d||null;var g={},h={},i={};for(var j in b)if(b[o](j)&&L[o](j)){g[j]=this.attr(j),g[j]==null&&(g[j]=K[j]),h[j]=b[j];switch(L[j]){case"along":var l=bH(b[j]),n=bI(b[j],l*!!b.back),p=this.getBBox();i[j]=l/c,i.tx=p.x,i.ty=p.y,i.sx=n.x,i.sy=n.y,h.rot=b.rot,h.back=b.back,h.len=l,b.rot&&(i.r=H(this.rotate())||0);break;case"number":i[j]=(h[j]-g[j])/c;break;case"colour":g[j]=f.getRGB(g[j]);var r=f.getRGB(h[j]);i[j]={r:(r.r-g[j].r)/c,g:(r.g-g[j].g)/c,b:(r.b-g[j].b)/c};break;case"path":var s=$(g[j],h[j]);g[j]=s[0];var t=s[1];i[j]=[];for(var u=0,v=g[j][q];u<v;u++){i[j][u]=[0];for(var w=1,x=g[j][u][q];w<x;w++)i[j][u][w]=(t[u][w]-g[j][u][w])/c}break;case"csv":var y=(b[j]+k)[m](a),z=(g[j]+k)[m](a);switch(j){case"translation":g[j]=[0,0],i[j]=[y[0]/c,y[1]/c];break;case"rotation":g[j]=z[1]==
 y[1]&&z[2]==y[2]?z:[0,y[1],y[2]],i[j]=[(y[0]-g[j][0])/c,0,0];break;case"scale":b[j]=y,g[j]=(g[j]+k)[m](a),i[j]=[(y[0]-g[j][0])/c,(y[1]-g[j][1])/c,0,0];break;case"clip-rect":g[j]=(g[j]+k)[m](a),i[j]=[];var u=4;while(u--)i[j][u]=(y[u]-g[j][u])/c}h[j]=y}}return this.stop(),this.in_animation=1,bK[this.id]={start:b.start||+(new Date),ms:c,easing:d,from:g,diff:i,to:h,el:this,callback:e,t:{x:0,y:0}},++bK[q]==1&&bL(),this},br[r].stop=function(){return bK[this.id]&&bK[q]--,delete bK[this.id],this},br[r].translate=function(a,b){return this.attr({translation:a+" "+b})},br[r][x]=function(){return"Raphaël’s object"},f.ae=bK;var bP=function(a){this.items=[],this[q]=0;if(a)for(var b=0,c=a[q];b<c;b++)a[b]&&(a[b].constructor==br||a[b].constructor==bP)&&(this[this.items[q]]=this.items[this.items[q]]=a[b],this[q]++)};bP[r][B]=function(){var a,b;for(var c=0,d=arguments[q];c<d;c++)a=arguments[c],a&&(a.constructor==br||a.constructor==bP)&&(b=this.items[q],this[b]=this.items[b]=a,this[q]++);return this
 },bP[r].pop=function(){return delete this[this[q]--],this.items.pop()};for(var bQ in br[r])br[r][o](bQ)&&(bP[r][bQ]=function(a){return function(){for(var b=0,c=this.items[q];b<c;b++)this.items[b][a][i](this.items[b],arguments);return this}}(bQ));return bP[r].attr=function(a,b){if(a&&f.is(a,"array")&&f.is(a[0],"object"))for(var c=0,d=a[q];c<d;c++)this.items[c].attr(a[c]);else for(var e=0,g=this.items[q];e<g;e++)this.items[e].attr[i](this.items[e],arguments);return this},bP[r].animate=function(a,b,c,d){(f.is(c,"function")||!c)&&(d=c||null);var e=this.items[q],g=e,h=this,i;d&&(i=function(){!--e&&d.call(h)}),this.items[--g].animate(a,b,c||i,i);while(g--)this.items[g].animateWith(this.items[e-1],a,b,c||i,i);return this},bP[r].insertAfter=function(a){var b=this.items[q];while(b--)this.items[b].insertAfter(a);return this},bP[r].getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items[q];e--;){var f=this.items[e].getBBox();a[B](f.x),b[B](f.y),c[B](f.x+f.width),d[B](f.y+f.height)}retu
 rn a=v[i](0,a),b=v[i](0,b),{x:a,y:b,width:u[i](0,c)-a,height:u[i](0,d)-b}},f.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[o](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c][B](b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=I(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[o](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d[M](/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var g in f.k)f[o](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},g[r].getFont=function(a,b,c,d){d=d||"normal",c=c||"normal",b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;var e=f.fonts[a];if(!e){var g=new RegExp("(^|\\s)"+a[M](/[^\w\d\s+!~.:_-]/g,k)+"(\\s|$)","i");for(var h in f.fonts)if(f.fonts[o](h)&&g.test(h)){e=f.fonts[h];break}}var i;if(e)for(var j=0,l=e[q];j<l;j++){i=e[j];if(i.face["font-weight"]==b&&(i.face["f
 ont-style"]==c||!i.face["font-style"])&&i.face["font-stretch"]==d)break}return i},g[r].print=function(b,c,d,e,g,h){h=h||"middle";var i=this.set(),j=(d+k)[m](k),l=0,n=k,o;f.is(e,"string")&&(e=this.getFont(e));if(e){o=(g||16)/e.face["units-per-em"];var p=e.face.bbox.split(a),r=+p[0],s=+p[1]+(h=="baseline"?p[3]-p[1]+ +e.face.descent:(p[3]-p[1])/2);for(var t=0,u=j[q];t<u;t++){var v=t&&e.glyphs[j[t-1]]||{},w=e.glyphs[j[t]];l+=t?(v.w||e.w)+(v.k&&v.k[j[t]]||0):0,w&&w.d&&i[B](this.path(w.d).attr({fill:"#000",stroke:"none",translation:[l,0]}))}i.scale(o,o,r,s).translate(b-r,c-s)}return i},f.format=function(a){var b=f.is(arguments[1],"array")?[0][j](arguments[1]):arguments,c=/\{(\d+)\}/g;return a&&f.is(a,"string")&&b[q]-1&&(a=a[M](c,function(a,c){return b[++c]==null?k:b[c]})),a||k},f.ninja=function(){var a=Raphael;return e.was?Raphael=e.is:delete Raphael,a},f.el=br[r],f}();var Graph=function(){this.nodes=[],this.nodelist=[],this.edges=[],this.snapshots=[]};Graph.prototype={addNode:function(a,
 b){return this.nodes[a]==undefined&&(this.nodes[a]=new Graph.Node(a,b||{id:a}),this.nodelist.push(this.nodes[a])),this.nodes[a]},addEdge:function(a,b,c){var d=this.addNode(a),e=this.addNode(b),f={source:d,target:e,style:c,weight:c&&c.weight||1};d.edges.push(f),this.edges.push(f);if(!c||!c.directed){var g={source:e,target:d,style:c,weight:c&&c.weight||1,backedge:f};this.edges.push(g),e.edges.push(g)}},snapShot:function(a,b){var c=new Graph;jQuery.extend(!0,c.nodes,this.nodes),jQuery.extend(!0,c.nodelist,this.nodelist),jQuery.extend(!0,c.edges,this.edges),c.snapShot=null,this.snapshots.push({comment:a,graph:c})}},Graph.Node=function(a,b){return b.id=a,b.edges=[],b},Graph.Node.prototype={},Graph.Renderer={},Graph.Renderer.Raphael=function(a,b,c,d,e){this.width=c||400,this.height=d||400;var f=this;this.r=Raphael(a,this.width,this.height),this.radius=e&&e.noderadius?e.noderadius:40,this.graph=b,this.mouse_in=!1,this.graph.render||(this.graph.render=function(){return}),this.isDrag=!1,this
 .dragger=function(a){this.dx=a.clientX,this.dy=a.clientY,f.isDrag=this,this.set&&this.set.animate({"fill-opacity":.1},200)&&this.set.toFront(),a.preventDefault&&a.preventDefault()},document.onmousemove=function(a){a=a||window.event;if(f.isDrag){var b=f.isDrag.set.getBBox(),c=a.clientX-f.isDrag.dx+(b.x+b.width/2),d=a.clientY-f.isDrag.dy+(b.y+b.height/2),e=a.clientX-(c<20?c-20:c>f.width-20?c-f.width+20:0),g=a.clientY-(d<20?d-20:d>f.height-20?d-f.height+20:0);f.isDrag.set.translate(e-f.isDrag.dx,g-f.isDrag.dy);for(var h in f.graph.edges)f.graph.edges[h].connection&&f.graph.edges[h].connection.draw();f.isDrag.dx=e,f.isDrag.dy=g}},document.onmouseup=function(){f.isDrag&&f.isDrag.set.animate({"fill-opacity":.6},500),f.isDrag=!1}},Graph.Renderer.Raphael.prototype={translate:function(a){return[Math.round((a[0]-this.graph.layoutMinX)*this.factorX+this.radius),Math.round((a[1]-this.graph.layoutMinY)*this.factorY+this.radius)]},rotate:function(a,b,c){var d=b*Math.cos(c),e=b*Math.sin(c);return[
 a[0]+d,a[1]+e]},draw:function(){this.factorX=(this.width-10*this.radius)/(this.graph.layoutMaxX-this.graph.layoutMinX),this.factorY=(this.height-15*this.radius)/(this.graph.layoutMaxY-this.graph.layoutMinY);for(a in this.graph.nodes)this.drawNode(this.graph.nodes[a]);for(var a=0;a<this.graph.edges.length;a++)this.drawEdge(this.graph.edges[a])},drawNode:function(a){var b=this.translate([a.layoutPosX,a.layoutPosY]);a.point=b;if(a.shape){var c=a.shape.getBBox(),d=[c.x+Math.round(c.width/2),c.y+Math.round(c.height/2)];a.shape.translate(b[0]-d[0],b[1]-d[1]),this.r.safari();return}var e;if(a.render)e=a.render(this.r,a);else if(!a.shape){var f=Raphael.getColor();e=this.r.set().push(this.r.ellipse(b[0],b[1],30,20).attr({fill:f,stroke:f,"stroke-width":2})).push(this.r.text(b[0],b[1]+30,a.label||a.id))}e.attr({"fill-opacity":.6}),e.items.forEach(function(a){a.set=e,a.node.style.cursor="pointer"}),e.mousedown(this.dragger),a.shape=e},drawEdge:function(a){if(a.backedge)return;a.connection&&a.co
 nnection.draw(),a.connection||(a.style&&a.style.callback&&a.style.callback(a),a.connection=this.r.connection(a.source.shape,a.target.shape,a.style))}},Graph.Layout={},Graph.Layout.Spring=function(a){this.graph=a,this.iterations=500,this.maxRepulsiveForceDistance=6,this.k=2,this.c=.01,this.maxVertexMovement=.5},Graph.Layout.Spring.prototype={layout:function(){this.layoutPrepare();for(var a=0;a<this.iterations;a++)this.layoutIteration();this.layoutCalcBounds()},layoutPrepare:function(){for(i in this.graph.nodes){var a=this.graph.nodes[i];a.layoutPosX=0,a.layoutPosY=0,a.layoutForceX=0,a.layoutForceY=0}},layoutCalcBounds:function(){var a=Infinity,b=-Infinity,c=Infinity,d=-Infinity;for(i in this.graph.nodes){var e=this.graph.nodes[i].layoutPosX,f=this.graph.nodes[i].layoutPosY;e>b&&(b=e),e<a&&(a=e),f>d&&(d=f),f<c&&(c=f)}this.graph.layoutMinX=a,this.graph.layoutMaxX=b,this.graph.layoutMinY=c,this.graph.layoutMaxY=d},layoutIteration:function(){for(var a=0;a<this.graph.nodelist.length;a++){
 var b=this.graph.nodelist[a];for(var c=a+1;c<this.graph.nodelist.length;c++){var d=this.graph.nodelist[c];this.layoutRepulsive(b,d)}}for(var a=0;a<this.graph.edges.length;a++){var e=this.graph.edges[a];this.layoutAttractive(e)}for(a in this.graph.nodes){var f=this.graph.nodes[a],g=this.c*f.layoutForceX,h=this.c*f.layoutForceY,i=this.maxVertexMovement;g>i&&(g=i),g<-i&&(g=-i),h>i&&(h=i),h<-i&&(h=-i),f.layoutPosX+=g,f.layoutPosY+=h,f.layoutForceX=0,f.layoutForceY=0}},layoutRepulsive:function(a,b){var c=b.layoutPosX-a.layoutPosX,d=b.layoutPosY-a.layoutPosY,e=c*c+d*d;if(e<.01){c=.1*Math.random()+.1,d=.1*Math.random()+.1;var e=c*c+d*d}var f=Math.sqrt(e);if(f<this.maxRepulsiveForceDistance){var g=this.k*this.k/f;b.layoutForceX+=g*c/f,b.layoutForceY+=g*d/f,a.layoutForceX-=g*c/f,a.layoutForceY-=g*d/f}},layoutAttractive:function(a){var b=a.source,c=a.target,d=c.layoutPosX-b.layoutPosX,e=c.layoutPosY-b.layoutPosY,f=d*d+e*e;if(f<.01){d=.1*Math.random()+.1,e=.1*Math.random()+.1;var f=d*d+e*e}var
  g=Math.sqrt(f);g>this.maxRepulsiveForceDistance&&(g=this.maxRepulsiveForceDistance,f=g*g);var h=(f-this.k*this.k)/this.k;a.attraction==undefined&&(a.attraction=1),h*=Math.log(a.attraction)*.5+1,c.layoutForceX-=h*d/g,c.layoutForceY-=h*e/g,b.layoutForceX+=h*d/g,b.layoutForceY+=h*e/g}},Raphael.el.tooltip=function(a){return this.tp=a,this.tp.o={x:0,y:0},this.tp.hide(),this.hover(function(a){this.mousemove(function(a){this.tp.translate(a.clientX-this.tp.o.x,a.clientY-this.tp.o.y),this.tp.o={x:a.clientX,y:a.clientY}}),this.tp.show().toFront()},function(a){this.tp.hide(),this.unmousemove()}),this},Raphael.fn.connection=function(a,b,c){var d=this,e={draw:function(){var f=a.getBBox(),g=b.getBBox(),h=0,i=0,j=[{x:f.x+f.width/2,y:f.y-h},{x:f.x+f.width/2,y:f.y+f.height+h},{x:f.x-h,y:f.y+f.height/2},{x:f.x+f.width+h,y:f.y+f.height/2},{x:g.x+g.width/2,y:g.y-i},{x:g.x+g.width/2,y:g.y+g.height+i},{x:g.x-i,y:g.y+g.height/2},{x:g.x+g.width+i,y:g.y+g.height/2}],k={},l=[];for(var m=0;m<4;m++)for(var n=
 4;n<8;n++){var o=Math.abs(j[m].x-j[n].x),p=Math.abs(j[m].y-j[n].y);if(m==n-4||(m!=3&&n!=6||j[m].x<j[n].x)&&(m!=2&&n!=7||j[m].x>j[n].x)&&(m!=0&&n!=5||j[m].y>j[n].y)&&(m!=1&&n!=4||j[m].y<j[n].y))l.push(o+p),k[l[l.length-1].toFixed(3)]=[m,n]}var q=l.length==0?[0,4]:k[Math.min.apply(Math,l).toFixed(3)],r=j[q[0]].x,s=j[q[0]].y,t=j[q[1]].x,u=j[q[1]].y,o=Math.max(Math.abs(r-t)/2,10),p=Math.max(Math.abs(s-u)/2,10),v=[r,r,r-o,r+o][q[0]].toFixed(3),w=[s-p,s+p,s,s][q[0]].toFixed(3),x=[0,0,0,0,t,t,t-o,t+o][q[1]].toFixed(3),y=[0,0,0,0,s+p,s-p,u,u][q[1]].toFixed(3),z=["M",r.toFixed(3),s.toFixed(3),"C",v,w,x,y,t.toFixed(3),u.toFixed(3)].join(",");if(c&&c.directed){var A=Math.sqrt((u-y)*(u-y)+(t-x)*(t-x)),B=function(a,b){return-a*(b||5)/A},C=[{x:(B(t-x)+B(u-y)+t).toFixed(3),y:(B(u-y)+B(t-x)+u).toFixed(3)},{x:(B(t-x)-B(u-y)+t).toFixed(3),y:(B(u-y)-B(t-x)+u).toFixed(3)}];z=z+",M"+C[0].x+","+C[0].y+",L"+t+","+u+",L"+C[1].x+","+C[1].y}e.fg&&e.fg.attr({path:z})||(e.fg=d.path(z).attr({stroke:c&&c.stroke|
 |"#000",fill:"none"}).toBack()),e.bg&&e.bg.attr({path:z})||c&&c.fill&&(e.bg=c.fill.split&&d.path(z).attr({stroke:c.fill,fill:"none","stroke-width":c.width||3}).toBack()),c&&c.label&&(e.label&&e.label.attr({x:(r+t)/2,y:(s+u)/2})||(e.label=d.text((r+t)/2,(s+u)/2,c.label).attr({fill:"#000","font-size":c.fontsize||"12px"})))}};return e.draw(),e};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/sgvizler.chart.css
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/sgvizler.chart.css b/extras/webjars/sgvizler/src/main/resources/sgvizler.chart.css
new file mode 100644
index 0000000..3f0026e
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/sgvizler.chart.css
@@ -0,0 +1,37 @@
+
+/*** sMap ***/
+
+div.sgvizler-sMap{
+    padding: 0;
+    margin: 0;
+    font-family: sans-serif;
+}
+div.sgvizler-sMap h1, div.sgvizler-sMap p{
+    font-size: 11pt;
+    margin: 2px 0 1px 0;
+}
+div.sgvizler-sMap p.text{
+    font-family: serif;
+}
+div.sgvizler-sMap div.img{
+    float: right;
+    padding: 10px;
+}
+
+/*** pForce ***/
+
+circle.node {
+  stroke: #999;
+  stroke-width: 0.5px;
+}
+
+line.link {
+  stroke: #999;
+  stroke-opacity: .6;
+}
+
+.nodetext { 
+    pointer-events: none; 
+    font: 10px sans-serif; 
+    color: black;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/sgvizler.html
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/sgvizler.html b/extras/webjars/sgvizler/src/main/resources/sgvizler.html
new file mode 100644
index 0000000..a5e52a8
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/sgvizler.html
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>Sgvizler</title>
+    <meta charset="UTF-8"/>
+    <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico" />
+    <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css" />
+    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+    <script type="text/javascript" id="sgvzlr_script" src="http://sgvizler.googlecode.com/svn/release/0.5/sgvizler.js"></script>
+    <script type="text/javascript">
+      // CONFIGURATION Sgvizler 0.5: Set variables to fit your setup.
+      // NB! Do not let the last item in a list end with a comma.
+
+       //// Query settings. The defaults settings are listed.
+       sgvizler.option.query = {
+           // Default query. 
+           //'query':                "SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?instance a ?class }\nGROUP BY ?class\nORDER BY ?class",
+    
+           // Endpoint URL. 
+           //'endpoint':             "http://sws.ifi.uio.no/sparql/world",
+    
+           // Endpoint output format. 
+           //'endpoint_output':      'json',  // 'xml', 'json' or 'jsonp'
+    
+           // This string is appended the 'endpoint' variable and the query to it again to give a link to the "raw" query results.
+           //'endpoint_query_url':   "?output=text&amp;query=",
+    
+           // URL to SPARQL validation service. The query is appended to it. 
+           //'validator_query_url':  "http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=",
+    
+           // Default chart type. 
+           //'chart':                'gLineChart',
+    
+           // Default log level. Must be either 0, 1, or 2. 
+           //'loglevel':             2
+       };
+
+       //// Prefixes
+       // Add convenient prefixes for your dataset. rdf, rdfs, xsd, owl
+       // are already set.  Examples: 
+       sgvizler.option.namespace['wd'] = 'http://sws.ifi.uio.no/d2rq/resource/';
+       sgvizler.option.namespace['w']  = 'http://sws.ifi.uio.no/ont/world.owl#';
+
+       //// Your chart drawing preferences. The defaults are listed.
+       // See the Google visualization API for available options for
+       // Google charts, and the Sgvizler homepage for other
+       // options. Options applicable to all charts are put in the
+       // "root" of sgvizler.chartOptions. Chart specific options are
+       // put in a "child" with the chart's id as name,
+       // e.g. 'gGeoMap'. 
+       sgvizler.option.chart = { 
+           //'width':           '800',
+           //'height':          '400',
+           //'chartArea':       { left: '5%', top: '5%', width: '75%', height: '80%' },
+           //     'gGeoMap': {
+           //	 'dataMode':           'markers'
+           //     },
+           //     'gMap': {
+           //	 'dataMode':           'markers',
+           //     },
+           //     'sMap': {
+           //	 'dataMode':           'markers',
+           //	 'showTip':            true,
+           //	 'useMapTypeControl':  true
+           //     } 
+       };
+
+       //// Leave this as is. Ready, steady, GO!
+       $(document).ready(sgvizler.go());
+    </script>
+  </head>
+  <body>
+    <div id="logo">
+      <a href="http://code.google.com/p/sgvizler/">
+	<img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"/>
+      </a><br/>Mr. Sgvizler
+    </div>
+    <h1>Sgvizler</h1>    
+
+    <h2>User Input</h2>
+
+    This section contains a input form where users can write and
+    execute their own SPARQL queries. The query is sent to Sgvizler
+    via the URL in GET parameters.
+
+    <div id="queryarea">
+      <pre id="sgvzlr_cPrefix"></pre>
+      <textarea id="sgvzlr_cQuery" rows="10" cols="80"></textarea>
+      <form method="get" id="sgvzlr_formQuery">
+	<p>
+	  <input type="hidden" value="" name="query" id="sgvzlr_strQuery"/>
+	  Width:  <input name="width" id="sgvzlr_strWidth" type="text" size="3"/>
+	  Height: <input name="height" id="sgvzlr_strHeight" type="text" size="3"/>
+	  Chart Type: <select name="chart" id="sgvzlr_optChart"></select>
+	  <input type="button" value="Reset" onclick="sgvizler.ui.resetPage()"/>
+	  <input type="button" value="GO!" onclick="sgvizler.ui.submitQuery()"/>
+	</p>
+      </form>
+      <div id="sgvzlr_cMessage"></div>
+    </div>
+    <div id="sgvzlr_gchart" style="width:800px; height:400px;"></div>
+    <div id="footer">
+      <!-- Please leave a link to the Sgvizler homepage --> 
+      <p>
+	Sgvizler visualizes the result of SPARQL SELECT queries using
+	javascript and the Google Visualization API. For more
+	information, see
+	the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
+	homepage. (c) 2011 Martin G. Skj&#230;veland.
+      </p>
+    </div>
+  </body>
+</html>


[22/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.6.4.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.6.4.js b/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.6.4.js
deleted file mode 100644
index 11e6d06..0000000
--- a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.6.4.js
+++ /dev/null
@@ -1,9046 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.6.4
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Mon Sep 12 18:54:48 2011 -0400
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
-	navigator = window.navigator,
-	location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
-		// The jQuery object is actually just the init constructor 'enhanced'
-		return new jQuery.fn.init( selector, context, rootjQuery );
-	},
-
-	// Map over jQuery in case of overwrite
-	_jQuery = window.jQuery,
-
-	// Map over the $ in case of overwrite
-	_$ = window.$,
-
-	// A central reference to the root jQuery(document)
-	rootjQuery,
-
-	// A simple way to check for HTML strings or ID strings
-	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
-	quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
-	// Check if a string has a non-whitespace character in it
-	rnotwhite = /\S/,
-
-	// Used for trimming whitespace
-	trimLeft = /^\s+/,
-	trimRight = /\s+$/,
-
-	// Check for digits
-	rdigit = /\d/,
-
-	// Match a standalone tag
-	rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
-	// JSON RegExp
-	rvalidchars = /^[\],:{}\s]*$/,
-	rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
-	rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
-	rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
-	// Useragent RegExp
-	rwebkit = /(webkit)[ \/]([\w.]+)/,
-	ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
-	rmsie = /(msie) ([\w.]+)/,
-	rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
-	// Matches dashed string for camelizing
-	rdashAlpha = /-([a-z]|[0-9])/ig,
-	rmsPrefix = /^-ms-/,
-
-	// Used by jQuery.camelCase as callback to replace()
-	fcamelCase = function( all, letter ) {
-		return ( letter + "" ).toUpperCase();
-	},
-
-	// Keep a UserAgent string for use with jQuery.browser
-	userAgent = navigator.userAgent,
-
-	// For matching the engine and version of the browser
-	browserMatch,
-
-	// The deferred used on DOM ready
-	readyList,
-
-	// The ready event handler
-	DOMContentLoaded,
-
-	// Save a reference to some core methods
-	toString = Object.prototype.toString,
-	hasOwn = Object.prototype.hasOwnProperty,
-	push = Array.prototype.push,
-	slice = Array.prototype.slice,
-	trim = String.prototype.trim,
-	indexOf = Array.prototype.indexOf,
-
-	// [[Class]] -> type pairs
-	class2type = {};
-
-jQuery.fn = jQuery.prototype = {
-	constructor: jQuery,
-	init: function( selector, context, rootjQuery ) {
-		var match, elem, ret, doc;
-
-		// Handle $(""), $(null), or $(undefined)
-		if ( !selector ) {
-			return this;
-		}
-
-		// Handle $(DOMElement)
-		if ( selector.nodeType ) {
-			this.context = this[0] = selector;
-			this.length = 1;
-			return this;
-		}
-
-		// The body element only exists once, optimize finding it
-		if ( selector === "body" && !context && document.body ) {
-			this.context = document;
-			this[0] = document.body;
-			this.selector = selector;
-			this.length = 1;
-			return this;
-		}
-
-		// Handle HTML strings
-		if ( typeof selector === "string" ) {
-			// Are we dealing with HTML string or an ID?
-			if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
-				// Assume that strings that start and end with <> are HTML and skip the regex check
-				match = [ null, selector, null ];
-
-			} else {
-				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] ) {
-					context = context instanceof jQuery ? context[0] : context;
-					doc = (context ? context.ownerDocument || context : document);
-
-					// If a single string is passed in and it's a single tag
-					// just do a createElement and skip the rest
-					ret = rsingleTag.exec( selector );
-
-					if ( ret ) {
-						if ( jQuery.isPlainObject( context ) ) {
-							selector = [ document.createElement( ret[1] ) ];
-							jQuery.fn.attr.call( selector, context, true );
-
-						} else {
-							selector = [ doc.createElement( ret[1] ) ];
-						}
-
-					} else {
-						ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
-						selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
-					}
-
-					return jQuery.merge( this, selector );
-
-				// HANDLE: $("#id")
-				} else {
-					elem = document.getElementById( match[2] );
-
-					// Check parentNode to catch when Blackberry 4.6 returns
-					// nodes that are no longer in the document #6963
-					if ( elem && elem.parentNode ) {
-						// Handle the case where IE and Opera return items
-						// by name instead of ID
-						if ( elem.id !== match[2] ) {
-							return rootjQuery.find( selector );
-						}
-
-						// Otherwise, we inject the element directly into the jQuery object
-						this.length = 1;
-						this[0] = elem;
-					}
-
-					this.context = document;
-					this.selector = selector;
-					return this;
-				}
-
-			// HANDLE: $(expr, $(...))
-			} else if ( !context || context.jquery ) {
-				return (context || rootjQuery).find( selector );
-
-			// HANDLE: $(expr, context)
-			// (which is just equivalent to: $(context).find(expr)
-			} else {
-				return this.constructor( context ).find( selector );
-			}
-
-		// HANDLE: $(function)
-		// Shortcut for document ready
-		} else if ( jQuery.isFunction( selector ) ) {
-			return rootjQuery.ready( selector );
-		}
-
-		if (selector.selector !== undefined) {
-			this.selector = selector.selector;
-			this.context = selector.context;
-		}
-
-		return jQuery.makeArray( selector, this );
-	},
-
-	// Start with an empty selector
-	selector: "",
-
-	// The current version of jQuery being used
-	jquery: "1.6.4",
-
-	// The default length of a jQuery object is 0
-	length: 0,
-
-	// The number of elements contained in the matched element set
-	size: function() {
-		return this.length;
-	},
-
-	toArray: function() {
-		return slice.call( this, 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 == null ?
-
-			// Return a 'clean' array
-			this.toArray() :
-
-			// Return just the object
-			( num < 0 ? this[ this.length + num ] : this[ num ] );
-	},
-
-	// Take an array of elements and push it onto the stack
-	// (returning the new matched element set)
-	pushStack: function( elems, name, selector ) {
-		// Build a new jQuery matched element set
-		var ret = this.constructor();
-
-		if ( jQuery.isArray( elems ) ) {
-			push.apply( ret, elems );
-
-		} else {
-			jQuery.merge( ret, elems );
-		}
-
-		// Add the old object onto the stack (as a reference)
-		ret.prevObject = this;
-
-		ret.context = this.context;
-
-		if ( name === "find" ) {
-			ret.selector = this.selector + (this.selector ? " " : "") + selector;
-		} else if ( name ) {
-			ret.selector = this.selector + "." + name + "(" + selector + ")";
-		}
-
-		// Return the newly-formed element set
-		return ret;
-	},
-
-	// 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 );
-	},
-
-	ready: function( fn ) {
-		// Attach the listeners
-		jQuery.bindReady();
-
-		// Add the callback
-		readyList.done( fn );
-
-		return this;
-	},
-
-	eq: function( i ) {
-		return i === -1 ?
-			this.slice( i ) :
-			this.slice( i, +i + 1 );
-	},
-
-	first: function() {
-		return this.eq( 0 );
-	},
-
-	last: function() {
-		return this.eq( -1 );
-	},
-
-	slice: function() {
-		return this.pushStack( slice.apply( this, arguments ),
-			"slice", slice.call(arguments).join(",") );
-	},
-
-	map: function( callback ) {
-		return this.pushStack( jQuery.map(this, function( elem, i ) {
-			return callback.call( elem, i, elem );
-		}));
-	},
-
-	end: function() {
-		return this.prevObject || this.constructor(null);
-	},
-
-	// For internal use only.
-	// Behaves like an Array's method, not like a jQuery method.
-	push: push,
-	sort: [].sort,
-	splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
-	var options, name, src, copy, copyIsArray, clone,
-		target = arguments[0] || {},
-		i = 1,
-		length = arguments.length,
-		deep = false;
-
-	// Handle a deep copy situation
-	if ( typeof target === "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" && !jQuery.isFunction(target) ) {
-		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 ( name in options ) {
-				src = target[ name ];
-				copy = options[ name ];
-
-				// Prevent never-ending loop
-				if ( target === copy ) {
-					continue;
-				}
-
-				// Recurse if we're merging plain objects or arrays
-				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
-					if ( copyIsArray ) {
-						copyIsArray = false;
-						clone = src && jQuery.isArray(src) ? src : [];
-
-					} else {
-						clone = src && jQuery.isPlainObject(src) ? src : {};
-					}
-
-					// Never move original objects, clone them
-					target[ name ] = jQuery.extend( deep, clone, copy );
-
-				// Don't bring in undefined values
-				} else if ( copy !== undefined ) {
-					target[ name ] = copy;
-				}
-			}
-		}
-	}
-
-	// Return the modified object
-	return target;
-};
-
-jQuery.extend({
-	noConflict: function( deep ) {
-		if ( window.$ === jQuery ) {
-			window.$ = _$;
-		}
-
-		if ( deep && window.jQuery === jQuery ) {
-			window.jQuery = _jQuery;
-		}
-
-		return jQuery;
-	},
-
-	// Is the DOM ready to be used? Set to true once it occurs.
-	isReady: false,
-
-	// A counter to track how many items to wait for before
-	// the ready event fires. See #6781
-	readyWait: 1,
-
-	// Hold (or release) the ready event
-	holdReady: function( hold ) {
-		if ( hold ) {
-			jQuery.readyWait++;
-		} else {
-			jQuery.ready( true );
-		}
-	},
-
-	// Handle when the DOM is ready
-	ready: function( wait ) {
-		// Either a released hold or an DOMready/load event and not yet ready
-		if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
-			// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
-			if ( !document.body ) {
-				return setTimeout( jQuery.ready, 1 );
-			}
-
-			// Remember that the DOM is ready
-			jQuery.isReady = true;
-
-			// If a normal DOM Ready event fired, decrement, and wait if need be
-			if ( wait !== true && --jQuery.readyWait > 0 ) {
-				return;
-			}
-
-			// If there are functions bound, to execute
-			readyList.resolveWith( document, [ jQuery ] );
-
-			// Trigger any bound ready events
-			if ( jQuery.fn.trigger ) {
-				jQuery( document ).trigger( "ready" ).unbind( "ready" );
-			}
-		}
-	},
-
-	bindReady: function() {
-		if ( readyList ) {
-			return;
-		}
-
-		readyList = jQuery._Deferred();
-
-		// Catch cases where $(document).ready() is called after the
-		// browser event has already occurred.
-		if ( document.readyState === "complete" ) {
-			// Handle it asynchronously to allow scripts the opportunity to delay ready
-			return setTimeout( jQuery.ready, 1 );
-		}
-
-		// Mozilla, Opera and webkit nightlies currently support this event
-		if ( document.addEventListener ) {
-			// Use the handy event callback
-			document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
-			// A fallback to window.onload, that will always work
-			window.addEventListener( "load", jQuery.ready, false );
-
-		// If IE event model is used
-		} else if ( document.attachEvent ) {
-			// ensure firing before onload,
-			// maybe late but safe also for iframes
-			document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
-			// A fallback to window.onload, that will always work
-			window.attachEvent( "onload", jQuery.ready );
-
-			// If IE and not a frame
-			// continually check to see if the document is ready
-			var toplevel = false;
-
-			try {
-				toplevel = window.frameElement == null;
-			} catch(e) {}
-
-			if ( document.documentElement.doScroll && toplevel ) {
-				doScrollCheck();
-			}
-		}
-	},
-
-	// See test/unit/core.js for details concerning isFunction.
-	// Since version 1.3, DOM methods and functions like alert
-	// aren't supported. They return false on IE (#2968).
-	isFunction: function( obj ) {
-		return jQuery.type(obj) === "function";
-	},
-
-	isArray: Array.isArray || function( obj ) {
-		return jQuery.type(obj) === "array";
-	},
-
-	// A crude way of determining if an object is a window
-	isWindow: function( obj ) {
-		return obj && typeof obj === "object" && "setInterval" in obj;
-	},
-
-	isNaN: function( obj ) {
-		return obj == null || !rdigit.test( obj ) || isNaN( obj );
-	},
-
-	type: function( obj ) {
-		return obj == null ?
-			String( obj ) :
-			class2type[ toString.call(obj) ] || "object";
-	},
-
-	isPlainObject: function( obj ) {
-		// Must be an Object.
-		// Because of IE, we also have to check the presence of the constructor property.
-		// Make sure that DOM nodes and window objects don't pass through, as well
-		if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
-			return false;
-		}
-
-		try {
-			// Not own constructor property must be Object
-			if ( obj.constructor &&
-				!hasOwn.call(obj, "constructor") &&
-				!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
-				return false;
-			}
-		} catch ( e ) {
-			// IE8,9 Will throw exceptions on certain host objects #9897
-			return false;
-		}
-
-		// Own properties are enumerated firstly, so to speed up,
-		// if last one is own, then all properties are own.
-
-		var key;
-		for ( key in obj ) {}
-
-		return key === undefined || hasOwn.call( obj, key );
-	},
-
-	isEmptyObject: function( obj ) {
-		for ( var name in obj ) {
-			return false;
-		}
-		return true;
-	},
-
-	error: function( msg ) {
-		throw msg;
-	},
-
-	parseJSON: function( data ) {
-		if ( typeof data !== "string" || !data ) {
-			return null;
-		}
-
-		// Make sure leading/trailing whitespace is removed (IE can't handle it)
-		data = jQuery.trim( data );
-
-		// Attempt to parse using the native JSON parser first
-		if ( window.JSON && window.JSON.parse ) {
-			return window.JSON.parse( data );
-		}
-
-		// Make sure the incoming data is actual JSON
-		// Logic borrowed from http://json.org/json2.js
-		if ( rvalidchars.test( data.replace( rvalidescape, "@" )
-			.replace( rvalidtokens, "]" )
-			.replace( rvalidbraces, "")) ) {
-
-			return (new Function( "return " + data ))();
-
-		}
-		jQuery.error( "Invalid JSON: " + data );
-	},
-
-	// Cross-browser xml parsing
-	parseXML: function( data ) {
-		var xml, tmp;
-		try {
-			if ( window.DOMParser ) { // Standard
-				tmp = new DOMParser();
-				xml = tmp.parseFromString( data , "text/xml" );
-			} else { // IE
-				xml = new ActiveXObject( "Microsoft.XMLDOM" );
-				xml.async = "false";
-				xml.loadXML( data );
-			}
-		} catch( e ) {
-			xml = undefined;
-		}
-		if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
-			jQuery.error( "Invalid XML: " + data );
-		}
-		return xml;
-	},
-
-	noop: function() {},
-
-	// Evaluates a script in a global context
-	// Workarounds based on findings by Jim Driscoll
-	// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
-	globalEval: function( data ) {
-		if ( data && rnotwhite.test( data ) ) {
-			// We use execScript on Internet Explorer
-			// We use an anonymous function so that context is window
-			// rather than jQuery in Firefox
-			( window.execScript || function( data ) {
-				window[ "eval" ].call( window, data );
-			} )( data );
-		}
-	},
-
-	// Convert dashed to camelCase; used by the css and data modules
-	// Microsoft forgot to hump their vendor prefix (#9572)
-	camelCase: function( string ) {
-		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
-	},
-
-	nodeName: function( elem, name ) {
-		return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
-	},
-
-	// args is for internal usage only
-	each: function( object, callback, args ) {
-		var name, i = 0,
-			length = object.length,
-			isObj = length === undefined || jQuery.isFunction( object );
-
-		if ( args ) {
-			if ( isObj ) {
-				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 ( isObj ) {
-				for ( name in object ) {
-					if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
-						break;
-					}
-				}
-			} else {
-				for ( ; i < length; ) {
-					if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
-						break;
-					}
-				}
-			}
-		}
-
-		return object;
-	},
-
-	// Use native String.trim function wherever possible
-	trim: trim ?
-		function( text ) {
-			return text == null ?
-				"" :
-				trim.call( text );
-		} :
-
-		// Otherwise use our own trimming functionality
-		function( text ) {
-			return text == null ?
-				"" :
-				text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
-		},
-
-	// results is for internal usage only
-	makeArray: function( array, results ) {
-		var ret = results || [];
-
-		if ( array != null ) {
-			// The window, strings (and functions) also have 'length'
-			// The extra typeof function check is to prevent crashes
-			// in Safari 2 (See: #3039)
-			// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
-			var type = jQuery.type( array );
-
-			if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
-				push.call( ret, array );
-			} else {
-				jQuery.merge( ret, array );
-			}
-		}
-
-		return ret;
-	},
-
-	inArray: function( elem, array ) {
-		if ( !array ) {
-			return -1;
-		}
-
-		if ( indexOf ) {
-			return indexOf.call( array, elem );
-		}
-
-		for ( var i = 0, length = array.length; i < length; i++ ) {
-			if ( array[ i ] === elem ) {
-				return i;
-			}
-		}
-
-		return -1;
-	},
-
-	merge: function( first, second ) {
-		var i = first.length,
-			j = 0;
-
-		if ( typeof second.length === "number" ) {
-			for ( var l = second.length; j < l; j++ ) {
-				first[ i++ ] = second[ j ];
-			}
-
-		} else {
-			while ( second[j] !== undefined ) {
-				first[ i++ ] = second[ j++ ];
-			}
-		}
-
-		first.length = i;
-
-		return first;
-	},
-
-	grep: function( elems, callback, inv ) {
-		var ret = [], retVal;
-		inv = !!inv;
-
-		// Go through the array, only saving the items
-		// that pass the validator function
-		for ( var i = 0, length = elems.length; i < length; i++ ) {
-			retVal = !!callback( elems[ i ], i );
-			if ( inv !== retVal ) {
-				ret.push( elems[ i ] );
-			}
-		}
-
-		return ret;
-	},
-
-	// arg is for internal usage only
-	map: function( elems, callback, arg ) {
-		var value, key, ret = [],
-			i = 0,
-			length = elems.length,
-			// jquery objects are treated as arrays
-			isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
-		// Go through the array, translating each of the items to their
-		if ( isArray ) {
-			for ( ; i < length; i++ ) {
-				value = callback( elems[ i ], i, arg );
-
-				if ( value != null ) {
-					ret[ ret.length ] = value;
-				}
-			}
-
-		// Go through every key on the object,
-		} else {
-			for ( key in elems ) {
-				value = callback( elems[ key ], key, arg );
-
-				if ( value != null ) {
-					ret[ ret.length ] = value;
-				}
-			}
-		}
-
-		// Flatten any nested arrays
-		return ret.concat.apply( [], ret );
-	},
-
-	// A global GUID counter for objects
-	guid: 1,
-
-	// Bind a function to a context, optionally partially applying any
-	// arguments.
-	proxy: function( fn, context ) {
-		if ( typeof context === "string" ) {
-			var tmp = fn[ context ];
-			context = fn;
-			fn = tmp;
-		}
-
-		// Quick check to determine if target is callable, in the spec
-		// this throws a TypeError, but we will just return undefined.
-		if ( !jQuery.isFunction( fn ) ) {
-			return undefined;
-		}
-
-		// Simulated bind
-		var args = slice.call( arguments, 2 ),
-			proxy = function() {
-				return fn.apply( context, args.concat( slice.call( arguments ) ) );
-			};
-
-		// 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 || jQuery.guid++;
-
-		return proxy;
-	},
-
-	// Mutifunctional method to get and set values to a collection
-	// The value/s can optionally be executed if it's a function
-	access: function( elems, key, value, exec, fn, pass ) {
-		var length = elems.length;
-
-		// Setting many attributes
-		if ( typeof key === "object" ) {
-			for ( var k in key ) {
-				jQuery.access( elems, k, key[k], exec, fn, value );
-			}
-			return elems;
-		}
-
-		// Setting one attribute
-		if ( value !== undefined ) {
-			// Optionally, function values get executed if exec is true
-			exec = !pass && exec && jQuery.isFunction(value);
-
-			for ( var i = 0; i < length; i++ ) {
-				fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
-			}
-
-			return elems;
-		}
-
-		// Getting an attribute
-		return length ? fn( elems[0], key ) : undefined;
-	},
-
-	now: function() {
-		return (new Date()).getTime();
-	},
-
-	// Use of jQuery.browser is frowned upon.
-	// More details: http://docs.jquery.com/Utilities/jQuery.browser
-	uaMatch: function( ua ) {
-		ua = ua.toLowerCase();
-
-		var match = rwebkit.exec( ua ) ||
-			ropera.exec( ua ) ||
-			rmsie.exec( ua ) ||
-			ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
-			[];
-
-		return { browser: match[1] || "", version: match[2] || "0" };
-	},
-
-	sub: function() {
-		function jQuerySub( selector, context ) {
-			return new jQuerySub.fn.init( selector, context );
-		}
-		jQuery.extend( true, jQuerySub, this );
-		jQuerySub.superclass = this;
-		jQuerySub.fn = jQuerySub.prototype = this();
-		jQuerySub.fn.constructor = jQuerySub;
-		jQuerySub.sub = this.sub;
-		jQuerySub.fn.init = function init( selector, context ) {
-			if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
-				context = jQuerySub( context );
-			}
-
-			return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
-		};
-		jQuerySub.fn.init.prototype = jQuerySub.fn;
-		var rootjQuerySub = jQuerySub(document);
-		return jQuerySub;
-	},
-
-	browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
-	class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
-	jQuery.browser[ browserMatch.browser ] = true;
-	jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
-	jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
-	trimLeft = /^[\s\xA0]+/;
-	trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
-	DOMContentLoaded = function() {
-		document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-		jQuery.ready();
-	};
-
-} else if ( document.attachEvent ) {
-	DOMContentLoaded = function() {
-		// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
-		if ( document.readyState === "complete" ) {
-			document.detachEvent( "onreadystatechange", DOMContentLoaded );
-			jQuery.ready();
-		}
-	};
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
-	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(e) {
-		setTimeout( doScrollCheck, 1 );
-		return;
-	}
-
-	// and execute any waiting functions
-	jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-var // Promise methods
-	promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
-	// Static reference to slice
-	sliceDeferred = [].slice;
-
-jQuery.extend({
-	// Create a simple deferred (one callbacks list)
-	_Deferred: function() {
-		var // callbacks list
-			callbacks = [],
-			// stored [ context , args ]
-			fired,
-			// to avoid firing when already doing so
-			firing,
-			// flag to know if the deferred has been cancelled
-			cancelled,
-			// the deferred itself
-			deferred  = {
-
-				// done( f1, f2, ...)
-				done: function() {
-					if ( !cancelled ) {
-						var args = arguments,
-							i,
-							length,
-							elem,
-							type,
-							_fired;
-						if ( fired ) {
-							_fired = fired;
-							fired = 0;
-						}
-						for ( i = 0, length = args.length; i < length; i++ ) {
-							elem = args[ i ];
-							type = jQuery.type( elem );
-							if ( type === "array" ) {
-								deferred.done.apply( deferred, elem );
-							} else if ( type === "function" ) {
-								callbacks.push( elem );
-							}
-						}
-						if ( _fired ) {
-							deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
-						}
-					}
-					return this;
-				},
-
-				// resolve with given context and args
-				resolveWith: function( context, args ) {
-					if ( !cancelled && !fired && !firing ) {
-						// make sure args are available (#8421)
-						args = args || [];
-						firing = 1;
-						try {
-							while( callbacks[ 0 ] ) {
-								callbacks.shift().apply( context, args );
-							}
-						}
-						finally {
-							fired = [ context, args ];
-							firing = 0;
-						}
-					}
-					return this;
-				},
-
-				// resolve with this as context and given arguments
-				resolve: function() {
-					deferred.resolveWith( this, arguments );
-					return this;
-				},
-
-				// Has this deferred been resolved?
-				isResolved: function() {
-					return !!( firing || fired );
-				},
-
-				// Cancel
-				cancel: function() {
-					cancelled = 1;
-					callbacks = [];
-					return this;
-				}
-			};
-
-		return deferred;
-	},
-
-	// Full fledged deferred (two callbacks list)
-	Deferred: function( func ) {
-		var deferred = jQuery._Deferred(),
-			failDeferred = jQuery._Deferred(),
-			promise;
-		// Add errorDeferred methods, then and promise
-		jQuery.extend( deferred, {
-			then: function( doneCallbacks, failCallbacks ) {
-				deferred.done( doneCallbacks ).fail( failCallbacks );
-				return this;
-			},
-			always: function() {
-				return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
-			},
-			fail: failDeferred.done,
-			rejectWith: failDeferred.resolveWith,
-			reject: failDeferred.resolve,
-			isRejected: failDeferred.isResolved,
-			pipe: function( fnDone, fnFail ) {
-				return jQuery.Deferred(function( newDefer ) {
-					jQuery.each( {
-						done: [ fnDone, "resolve" ],
-						fail: [ fnFail, "reject" ]
-					}, function( handler, data ) {
-						var fn = data[ 0 ],
-							action = data[ 1 ],
-							returned;
-						if ( jQuery.isFunction( fn ) ) {
-							deferred[ handler ](function() {
-								returned = fn.apply( this, arguments );
-								if ( returned && jQuery.isFunction( returned.promise ) ) {
-									returned.promise().then( newDefer.resolve, newDefer.reject );
-								} else {
-									newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
-								}
-							});
-						} else {
-							deferred[ handler ]( newDefer[ action ] );
-						}
-					});
-				}).promise();
-			},
-			// Get a promise for this deferred
-			// If obj is provided, the promise aspect is added to the object
-			promise: function( obj ) {
-				if ( obj == null ) {
-					if ( promise ) {
-						return promise;
-					}
-					promise = obj = {};
-				}
-				var i = promiseMethods.length;
-				while( i-- ) {
-					obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
-				}
-				return obj;
-			}
-		});
-		// Make sure only one callback list will be used
-		deferred.done( failDeferred.cancel ).fail( deferred.cancel );
-		// Unexpose cancel
-		delete deferred.cancel;
-		// Call given func if any
-		if ( func ) {
-			func.call( deferred, deferred );
-		}
-		return deferred;
-	},
-
-	// Deferred helper
-	when: function( firstParam ) {
-		var args = arguments,
-			i = 0,
-			length = args.length,
-			count = length,
-			deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
-				firstParam :
-				jQuery.Deferred();
-		function resolveFunc( i ) {
-			return function( value ) {
-				args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
-				if ( !( --count ) ) {
-					// Strange bug in FF4:
-					// Values changed onto the arguments object sometimes end up as undefined values
-					// outside the $.when method. Cloning the object into a fresh array solves the issue
-					deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
-				}
-			};
-		}
-		if ( length > 1 ) {
-			for( ; i < length; i++ ) {
-				if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
-					args[ i ].promise().then( resolveFunc(i), deferred.reject );
-				} else {
-					--count;
-				}
-			}
-			if ( !count ) {
-				deferred.resolveWith( deferred, args );
-			}
-		} else if ( deferred !== firstParam ) {
-			deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
-		}
-		return deferred.promise();
-	}
-});
-
-
-
-jQuery.support = (function() {
-
-	var div = document.createElement( "div" ),
-		documentElement = document.documentElement,
-		all,
-		a,
-		select,
-		opt,
-		input,
-		marginDiv,
-		support,
-		fragment,
-		body,
-		testElementParent,
-		testElement,
-		testElementStyle,
-		tds,
-		events,
-		eventName,
-		i,
-		isSupported;
-
-	// Preliminary tests
-	div.setAttribute("className", "t");
-	div.innerHTML = "   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
-
-	all = div.getElementsByTagName( "*" );
-	a = div.getElementsByTagName( "a" )[ 0 ];
-
-	// Can't get basic test support
-	if ( !all || !all.length || !a ) {
-		return {};
-	}
-
-	// First batch of supports tests
-	select = document.createElement( "select" );
-	opt = select.appendChild( document.createElement("option") );
-	input = div.getElementsByTagName( "input" )[ 0 ];
-
-	support = {
-		// IE strips leading whitespace when .innerHTML is used
-		leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
-		// Make sure that tbody elements aren't automatically inserted
-		// IE will insert them into empty tables
-		tbody: !div.getElementsByTagName( "tbody" ).length,
-
-		// Make sure that link elements get serialized correctly by innerHTML
-		// This requires a wrapper element in IE
-		htmlSerialize: !!div.getElementsByTagName( "link" ).length,
-
-		// Get the style information from getAttribute
-		// (IE uses .cssText instead)
-		style: /top/.test( a.getAttribute("style") ),
-
-		// Make sure that URLs aren't manipulated
-		// (IE normalizes it by default)
-		hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
-
-		// Make sure that element opacity exists
-		// (IE uses filter instead)
-		// Use a regex to work around a WebKit issue. See #5145
-		opacity: /^0.55$/.test( a.style.opacity ),
-
-		// Verify style float existence
-		// (IE uses styleFloat instead of cssFloat)
-		cssFloat: !!a.style.cssFloat,
-
-		// Make sure that if no value is specified for a checkbox
-		// that it defaults to "on".
-		// (WebKit defaults to "" instead)
-		checkOn: ( input.value === "on" ),
-
-		// Make sure that a selected-by-default option has a working selected property.
-		// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
-		optSelected: opt.selected,
-
-		// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
-		getSetAttribute: div.className !== "t",
-
-		// Will be defined later
-		submitBubbles: true,
-		changeBubbles: true,
-		focusinBubbles: false,
-		deleteExpando: true,
-		noCloneEvent: true,
-		inlineBlockNeedsLayout: false,
-		shrinkWrapBlocks: false,
-		reliableMarginRight: true
-	};
-
-	// Make sure checked status is properly cloned
-	input.checked = true;
-	support.noCloneChecked = input.cloneNode( true ).checked;
-
-	// Make sure that the options inside disabled selects aren't marked as disabled
-	// (WebKit marks them as disabled)
-	select.disabled = true;
-	support.optDisabled = !opt.disabled;
-
-	// Test to see if it's possible to delete an expando from an element
-	// Fails in Internet Explorer
-	try {
-		delete div.test;
-	} catch( e ) {
-		support.deleteExpando = false;
-	}
-
-	if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
-		div.attachEvent( "onclick", function() {
-			// Cloning a node shouldn't copy over any
-			// bound event handlers (IE does this)
-			support.noCloneEvent = false;
-		});
-		div.cloneNode( true ).fireEvent( "onclick" );
-	}
-
-	// Check if a radio maintains it's value
-	// after being appended to the DOM
-	input = document.createElement("input");
-	input.value = "t";
-	input.setAttribute("type", "radio");
-	support.radioValue = input.value === "t";
-
-	input.setAttribute("checked", "checked");
-	div.appendChild( input );
-	fragment = document.createDocumentFragment();
-	fragment.appendChild( div.firstChild );
-
-	// WebKit doesn't clone checked state correctly in fragments
-	support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
-	div.innerHTML = "";
-
-	// Figure out if the W3C box model works as expected
-	div.style.width = div.style.paddingLeft = "1px";
-
-	body = document.getElementsByTagName( "body" )[ 0 ];
-	// We use our own, invisible, body unless the body is already present
-	// in which case we use a div (#9239)
-	testElement = document.createElement( body ? "div" : "body" );
-	testElementStyle = {
-		visibility: "hidden",
-		width: 0,
-		height: 0,
-		border: 0,
-		margin: 0,
-		background: "none"
-	};
-	if ( body ) {
-		jQuery.extend( testElementStyle, {
-			position: "absolute",
-			left: "-1000px",
-			top: "-1000px"
-		});
-	}
-	for ( i in testElementStyle ) {
-		testElement.style[ i ] = testElementStyle[ i ];
-	}
-	testElement.appendChild( div );
-	testElementParent = body || documentElement;
-	testElementParent.insertBefore( testElement, testElementParent.firstChild );
-
-	// Check if a disconnected checkbox will retain its checked
-	// value of true after appended to the DOM (IE6/7)
-	support.appendChecked = input.checked;
-
-	support.boxModel = div.offsetWidth === 2;
-
-	if ( "zoom" in div.style ) {
-		// Check if natively block-level elements act like inline-block
-		// elements when setting their display to 'inline' and giving
-		// them layout
-		// (IE < 8 does this)
-		div.style.display = "inline";
-		div.style.zoom = 1;
-		support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
-		// Check if elements with layout shrink-wrap their children
-		// (IE 6 does this)
-		div.style.display = "";
-		div.innerHTML = "<div style='width:4px;'></div>";
-		support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
-	}
-
-	div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
-	tds = div.getElementsByTagName( "td" );
-
-	// Check if table cells still have offsetWidth/Height when they are set
-	// to display:none and there are still other visible table cells in a
-	// table row; if so, offsetWidth/Height are not reliable for use when
-	// determining if an element has been hidden directly using
-	// display:none (it is still safe to use offsets if a parent element is
-	// hidden; don safety goggles and see bug #4512 for more information).
-	// (only IE 8 fails this test)
-	isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
-	tds[ 0 ].style.display = "";
-	tds[ 1 ].style.display = "none";
-
-	// Check if empty table cells still have offsetWidth/Height
-	// (IE < 8 fail this test)
-	support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-	div.innerHTML = "";
-
-	// Check if div with explicit width and no margin-right incorrectly
-	// gets computed margin-right based on width of container. For more
-	// info see bug #3333
-	// Fails in WebKit before Feb 2011 nightlies
-	// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
-	if ( document.defaultView && document.defaultView.getComputedStyle ) {
-		marginDiv = document.createElement( "div" );
-		marginDiv.style.width = "0";
-		marginDiv.style.marginRight = "0";
-		div.appendChild( marginDiv );
-		support.reliableMarginRight =
-			( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
-	}
-
-	// Remove the body element we added
-	testElement.innerHTML = "";
-	testElementParent.removeChild( testElement );
-
-	// Technique from Juriy Zaytsev
-	// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
-	// We only care about the case where non-standard event systems
-	// are used, namely in IE. Short-circuiting here helps us to
-	// avoid an eval call (in setAttribute) which can cause CSP
-	// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
-	if ( div.attachEvent ) {
-		for( i in {
-			submit: 1,
-			change: 1,
-			focusin: 1
-		} ) {
-			eventName = "on" + i;
-			isSupported = ( eventName in div );
-			if ( !isSupported ) {
-				div.setAttribute( eventName, "return;" );
-				isSupported = ( typeof div[ eventName ] === "function" );
-			}
-			support[ i + "Bubbles" ] = isSupported;
-		}
-	}
-
-	// Null connected elements to avoid leaks in IE
-	testElement = fragment = select = opt = body = marginDiv = div = input = null;
-
-	return support;
-})();
-
-// Keep track of boxModel
-jQuery.boxModel = jQuery.support.boxModel;
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
-	rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
-	cache: {},
-
-	// Please use with caution
-	uuid: 0,
-
-	// Unique for each copy of jQuery on the page
-	// Non-digits removed to match rinlinejQuery
-	expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
-	// The following elements throw uncatchable exceptions if you
-	// attempt to add expando properties to them.
-	noData: {
-		"embed": true,
-		// Ban all objects except for Flash (which handle expandos)
-		"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
-		"applet": true
-	},
-
-	hasData: function( elem ) {
-		elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
-
-		return !!elem && !isEmptyDataObject( elem );
-	},
-
-	data: function( elem, name, data, pvt /* Internal Use Only */ ) {
-		if ( !jQuery.acceptData( elem ) ) {
-			return;
-		}
-
-		var thisCache, ret,
-			internalKey = jQuery.expando,
-			getByName = typeof name === "string",
-
-			// We have to handle DOM nodes and JS objects differently because IE6-7
-			// can't GC object references properly across the DOM-JS boundary
-			isNode = elem.nodeType,
-
-			// Only DOM nodes need the global jQuery cache; JS object data is
-			// attached directly to the object so GC can occur automatically
-			cache = isNode ? jQuery.cache : elem,
-
-			// Only defining an ID for JS objects if its cache already exists allows
-			// the code to shortcut on the same path as a DOM node with no cache
-			id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
-
-		// Avoid doing any more work than we need to when trying to get data on an
-		// object that has no data at all
-		if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
-			return;
-		}
-
-		if ( !id ) {
-			// Only DOM nodes need a new unique ID for each element since their data
-			// ends up in the global cache
-			if ( isNode ) {
-				elem[ jQuery.expando ] = id = ++jQuery.uuid;
-			} else {
-				id = jQuery.expando;
-			}
-		}
-
-		if ( !cache[ id ] ) {
-			cache[ id ] = {};
-
-			// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
-			// metadata on plain JS objects when the object is serialized using
-			// JSON.stringify
-			if ( !isNode ) {
-				cache[ id ].toJSON = jQuery.noop;
-			}
-		}
-
-		// An object can be passed to jQuery.data instead of a key/value pair; this gets
-		// shallow copied over onto the existing cache
-		if ( typeof name === "object" || typeof name === "function" ) {
-			if ( pvt ) {
-				cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
-			} else {
-				cache[ id ] = jQuery.extend(cache[ id ], name);
-			}
-		}
-
-		thisCache = cache[ id ];
-
-		// Internal jQuery data is stored in a separate object inside the object's data
-		// cache in order to avoid key collisions between internal data and user-defined
-		// data
-		if ( pvt ) {
-			if ( !thisCache[ internalKey ] ) {
-				thisCache[ internalKey ] = {};
-			}
-
-			thisCache = thisCache[ internalKey ];
-		}
-
-		if ( data !== undefined ) {
-			thisCache[ jQuery.camelCase( name ) ] = data;
-		}
-
-		// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
-		// not attempt to inspect the internal events object using jQuery.data, as this
-		// internal data object is undocumented and subject to change.
-		if ( name === "events" && !thisCache[name] ) {
-			return thisCache[ internalKey ] && thisCache[ internalKey ].events;
-		}
-
-		// Check for both converted-to-camel and non-converted data property names
-		// If a data property was specified
-		if ( getByName ) {
-
-			// First Try to find as-is property data
-			ret = thisCache[ name ];
-
-			// Test for null|undefined property data
-			if ( ret == null ) {
-
-				// Try to find the camelCased property
-				ret = thisCache[ jQuery.camelCase( name ) ];
-			}
-		} else {
-			ret = thisCache;
-		}
-
-		return ret;
-	},
-
-	removeData: function( elem, name, pvt /* Internal Use Only */ ) {
-		if ( !jQuery.acceptData( elem ) ) {
-			return;
-		}
-
-		var thisCache,
-
-			// Reference to internal data cache key
-			internalKey = jQuery.expando,
-
-			isNode = elem.nodeType,
-
-			// See jQuery.data for more information
-			cache = isNode ? jQuery.cache : elem,
-
-			// See jQuery.data for more information
-			id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
-		// If there is already no cache entry for this object, there is no
-		// purpose in continuing
-		if ( !cache[ id ] ) {
-			return;
-		}
-
-		if ( name ) {
-
-			thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
-
-			if ( thisCache ) {
-
-				// Support interoperable removal of hyphenated or camelcased keys
-				if ( !thisCache[ name ] ) {
-					name = jQuery.camelCase( name );
-				}
-
-				delete thisCache[ name ];
-
-				// If there is no data left in the cache, we want to continue
-				// and let the cache object itself get destroyed
-				if ( !isEmptyDataObject(thisCache) ) {
-					return;
-				}
-			}
-		}
-
-		// See jQuery.data for more information
-		if ( pvt ) {
-			delete cache[ id ][ internalKey ];
-
-			// Don't destroy the parent cache unless the internal data object
-			// had been the only thing left in it
-			if ( !isEmptyDataObject(cache[ id ]) ) {
-				return;
-			}
-		}
-
-		var internalCache = cache[ id ][ internalKey ];
-
-		// Browsers that fail expando deletion also refuse to delete expandos on
-		// the window, but it will allow it on all other JS objects; other browsers
-		// don't care
-		// Ensure that `cache` is not a window object #10080
-		if ( jQuery.support.deleteExpando || !cache.setInterval ) {
-			delete cache[ id ];
-		} else {
-			cache[ id ] = null;
-		}
-
-		// We destroyed the entire user cache at once because it's faster than
-		// iterating through each key, but we need to continue to persist internal
-		// data if it existed
-		if ( internalCache ) {
-			cache[ id ] = {};
-			// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
-			// metadata on plain JS objects when the object is serialized using
-			// JSON.stringify
-			if ( !isNode ) {
-				cache[ id ].toJSON = jQuery.noop;
-			}
-
-			cache[ id ][ internalKey ] = internalCache;
-
-		// Otherwise, we need to eliminate the expando on the node to avoid
-		// false lookups in the cache for entries that no longer exist
-		} else if ( isNode ) {
-			// IE does not allow us to delete expando properties from nodes,
-			// nor does it have a removeAttribute function on Document nodes;
-			// we must handle all of these cases
-			if ( jQuery.support.deleteExpando ) {
-				delete elem[ jQuery.expando ];
-			} else if ( elem.removeAttribute ) {
-				elem.removeAttribute( jQuery.expando );
-			} else {
-				elem[ jQuery.expando ] = null;
-			}
-		}
-	},
-
-	// For internal use only.
-	_data: function( elem, name, data ) {
-		return jQuery.data( elem, name, data, true );
-	},
-
-	// A method for determining if a DOM node can handle the data expando
-	acceptData: function( elem ) {
-		if ( elem.nodeName ) {
-			var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
-			if ( match ) {
-				return !(match === true || elem.getAttribute("classid") !== match);
-			}
-		}
-
-		return true;
-	}
-});
-
-jQuery.fn.extend({
-	data: function( key, value ) {
-		var data = null;
-
-		if ( typeof key === "undefined" ) {
-			if ( this.length ) {
-				data = jQuery.data( this[0] );
-
-				if ( this[0].nodeType === 1 ) {
-			    var attr = this[0].attributes, name;
-					for ( var i = 0, l = attr.length; i < l; i++ ) {
-						name = attr[i].name;
-
-						if ( name.indexOf( "data-" ) === 0 ) {
-							name = jQuery.camelCase( name.substring(5) );
-
-							dataAttr( this[0], name, data[ name ] );
-						}
-					}
-				}
-			}
-
-			return data;
-
-		} else if ( typeof key === "object" ) {
-			return this.each(function() {
-				jQuery.data( this, key );
-			});
-		}
-
-		var parts = key.split(".");
-		parts[1] = parts[1] ? "." + parts[1] : "";
-
-		if ( value === undefined ) {
-			data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
-			// Try to fetch any internally stored data first
-			if ( data === undefined && this.length ) {
-				data = jQuery.data( this[0], key );
-				data = dataAttr( this[0], key, data );
-			}
-
-			return data === undefined && parts[1] ?
-				this.data( parts[0] ) :
-				data;
-
-		} else {
-			return this.each(function() {
-				var $this = jQuery( this ),
-					args = [ parts[0], value ];
-
-				$this.triggerHandler( "setData" + parts[1] + "!", args );
-				jQuery.data( this, key, value );
-				$this.triggerHandler( "changeData" + parts[1] + "!", args );
-			});
-		}
-	},
-
-	removeData: function( key ) {
-		return this.each(function() {
-			jQuery.removeData( this, key );
-		});
-	}
-});
-
-function dataAttr( elem, key, data ) {
-	// If nothing was found internally, try to fetch any
-	// data from the HTML5 data-* attribute
-	if ( data === undefined && elem.nodeType === 1 ) {
-
-		var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
-		data = elem.getAttribute( name );
-
-		if ( typeof data === "string" ) {
-			try {
-				data = data === "true" ? true :
-				data === "false" ? false :
-				data === "null" ? null :
-				!jQuery.isNaN( data ) ? parseFloat( data ) :
-					rbrace.test( data ) ? jQuery.parseJSON( data ) :
-					data;
-			} catch( e ) {}
-
-			// Make sure we set the data so it isn't changed later
-			jQuery.data( elem, key, data );
-
-		} else {
-			data = undefined;
-		}
-	}
-
-	return data;
-}
-
-// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
-// property to be considered empty objects; this property always exists in
-// order to make sure JSON.stringify does not expose internal metadata
-function isEmptyDataObject( obj ) {
-	for ( var name in obj ) {
-		if ( name !== "toJSON" ) {
-			return false;
-		}
-	}
-
-	return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
-	var deferDataKey = type + "defer",
-		queueDataKey = type + "queue",
-		markDataKey = type + "mark",
-		defer = jQuery.data( elem, deferDataKey, undefined, true );
-	if ( defer &&
-		( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
-		( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
-		// Give room for hard-coded callbacks to fire first
-		// and eventually mark/queue something else on the element
-		setTimeout( function() {
-			if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
-				!jQuery.data( elem, markDataKey, undefined, true ) ) {
-				jQuery.removeData( elem, deferDataKey, true );
-				defer.resolve();
-			}
-		}, 0 );
-	}
-}
-
-jQuery.extend({
-
-	_mark: function( elem, type ) {
-		if ( elem ) {
-			type = (type || "fx") + "mark";
-			jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
-		}
-	},
-
-	_unmark: function( force, elem, type ) {
-		if ( force !== true ) {
-			type = elem;
-			elem = force;
-			force = false;
-		}
-		if ( elem ) {
-			type = type || "fx";
-			var key = type + "mark",
-				count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
-			if ( count ) {
-				jQuery.data( elem, key, count, true );
-			} else {
-				jQuery.removeData( elem, key, true );
-				handleQueueMarkDefer( elem, type, "mark" );
-			}
-		}
-	},
-
-	queue: function( elem, type, data ) {
-		if ( elem ) {
-			type = (type || "fx") + "queue";
-			var q = jQuery.data( elem, type, undefined, true );
-			// Speed up dequeue by getting out quickly if this is just a lookup
-			if ( data ) {
-				if ( !q || jQuery.isArray(data) ) {
-					q = jQuery.data( elem, type, jQuery.makeArray(data), true );
-				} else {
-					q.push( data );
-				}
-			}
-			return q || [];
-		}
-	},
-
-	dequeue: function( elem, type ) {
-		type = type || "fx";
-
-		var queue = jQuery.queue( elem, type ),
-			fn = queue.shift(),
-			defer;
-
-		// If the fx queue is dequeued, always remove the progress sentinel
-		if ( fn === "inprogress" ) {
-			fn = queue.shift();
-		}
-
-		if ( fn ) {
-			// Add a progress sentinel to prevent the fx queue from being
-			// automatically dequeued
-			if ( type === "fx" ) {
-				queue.unshift("inprogress");
-			}
-
-			fn.call(elem, function() {
-				jQuery.dequeue(elem, type);
-			});
-		}
-
-		if ( !queue.length ) {
-			jQuery.removeData( elem, type + "queue", true );
-			handleQueueMarkDefer( elem, type, "queue" );
-		}
-	}
-});
-
-jQuery.fn.extend({
-	queue: function( type, data ) {
-		if ( typeof type !== "string" ) {
-			data = type;
-			type = "fx";
-		}
-
-		if ( data === undefined ) {
-			return jQuery.queue( this[0], type );
-		}
-		return this.each(function() {
-			var queue = jQuery.queue( this, type, data );
-
-			if ( type === "fx" && queue[0] !== "inprogress" ) {
-				jQuery.dequeue( this, type );
-			}
-		});
-	},
-	dequeue: function( type ) {
-		return this.each(function() {
-			jQuery.dequeue( this, type );
-		});
-	},
-	// Based off of the plugin by Clint Helfers, with permission.
-	// http://blindsignals.com/index.php/2009/07/jquery-delay/
-	delay: function( time, type ) {
-		time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
-		type = type || "fx";
-
-		return this.queue( type, function() {
-			var elem = this;
-			setTimeout(function() {
-				jQuery.dequeue( elem, type );
-			}, time );
-		});
-	},
-	clearQueue: function( type ) {
-		return this.queue( type || "fx", [] );
-	},
-	// Get a promise resolved when queues of a certain type
-	// are emptied (fx is the type by default)
-	promise: function( type, object ) {
-		if ( typeof type !== "string" ) {
-			object = type;
-			type = undefined;
-		}
-		type = type || "fx";
-		var defer = jQuery.Deferred(),
-			elements = this,
-			i = elements.length,
-			count = 1,
-			deferDataKey = type + "defer",
-			queueDataKey = type + "queue",
-			markDataKey = type + "mark",
-			tmp;
-		function resolve() {
-			if ( !( --count ) ) {
-				defer.resolveWith( elements, [ elements ] );
-			}
-		}
-		while( i-- ) {
-			if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
-					( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
-						jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
-					jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
-				count++;
-				tmp.done( resolve );
-			}
-		}
-		resolve();
-		return defer.promise();
-	}
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
-	rspace = /\s+/,
-	rreturn = /\r/g,
-	rtype = /^(?:button|input)$/i,
-	rfocusable = /^(?:button|input|object|select|textarea)$/i,
-	rclickable = /^a(?:rea)?$/i,
-	rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
-	nodeHook, boolHook;
-
-jQuery.fn.extend({
-	attr: function( name, value ) {
-		return jQuery.access( this, name, value, true, jQuery.attr );
-	},
-
-	removeAttr: function( name ) {
-		return this.each(function() {
-			jQuery.removeAttr( this, name );
-		});
-	},
-	
-	prop: function( name, value ) {
-		return jQuery.access( this, name, value, true, jQuery.prop );
-	},
-	
-	removeProp: function( name ) {
-		name = jQuery.propFix[ name ] || name;
-		return this.each(function() {
-			// try/catch handles cases where IE balks (such as removing a property on window)
-			try {
-				this[ name ] = undefined;
-				delete this[ name ];
-			} catch( e ) {}
-		});
-	},
-
-	addClass: function( value ) {
-		var classNames, i, l, elem,
-			setClass, c, cl;
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( j ) {
-				jQuery( this ).addClass( value.call(this, j, this.className) );
-			});
-		}
-
-		if ( value && typeof value === "string" ) {
-			classNames = value.split( rspace );
-
-			for ( i = 0, l = this.length; i < l; i++ ) {
-				elem = this[ i ];
-
-				if ( elem.nodeType === 1 ) {
-					if ( !elem.className && classNames.length === 1 ) {
-						elem.className = value;
-
-					} else {
-						setClass = " " + elem.className + " ";
-
-						for ( c = 0, cl = classNames.length; c < cl; c++ ) {
-							if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
-								setClass += classNames[ c ] + " ";
-							}
-						}
-						elem.className = jQuery.trim( setClass );
-					}
-				}
-			}
-		}
-
-		return this;
-	},
-
-	removeClass: function( value ) {
-		var classNames, i, l, elem, className, c, cl;
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( j ) {
-				jQuery( this ).removeClass( value.call(this, j, this.className) );
-			});
-		}
-
-		if ( (value && typeof value === "string") || value === undefined ) {
-			classNames = (value || "").split( rspace );
-
-			for ( i = 0, l = this.length; i < l; i++ ) {
-				elem = this[ i ];
-
-				if ( elem.nodeType === 1 && elem.className ) {
-					if ( value ) {
-						className = (" " + elem.className + " ").replace( rclass, " " );
-						for ( c = 0, cl = classNames.length; c < cl; c++ ) {
-							className = className.replace(" " + classNames[ c ] + " ", " ");
-						}
-						elem.className = jQuery.trim( className );
-
-					} else {
-						elem.className = "";
-					}
-				}
-			}
-		}
-
-		return this;
-	},
-
-	toggleClass: function( value, stateVal ) {
-		var type = typeof value,
-			isBool = typeof stateVal === "boolean";
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( i ) {
-				jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
-			});
-		}
-
-		return this.each(function() {
-			if ( type === "string" ) {
-				// toggle individual class names
-				var className,
-					i = 0,
-					self = jQuery( this ),
-					state = stateVal,
-					classNames = value.split( rspace );
-
-				while ( (className = classNames[ i++ ]) ) {
-					// check each className given, space seperated list
-					state = isBool ? state : !self.hasClass( className );
-					self[ state ? "addClass" : "removeClass" ]( className );
-				}
-
-			} else if ( type === "undefined" || type === "boolean" ) {
-				if ( this.className ) {
-					// store className if set
-					jQuery._data( this, "__className__", this.className );
-				}
-
-				// toggle whole className
-				this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
-			}
-		});
-	},
-
-	hasClass: function( selector ) {
-		var className = " " + selector + " ";
-		for ( var i = 0, l = this.length; i < l; i++ ) {
-			if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
-				return true;
-			}
-		}
-
-		return false;
-	},
-
-	val: function( value ) {
-		var hooks, ret,
-			elem = this[0];
-		
-		if ( !arguments.length ) {
-			if ( elem ) {
-				hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
-				if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
-					return ret;
-				}
-
-				ret = elem.value;
-
-				return typeof ret === "string" ? 
-					// handle most common string cases
-					ret.replace(rreturn, "") : 
-					// handle cases where value is null/undef or number
-					ret == null ? "" : ret;
-			}
-
-			return undefined;
-		}
-
-		var isFunction = jQuery.isFunction( value );
-
-		return this.each(function( i ) {
-			var self = jQuery(this), val;
-
-			if ( this.nodeType !== 1 ) {
-				return;
-			}
-
-			if ( isFunction ) {
-				val = value.call( this, i, self.val() );
-			} else {
-				val = value;
-			}
-
-			// Treat null/undefined as ""; convert numbers to string
-			if ( val == null ) {
-				val = "";
-			} else if ( typeof val === "number" ) {
-				val += "";
-			} else if ( jQuery.isArray( val ) ) {
-				val = jQuery.map(val, function ( value ) {
-					return value == null ? "" : value + "";
-				});
-			}
-
-			hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
-			// If set returns undefined, fall back to normal setting
-			if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
-				this.value = val;
-			}
-		});
-	}
-});
-
-jQuery.extend({
-	valHooks: {
-		option: {
-			get: function( elem ) {
-				// attributes.value is undefined in Blackberry 4.7 but
-				// uses .value. See #6932
-				var val = elem.attributes.value;
-				return !val || val.specified ? elem.value : elem.text;
-			}
-		},
-		select: {
-			get: function( elem ) {
-				var value,
-					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 ];
-
-					// Don't return options that are disabled or in a disabled optgroup
-					if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
-							(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
-						// Get the specific value for the option
-						value = jQuery( option ).val();
-
-						// We don't need an array for one selects
-						if ( one ) {
-							return value;
-						}
-
-						// Multi-Selects return an array
-						values.push( value );
-					}
-				}
-
-				// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
-				if ( one && !values.length && options.length ) {
-					return jQuery( options[ index ] ).val();
-				}
-
-				return values;
-			},
-
-			set: function( elem, value ) {
-				var values = jQuery.makeArray( value );
-
-				jQuery(elem).find("option").each(function() {
-					this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
-				});
-
-				if ( !values.length ) {
-					elem.selectedIndex = -1;
-				}
-				return values;
-			}
-		}
-	},
-
-	attrFn: {
-		val: true,
-		css: true,
-		html: true,
-		text: true,
-		data: true,
-		width: true,
-		height: true,
-		offset: true
-	},
-	
-	attrFix: {
-		// Always normalize to ensure hook usage
-		tabindex: "tabIndex"
-	},
-	
-	attr: function( elem, name, value, pass ) {
-		var nType = elem.nodeType;
-		
-		// don't get/set attributes on text, comment and attribute nodes
-		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
-			return undefined;
-		}
-
-		if ( pass && name in jQuery.attrFn ) {
-			return jQuery( elem )[ name ]( value );
-		}
-
-		// Fallback to prop when attributes are not supported
-		if ( !("getAttribute" in elem) ) {
-			return jQuery.prop( elem, name, value );
-		}
-
-		var ret, hooks,
-			notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
-		// Normalize the name if needed
-		if ( notxml ) {
-			name = jQuery.attrFix[ name ] || name;
-
-			hooks = jQuery.attrHooks[ name ];
-
-			if ( !hooks ) {
-				// Use boolHook for boolean attributes
-				if ( rboolean.test( name ) ) {
-					hooks = boolHook;
-
-				// Use nodeHook if available( IE6/7 )
-				} else if ( nodeHook ) {
-					hooks = nodeHook;
-				}
-			}
-		}
-
-		if ( value !== undefined ) {
-
-			if ( value === null ) {
-				jQuery.removeAttr( elem, name );
-				return undefined;
-
-			} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
-				return ret;
-
-			} else {
-				elem.setAttribute( name, "" + value );
-				return value;
-			}
-
-		} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
-			return ret;
-
-		} else {
-
-			ret = elem.getAttribute( name );
-
-			// Non-existent attributes return null, we normalize to undefined
-			return ret === null ?
-				undefined :
-				ret;
-		}
-	},
-
-	removeAttr: function( elem, name ) {
-		var propName;
-		if ( elem.nodeType === 1 ) {
-			name = jQuery.attrFix[ name ] || name;
-
-			jQuery.attr( elem, name, "" );
-			elem.removeAttribute( name );
-
-			// Set corresponding property to false for boolean attributes
-			if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
-				elem[ propName ] = false;
-			}
-		}
-	},
-
-	attrHooks: {
-		type: {
-			set: function( elem, value ) {
-				// We can't allow the type property to be changed (since it causes problems in IE)
-				if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
-					jQuery.error( "type property can't be changed" );
-				} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
-					// Setting the type on a radio button after the value resets the value in IE6-9
-					// Reset value to it's default in case type is set after value
-					// This is for element creation
-					var val = elem.value;
-					elem.setAttribute( "type", value );
-					if ( val ) {
-						elem.value = val;
-					}
-					return value;
-				}
-			}
-		},
-		// Use the value property for back compat
-		// Use the nodeHook for button elements in IE6/7 (#1954)
-		value: {
-			get: function( elem, name ) {
-				if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
-					return nodeHook.get( elem, name );
-				}
-				return name in elem ?
-					elem.value :
-					null;
-			},
-			set: function( elem, value, name ) {
-				if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
-					return nodeHook.set( elem, value, name );
-				}
-				// Does not return so that setAttribute is also used
-				elem.value = value;
-			}
-		}
-	},
-
-	propFix: {
-		tabindex: "tabIndex",
-		readonly: "readOnly",
-		"for": "htmlFor",
-		"class": "className",
-		maxlength: "maxLength",
-		cellspacing: "cellSpacing",
-		cellpadding: "cellPadding",
-		rowspan: "rowSpan",
-		colspan: "colSpan",
-		usemap: "useMap",
-		frameborder: "frameBorder",
-		contenteditable: "contentEditable"
-	},
-	
-	prop: function( elem, name, value ) {
-		var nType = elem.nodeType;
-
-		// don't get/set properties on text, comment and attribute nodes
-		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
-			return undefined;
-		}
-
-		var ret, hooks,
-			notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
-		if ( notxml ) {
-			// Fix name and attach hooks
-			name = jQuery.propFix[ name ] || name;
-			hooks = jQuery.propHooks[ name ];
-		}
-
-		if ( value !== undefined ) {
-			if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
-				return ret;
-
-			} else {
-				return (elem[ name ] = value);
-			}
-
-		} else {
-			if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
-				return ret;
-
-			} else {
-				return elem[ name ];
-			}
-		}
-	},
-	
-	propHooks: {
-		tabIndex: {
-			get: function( elem ) {
-				// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
-				// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
-				var attributeNode = elem.getAttributeNode("tabindex");
-
-				return attributeNode && attributeNode.specified ?
-					parseInt( attributeNode.value, 10 ) :
-					rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
-						0 :
-						undefined;
-			}
-		}
-	}
-});
-
-// Add the tabindex propHook to attrHooks for back-compat
-jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
-
-// Hook for boolean attributes
-boolHook = {
-	get: function( elem, name ) {
-		// Align boolean attributes with corresponding properties
-		// Fall back to attribute presence where some booleans are not supported
-		var attrNode;
-		return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
-			name.toLowerCase() :
-			undefined;
-	},
-	set: function( elem, value, name ) {
-		var propName;
-		if ( value === false ) {
-			// Remove boolean attributes when set to false
-			jQuery.removeAttr( elem, name );
-		} else {
-			// value is true since we know at this point it's type boolean and not false
-			// Set boolean attributes to the same name and set the DOM property
-			propName = jQuery.propFix[ name ] || name;
-			if ( propName in elem ) {
-				// Only set the IDL specifically if it already exists on the element
-				elem[ propName ] = true;
-			}
-
-			elem.setAttribute( name, name.toLowerCase() );
-		}
-		return name;
-	}
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !jQuery.support.getSetAttribute ) {
-	
-	// Use this for any attribute in IE6/7
-	// This fixes almost every IE6/7 issue
-	nodeHook = jQuery.valHooks.button = {
-		get: function( elem, name ) {
-			var ret;
-			ret = elem.getAttributeNode( name );
-			// Return undefined if nodeValue is empty string
-			return ret && ret.nodeValue !== "" ?
-				ret.nodeValue :
-				undefined;
-		},
-		set: function( elem, value, name ) {
-			// Set the existing or create a new attribute node
-			var ret = elem.getAttributeNode( name );
-			if ( !ret ) {
-				ret = document.createAttribute( name );
-				elem.setAttributeNode( ret );
-			}
-			return (ret.nodeValue = value + "");
-		}
-	};
-
-	// Set width and height to auto instead of 0 on empty string( Bug #8150 )
-	// This is for removals
-	jQuery.each([ "width", "height" ], function( i, name ) {
-		jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
-			set: function( elem, value ) {
-				if ( value === "" ) {
-					elem.setAttribute( name, "auto" );
-					return value;
-				}
-			}
-		});
-	});
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
-	jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
-		jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
-			get: function( elem ) {
-				var ret = elem.getAttribute( name, 2 );
-				return ret === null ? undefined : ret;
-			}
-		});
-	});
-}
-
-if ( !jQuery.support.style ) {
-	jQuery.attrHooks.style = {
-		get: function( elem ) {
-			// Return undefined in the case of empty string
-			// Normalize to lowercase since IE uppercases css property names
-			return elem.style.cssText.toLowerCase() || undefined;
-		},
-		set: function( elem, value ) {
-			return (elem.style.cssText = "" + value);
-		}
-	};
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
-	jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
-		get: function( elem ) {
-			var parent = elem.parentNode;
-
-			if ( parent ) {
-				parent.selectedIndex;
-
-				// Make sure that it also works with optgroups, see #5701
-				if ( parent.parentNode ) {
-					parent.parentNode.selectedIndex;
-				}
-			}
-			return null;
-		}
-	});
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
-	jQuery.each([ "radio", "checkbox" ], function() {
-		jQuery.valHooks[ this ] = {
-			get: function( elem ) {
-				// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
-				return elem.getAttribute("value") === null ? "on" : elem.value;
-			}
-		};
-	});
-}
-jQuery.each([ "radio", "checkbox" ], function() {
-	jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
-		set: function( elem, value ) {
-			if ( jQuery.isArray( value ) ) {
-				return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
-			}
-		}
-	});
-});
-
-
-
-
-var rnamespaces = /\.(.*)$/,
-	rformElems = /^(?:textarea|input|select)$/i,
-	rperiod = /\./g,
-	rspaces = / /g,
-	rescape = /[^\w\s.|`]/g,
-	fcleanup = function( nm ) {
-		return nm.replace(rescape, "\\$&");
-	};
-
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code originated 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;
-		}
-
-		if ( handler === false ) {
-			handler = returnFalse;
-		} else if ( !handler ) {
-			// Fixes bug #7229. Fix recommended by jdalton
-			return;
-		}
-
-		var handleObjIn, handleObj;
-
-		if ( handler.handler ) {
-			handleObjIn = handler;
-			handler = handleObjIn.handler;
-		}
-
-		// Make sure that the function being executed has a unique ID
-		if ( !handler.guid ) {
-			handler.guid = jQuery.guid++;
-		}
-
-		// Init the element's event structure
-		var elemData = jQuery._data( elem );
-
-		// If no elemData is found then we must be trying to bind to one of the
-		// banned noData elements
-		if ( !elemData ) {
-			return;
-		}
-
-		var events = elemData.events,
-			eventHandle = elemData.handle;
-
-		if ( !events ) {
-			elemData.events = events = {};
-		}
-
-		if ( !eventHandle ) {
-			elemData.handle = eventHandle = function( e ) {
-				// Discard the second event of a jQuery.event.trigger() and
-				// when an event is called after a page has unloaded
-				return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
-					jQuery.event.handle.apply( eventHandle.elem, arguments ) :
-					undefined;
-			};
-		}
-
-		// Add elem as a property of the handle function
-		// This is to prevent a memory leak with non-native events in IE.
-		eventHandle.elem = elem;
-
-		// Handle multiple events separated by a space
-		// jQuery(...).bind("mouseover mouseout", fn);
-		types = types.split(" ");
-
-		var type, i = 0, namespaces;
-
-		while ( (type = types[ i++ ]) ) {
-			handleObj = handleObjIn ?
-				jQuery.extend({}, handleObjIn) :
-				{ handler: handler, data: data };
-
-			// Namespaced event handlers
-			if ( type.indexOf(".") > -1 ) {
-				namespaces = type.split(".");
-				type = namespaces.shift();
-				handleObj.namespace = namespaces.slice(0).sort().join(".");
-
-			} else {
-				namespaces = [];
-				handleObj.namespace = "";
-			}
-
-			handleObj.type = type;
-			if ( !handleObj.guid ) {
-				handleObj.guid = handler.guid;
-			}
-
-			// Get the current list of functions bound to this event
-			var handlers = events[ type ],
-				special = jQuery.event.special[ 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 ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
-					// Bind the global event handler to the element
-					if ( elem.addEventListener ) {
-						elem.addEventListener( type, eventHandle, false );
-
-					} else if ( elem.attachEvent ) {
-						elem.attachEvent( "on" + type, eventHandle );
-					}
-				}
-			}
-
-			if ( special.add ) {
-				special.add.call( elem, handleObj );
-
-				if ( !handleObj.handler.guid ) {
-					handleObj.handler.guid = handler.guid;
-				}
-			}
-
-			// Add the function to the element's handler list
-			handlers.push( handleObj );
-
-			// Keep track of which events have been used, for event optimization
-			jQuery.event.global[ type ] = true;
-		}
-
-		// Nullify elem to prevent memory leaks in IE
-		elem = null;
-	},
-
-	global: {},
-
-	// Detach an event or set of events from an element
-	remove: function( elem, types, handler, pos ) {
-		// don't do events on text and comment nodes
-		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
-			return;
-		}
-
-		if ( handler === false ) {
-			handler = returnFalse;
-		}
-
-		var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
-			elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
-			events = elemData && elemData.events;
-
-		if ( !elemData || !events ) {
-			return;
-		}
-
-		// types is actually an event object here
-		if ( types && types.type ) {
-			handler = types.handler;
-			types = types.type;
-		}
-
-		// Unbind all events for the element
-		if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
-			types = types || "";
-
-			for ( type in events ) {
-				jQuery.event.remove( elem, type + types );
-			}
-
-			return;
-		}
-
-		// Handle multiple events separated by a space
-		// jQuery(...).unbind("mouseover mouseout", fn);
-		types = types.split(" ");
-
-		while ( (type = types[ i++ ]) ) {
-			origType = type;
-			handleObj = null;
-			all = type.indexOf(".") < 0;
-			namespaces = [];
-
-			if ( !all ) {
-				// Namespaced event handlers
-				namespaces = type.split(".");
-				type = namespaces.shift();
-
-				namespace = new RegExp("(^|\\.)" +
-					jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
-			}
-
-			eventType = events[ type ];
-
-			if ( !eventType ) {
-				continue;
-			}
-
-			if ( !handler ) {
-				for ( j = 0; j < eventType.length; j++ ) {
-					handleObj = eventType[ j ];
-
-					if ( all || namespace.test( handleObj.namespace ) ) {
-						jQuery.event.remove( elem, origType, handleObj.handler, j );
-						eventType.splice( j--, 1 );
-					}
-				}
-
-				continue;
-			}
-
-			special = jQuery.event.special[ type ] || {};
-
-			for ( j = pos || 0; j < eventType.length; j++ ) {
-				handleObj = eventType[ j ];
-
-				if ( handler.guid === handleObj.guid ) {
-					// remove the given handler for the given type
-					if ( all || namespace.test( handleObj.namespace ) ) {
-						if ( pos == null ) {
-							eventType.splice( j--, 1 );
-						}
-
-						if ( special.remove ) {
-							special.remove.call( elem, handleObj );
-						}
-					}
-
-					if ( pos != null ) {
-						break;
-					}
-				}
-			}
-
-			// remove generic event handler if no more handlers exist
-			if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
-				if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
-					jQuery.removeEvent( elem, type, elemData.handle );
-				}
-
-				ret = null;
-				delete events[ type ];
-			}
-		}
-
-		// Remove the expando if it's no longer used
-		if ( jQuery.isEmptyObject( events ) ) {
-			var handle = elemData.handle;
-			if ( handle ) {
-				handle.elem = null;
-			}
-
-			delete elemData.events;
-			delete elemData.handle;
-
-			if ( jQuery.isEmptyObject( elemData ) ) {
-				jQuery.removeData( elem, undefined, true );
-			}
-		}
-	},
-	
-	// Events that are safe to short-circuit if no handlers are attached.
-	// Native DOM events should not be added, they may have inline handlers.
-	customEvent: {
-		"getData": true,
-		"setData": true,
-		"changeData": true
-	},
-
-	trigger: function( event, data, elem, onlyHandlers ) {
-		// Event object or event type
-		var type = event.type || event,
-			namespaces = [],
-			exclusive;
-
-		if ( type.indexOf("!") >= 0 ) {
-			// Exclusive events trigger only for the exact event (no namespaces)
-			type = type.slice(0, -1);
-			exclusive = true;
-		}
-
-		if ( type.indexOf(".") >= 0 ) {
-			// Namespaced trigger; create a regexp to match event type in handle()
-			namespaces = type.split(".");
-			type = namespaces.shift();
-			namespaces.sort();
-		}
-
-		if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
-			// No jQuery handlers for this event type, and it can't have inline handlers
-			return;
-		}
-
-		// Caller can pass in an Event, Object, or just an event type string
-		event = typeof event === "object" ?
-			// jQuery.Event object
-			event[ jQuery.expando ] ? event :
-			// Object literal
-			new jQuery.Event( type, event ) :
-			// Just the event type (string)
-			new jQuery.Event( type );
-
-		event.type = type;
-		event.exclusive = exclusive;
-		event.namespace = namespaces.join(".");
-		event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
-		
-		// triggerHandler() and global events don't bubble or run the default action
-		if ( onlyHandlers || !elem ) {
-			event.preventDefault();
-			event.stopPropagation();
-		}
-
-		// Handle a global trigger
-		if ( !elem ) {
-			// TODO: Stop taunting the data cache; remove global events and always attach to document
-			jQuery.each( jQuery.cache, function() {
-				// internalKey variable is just used to make it easier to find
-				// and potentially change this stuff later; currently it just
-				// points to jQuery.expando
-				var internalKey = jQuery.expando,
-					internalCache = this[ internalKey ];
-				if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
-					jQuery.event.trigger( event, data, internalCache.handle.elem );
-				}
-			});
-			return;
-		}
-
-		// Don't do events on text and comment nodes
-		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
-			return;
-		}
-
-		// Clean up the event in case it is being reused
-		event.result = undefined;
-		event.target = elem;
-
-		// Clone any incoming data and prepend the event, creating the handler arg list
-		data = data != null ? jQuery.makeArray( data ) : [];
-		data.unshift( event );
-
-		var cur = elem,
-			// IE doesn't like method names with a colon (#3533, #8272)
-			ontype = type.indexOf(":") < 0 ? "on" + type : "";
-
-		// Fire event on the current element, then bubble up the DOM tree
-		do {
-			var handle = jQuery._data( cur, "handle" );
-
-			event.currentTarget = cur;
-			if ( handle ) {
-				handle.apply( cur, data );
-			}
-
-			// Trigger an inline bound script
-			if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
-				event.result = false;
-				event.preventDefault();
-			}
-
-			// Bubble up to document, then to window
-			cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
-		} while ( cur && !event.isPropagationStopped() );
-
-		// If nobody prevented the default action, do it now
-		if ( !event.isDefaultPrevented() ) {
-			var old,
-				special = jQuery.event.special[ type ] || {};
-
-			if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
-				!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
-				// Call a native DOM method on the target with the same name name as the event.
-				// Can't use an .isFunction)() check here because IE6/7 fails that test.
-				// IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
-				try {
-					if ( ontype && elem[ type ] ) {
-						// Don't re-trigger an onFOO event when we call its FOO() method
-						old = elem[ ontype ];
-
-						if ( old ) {
-							elem[ ontype ] = null;
-						}
-
-						jQuery.event.triggered = type;
-						elem[ type ]();
-					}
-				} catch ( ieError ) {}
-
-				if ( old ) {
-					elem[ ontype ] = old;
-				}
-
-				jQuery.event.triggered = undefined;
-			}
-		}
-		
-		return event.result;
-	},
-
-	handle: function( event ) {
-		event = jQuery.event.fix( event || window.event );
-		// Snapshot the handlers list since a called handler may add/remove events.
-		var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
-			run_all = !event.exclusive && !event.namespace,
-			args = Array.prototype.slice.call( arguments, 0 );
-
-		// Use the fix-ed Event rather than the (read-only) native event
-		args[0] = event;
-		event.currentTarget = this;
-
-		for ( var j = 0, l = handlers.length; j < l; j++ ) {
-			var handleObj = handlers[ j ];
-
-			// Triggered event must 1) be non-exclusive and have no namespace, or
-			// 2) have namespace(s) a subset or equal to those in the bound event.
-			if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
-				// Pass in a reference to the handler function itself
-				// So that we can later remove it
-				event.handler = handleObj.handler;
-				event.data = handleObj.data;
-				event.handleObj = handleObj;
-
-				var ret = handleObj.handler.apply( this, args );
-
-				if ( ret !== undefined ) {
-					event.result = ret;
-					if ( ret === false ) {
-						event.preventDefault();
-						event.stopPropagation();
-					}
-				}
-
-				if ( event.isImmediatePropagationStopped() ) {
-					break;
-				}
-			}
-		}
-		return event.result;
-	},
-
-	props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-
-	fix: function( event ) {
-		if ( event[ jQuery.expando ] ) {
-			return event;
-		}
-
-		// store a copy of the original event object
-		// and "clone" to set read-only properties
-		var originalEvent = event;
-		event = jQuery.Event( originalEvent );
-
-		for ( var i = this.props.length, prop; i; ) {
-			prop = this.props[ --i ];
-			event[ prop ] = originalEvent[ prop ];
-		}
-
-		// Fix target property, if necessary
-		if ( !event.target ) {
-			// Fixes #1925 where srcElement might not be defined either
-			event.target = event.srcElement || document;
-		}
-
-		// 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 eventDocument = event.target.ownerDocument || document,
-				doc = eventDocument.documentElement,
-				body = eventDocument.body;
-
-			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
-			event.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);
-		}
-
-		// Add which for key events
-		if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
-			event.which = event.charCode != null ? 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 !== undefined ) {
-			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
-		}
-
-		return event;
-	},
-
-	// Deprecated, use jQuery.guid instead
-	guid: 1E8,
-
-	// Deprecated, use jQuery.proxy instead
-	proxy: jQuery.proxy,
-
-	special: {
-		ready: {
-			// Make sure the ready event is setup
-			setup: jQuery.bindReady,
-			teardown: jQuery.noop
-		},
-
-		live: {
-			add: function( handleObj ) {
-				jQuery.event.add( this,
-					liveConvert( handleObj.origType, handleObj.selector ),
-					jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
-			},
-
-			remove: function( handleObj ) {
-				jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
-			}
-		},
-
-		beforeunload: {
-			setup: function( data, namespaces, eventHandle ) {
-				// We only want to do this special case on windows
-				if ( jQuery.isWindow( this ) ) {
-					this.onbeforeunload = eventHandle;
-				}
-			},
-
-			teardown: function( namespaces, eventHandle ) {
-				if ( this.onbeforeunload === eventHandle ) {
-					this.onbeforeunload = null;
-				}
-			}
-		}
-	}
-};
-
-jQuery.removeEvent = document.removeEventListener ?
-	function( elem, type, handle ) {
-		if ( elem.removeEventListener ) {
-			elem.removeEventListener( type, handle, false );
-		}
-	} :
-	function( elem, type, handle ) {
-		if ( elem.detachEvent ) {
-			elem.detachEvent( "on" + type, handle );
-		}
-	};
-
-jQuery.Event = function( src, props ) {
-	// Allow instantiation without the 'new' keyword
-	if ( !this.preventDefault ) {
-		return new jQuery.Event( src, props );
-	}
-
-	// Event object
-	if ( src && src.type ) {
-		this.originalEvent = src;
-		this.type = src.type;
-
-		// Events bubbling up the document may have been marked as prevented
-		// by a handler lower down the tree; reflect the correct value.
-		this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
-			src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
-
-	// Event type
-	} else {
-		this.type = src;
-	}
-
-	// Put explicitly provided properties onto the event object
-	if ( props ) {
-		jQuery.extend( this, props );
-	}
-
-	// timeStamp is buggy for some events on Firefox(#3843)
-	// So we won't rely on the native value
-	this.timeStamp = jQuery.now();
-
-	// Mark it as fixed
-	this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
-	return false;
-}
-function returnTrue() {
-	return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
-	preventDefault: function() {
-		this.isDefaultPrevented = returnTrue;
-
-		var e = this.originalEvent;
-		if ( !e ) {
-			return;
-		}
-
-		// if preventDefault exists run it on the original event
-		if ( e.preventDefault ) {
-			e.preventDefault();
-
-		// otherwise set the returnValue property of the original event to false (IE)
-		} else {


<TRUNCATED>

[30/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/sgvizler.js
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/sgvizler.js b/extras/webjars/sgvizler/src/main/resources/sgvizler.js
new file mode 100644
index 0000000..d512d65
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/sgvizler.js
@@ -0,0 +1,1277 @@
+/*  Sgvizler JavaScript SPARQL result set visualizer, version 0.5.1
+ *  (c) 2011--2012 Martin G. Skjæveland
+ *
+ *  Sgvizler is freely distributable under the terms of an MIT-style license.
+ *  Sgvizler web site: https://code.google.com/p/sgvizler/
+ *--------------------------------------------------------------------------*/
+(function (global) {
+    "use strict";
+
+    /*global google, $, jQuery */
+    /*jslint browser: true */
+
+    var sgvizler = {
+
+        go: function (callback) {
+            google.load('visualization',
+                        '1.0',
+                        {'packages':
+                         ['annotatedtimeline',
+                          'corechart',
+                          'gauge',
+                          'geomap',
+                          'geochart',
+                          'imagesparkline',
+                          'map',
+                          'orgchart',
+                          'table',
+                          'motionchart',
+                          'treemap'
+                         ]
+                        }
+                       );
+
+            google.setOnLoadCallback(function () {
+                sgvizler.charts.loadCharts();
+                sgvizler.drawFormQuery();
+                sgvizler.drawContainerQueries();
+                callback();
+            });
+        },
+
+        drawFormQuery: function () {
+            var query = new sgvizler.query(sgvizler.ui.id.chartCon),
+                params = sgvizler.ui.getUrlParams();
+            $.extend(query,
+                     sgvizler.option.query,
+                     { query: params.query, chart: params.chart });
+
+            if (sgvizler.ui.isElement(query.container) && query.query) {
+                $.extend(query.chartOptions,
+                         { width: params.width, height: params.height });
+                query.draw();
+            }
+            sgvizler.ui.displayUI(query);
+        },
+
+        drawContainerQueries: function () {
+            $('[' + this.ui.attr.prefix + 'query]').each(function () {
+                var query = new sgvizler.query();
+                $.extend(query,
+                         sgvizler.option.query,
+                         sgvizler.ui.getQueryOptionAttr(this));
+                $.extend(query.chartOptions,
+                         sgvizler.ui.getChartOptionAttr(this));
+                query.draw();
+            });
+        },
+
+        // kept in separate files:
+        option: {},   // settings, global variables.
+        chart: {},    // the set of user-defined rendering functions.
+        charts: {},   // functions for handling rendering functions.
+        parser: {},   // SPARQL results XML/JSON parser.
+        ui: {}       // html get/set functions.
+    };
+
+    jQuery.ajaxSetup({
+        accepts: {
+            xml:  "application/sparql-results+xml",
+            json: "application/sparql-results+json"
+        }
+    });
+    sgvizler.option = {
+
+        home: (window.location.href).replace(window.location.search, ""),
+        homefolder: "",
+        libfolder: "/lib/",
+
+        stylepath:"",
+
+        //// Prefixes included in queries:
+        namespace: {
+            'rdf' : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+            'rdfs': "http://www.w3.org/2000/01/rdf-schema#",
+            'owl' : "http://www.w3.org/2002/07/owl#",
+            'xsd' : "http://www.w3.org/2001/XMLSchema#"
+        },
+
+        query: {}, // holds options set by user in html file.
+        chart: {}  // ditto.
+    };
+    sgvizler.ui = {
+
+        //// #id's to html elements:
+        id: {
+            script:       'sgvzlr_script',    // #id to the script tag for this file
+            chartCon:     'sgvzlr_gchart',    // #id to the container to hold the chart
+            queryForm:    'sgvzlr_formQuery', //
+            queryTxt:     'sgvzlr_cQuery',    // query text area.
+            formQuery:    'sgvzlr_strQuery',  // hidden query string. "trick" taken from snorql.
+            formWidth:    'sgvzlr_strWidth',  //
+            formHeight:   'sgvzlr_strHeight', //
+            formChart:    'sgvzlr_optChart',  //
+            prefixCon:    'sgvzlr_cPrefix',   // print prefixes
+            messageCon:   'sgvzlr_cMessage'  // print messages
+        },
+
+        attr: {
+            prefix:      'data-sgvizler-',
+            prefixChart: 'data-sgvizler-chart-options',
+
+            valueAssign: '=',
+            valueSplit:  '|'
+        },
+
+        params: [ 'query', 'chart', 'width', 'height' ], // permissible URL parameters.
+
+        displayUI: function (queryOpt) {
+            this.displayPrefixes();
+            this.displayChartTypesMenu();
+            this.displayUserInput(queryOpt);
+        },
+        displayPrefixes: function () {
+            this.setElementText(this.id.prefixCon, sgvizler.query.prototype.getPrefixes());
+        },
+        displayUserInput: function (queryOpt) {
+            this.setElementValue(this.id.queryTxt, queryOpt.query);
+            this.setElementValue(this.id.formChart, queryOpt.chart);
+            this.setElementValue(this.id.formWidth, queryOpt.chartOptions.width);
+            this.setElementValue(this.id.formHeight, queryOpt.chartOptions.height);
+        },
+        displayChartTypesMenu: function () {
+            var chart,
+                i;
+            if (this.isElement(this.id.formChart)) {
+                chart = sgvizler.charts.all;
+                for (i = 0; i < chart.length; i += 1) {
+                    $('#' + this.id.formChart)
+                        .append($('<option/>')
+                                .val(chart[i].id)
+                                .html(chart[i].id));
+                }
+            }
+        },
+
+        displayFeedback: function (queryOpt, messageName) {
+            var message,
+                container = queryOpt.container;
+            if (queryOpt.container === this.id.chartCon && this.isElement(this.id.messageCon)) {
+                container = this.id.messageCon;
+            }
+
+            if (queryOpt.loglevel === 0) {
+                message = "";
+            } else if (queryOpt.loglevel === 1) {
+                if (messageName === "LOADING") {
+                    message = "Loading...";
+                } else if (messageName === "ERROR_ENDPOINT" || messageName === "ERROR_UNKNOWN") {
+                    message = "Error.";
+                }
+            } else {
+                if (messageName === "LOADING") {
+                    message = "Sending query...";
+                } else if (messageName === "ERROR_ENDPOINT") {
+                    message = "Error querying endpoint. Possible errors:" +
+                        this.html.ul(
+                            this.html.a(queryOpt.endpoint, "SPARQL endpoint") + " down? " +
+                                this.html.a(queryOpt.endpoint + queryOpt.endpoint_query_url + queryOpt.encodedQuery,
+                                            "Check if query runs at the endpoint") + ".",
+                            "Malformed SPARQL query? " +
+                                this.html.a(queryOpt.validator_query_url + queryOpt.encodedQuery, "Check if it validates") + ".",
+                            "CORS supported and enabled? Read more about " +
+                                this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility", "CORS and compatibility") + ".",
+                            "Is your " + this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility", "browser support") + "ed?",
+                            "Hmm.. it might be a bug! Please file a report to " +
+                                this.html.a("http://code.google.com/p/sgvizler/issues/", "the issues") + "."
+                        );
+                } else if (messageName === "ERROR_UNKNOWN") {
+                    message = "Unknown error.";
+                } else if (messageName === "NO_RESULTS") {
+                    message = "Query returned no results.";
+                } else if (messageName === "DRAWING") {
+                    message = "Received " + queryOpt.noRows + " rows. Drawing chart...<br/>" +
+                        this.html.a(queryOpt.endpoint + queryOpt.endpoint_query_url + queryOpt.encodedQuery,
+                                    "View query results", "target='_blank'") + " (in new window).";
+                }
+            }
+            this.setElementHTML(container, this.html.tag("p", message));
+        },
+
+        setElementValue: function (elementID, value) {
+            if (this.isElement(elementID)) {
+                $('#' + elementID).val(value);
+            }
+        },
+        setElementText: function (elementID, value) {
+            if (this.isElement(elementID)) {
+                $('#' + elementID).text(value);
+            }
+        },
+        setElementHTML: function (elementID, value) {
+            if (this.isElement(elementID)) {
+                $('#' + elementID).html(value);
+            }
+        },
+        isElement: function (elementID) {
+            return $('#' + elementID).length > 0;
+        },
+
+        getQueryOptionAttr: function (element) {
+            var i,
+                queryOpt = {container: $(element).attr('id')},
+                attr = element.attributes;
+            for (i = 0; i < attr.length; i += 1) {
+                if (attr[i].name.lastIndexOf(this.attr.prefix, 0) === 0) { // starts-with attr.prefix.
+                    queryOpt[attr[i].name.substring(this.attr.prefix.length)] = attr[i].value;
+                }
+            }
+            return queryOpt;
+        },
+        getChartOptionAttr: function (element) {
+            var i,
+                options,
+                assignment,
+                path,
+                o,
+                j,
+                chartOpt = {},
+                attrValue = $(element).attr(sgvizler.ui.attr.prefixChart);
+            if (typeof attrValue !== 'undefined') {
+                options = attrValue.split(this.attr.valueSplit);
+                for (i = 0; i < options.length; i += 1) {
+                    assignment = options[i].split(this.attr.valueAssign);
+                    path = assignment[0].split(".");
+                    o = chartOpt;
+                    for (j = 0; j < path.length - 1; j += 1) {
+                        if (typeof o[path[j]] === 'undefined') {
+                            o[path[j]] = {};
+                        }
+                        o = o[path[j]];
+                    }
+                    o[path[j]] = assignment[1];
+                }
+            }
+            // get width and heigth from css. take only numbers.
+            chartOpt.width = /(\d+)/.exec($(element).css('width'))[1];
+            chartOpt.height = /(\d+)/.exec($(element).css('height'))[1];
+            return chartOpt;
+        },
+
+        getUrlParams: function () {
+            /*jslint regexp: true */
+            var urlParams = {},
+                e,
+                r = /([^&=]+)=?([^&]*)/g, // parameter, value pairs.
+                d = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); }, // replace '+' with space.
+                q = window.location.search.substring(1); // URL query string part.
+
+            while ((e = r.exec(q))) {
+                if (e[2].length > 0 && this.params.indexOf(e[1]) !== -1) {
+                    urlParams[d(e[1])] = d(e[2]);
+                }
+            }
+            return urlParams;
+        },
+
+        resetPage: function () {
+            document.location = sgvizler.home;
+        },
+        submitQuery: function () {
+            $('#' + this.id.formQuery).val($('#' + this.id.queryTxt).val());
+            $('#' + this.id.queryForm).submit();
+        },
+
+        html: {
+            a: function (href, link, attr) {
+                if (typeof attr === 'undefined') { attr = ""; }
+                if (typeof href !== 'undefined' && typeof link !== 'undefined') {
+                    return "<a " + attr + " href='" + href + "'>" + link + "</a>";
+                }
+            },
+            ul: function () {
+                var i,
+                    txt;
+                if (arguments.length) {
+                    txt = "<ul>";
+                    for (i = 0; i < arguments.length; i += 1) {
+                        txt += "<li>" + arguments[i] + "</li>";
+                    }
+                    return txt + "</ul>";
+                }
+            },
+            tag: function (tag, content) {
+                return "<" + tag + ">" + content + "</" + tag + ">";
+            }
+        }
+    };
+
+    sgvizler.parser = {
+
+        // variable notation: xtable, xcol(s), xrow(s) -- x is 's'(parql) or 'g'(oogle).
+
+        defaultGDatatype: 'string',
+
+        countRowsSparqlXML: function (sxml) {
+            return $(sxml).find('sparql').find('results').find('result').length;
+        },
+
+        countRowsSparqlJSON: function (stable) {
+            if (typeof stable.results.bindings !== 'undefined') {
+                return stable.results.bindings.length;
+            }
+        },
+
+        SparqlXML2GoogleJSON: function (sxml) {
+            var c,
+                r,
+                gcols = [],
+                grows = [],
+                gdatatype = [], // for easy reference of datatypes
+                sresults = $(sxml).find('sparql').find('results').find('result');
+
+            // gcols
+            c = 0;
+            $(sxml).find('sparql').find('head').find('variable').each(function () {
+                var stype = null,
+                    sdatatype = null,
+                    name = $(this).attr('name'),
+                    scell = null,
+                    scells = $(sresults).find('binding[name="' + name + '"]');
+                if (scells.length) {
+                    scell = $(scells).first().children().first()[0]; // uri, literal element
+                    stype = scell.nodeName;
+                    sdatatype = $(scell).attr('datatype');
+                }
+                gdatatype[c] = sgvizler.parser.getGoogleJsonDatatype(stype, sdatatype);
+                gcols[c] = {'id': name, 'label': name, 'type': gdatatype[c]};
+                c += 1;
+            });
+
+            // grows
+            r = 0;
+            $(sresults).each(function () {
+                var gvalue,
+                    scells,
+                    scell,
+                    stype,
+                    svalue,
+                    grow = [];
+                for (c = 0; c < gcols.length; c += 1) {
+                    gvalue = null;
+                    scells = $(this).find('binding[name="' + gcols[c].id + '"]');
+                    if (scells.length &&
+                            typeof $(scells).first().children().first() !== 'undefined' &&
+                            $(scells).first().children().first().firstChild !== null) {
+                        scell = $(scells).first().children().first()[0]; // uri, literal element
+                        stype = scell.nodeName;
+                        svalue = $(scell).first().text();
+                        gvalue = sgvizler.parser.getGoogleJsonValue(svalue, gdatatype[c], stype);
+                    }
+                    grow[c] = {'v': gvalue};
+                }
+                grows[r] = {'c': grow};
+                r += 1;
+            });
+            return {'cols': gcols, 'rows': grows};
+        },
+
+        SparqlJSON2GoogleJSON: function (stable) {
+            var c,
+                r,
+                srow,
+                grow,
+                gvalue,
+                stype,
+                sdatatype,
+                gcols = [],
+                grows = [],
+                gdatatype = [], // for easy reference of datatypes
+                scols = stable.head.vars,
+                srows = stable.results.bindings;
+
+            for (c = 0; c < scols.length; c += 1) {
+                r = 0;
+                stype = null;
+                sdatatype = null;
+                // find a row where there is a value for this column
+                while (typeof srows[r][scols[c]] === 'undefined' && r + 1 < srows.length) { r += 1; }
+                if (typeof srows[r][scols[c]] !== 'undefined') {
+                    stype = srows[r][scols[c]].type;
+                    sdatatype = srows[r][scols[c]].datatype;
+                }
+                gdatatype[c] = this.getGoogleJsonDatatype(stype, sdatatype);
+                gcols[c] = {'id': scols[c], 'label': scols[c], 'type': gdatatype[c]};
+            }
+
+            // loop rows
+            for (r = 0; r < srows.length; r += 1) {
+                srow = srows[r];
+                grow = [];
+                // loop cells
+                for (c = 0; c < scols.length; c += 1) {
+                    gvalue = null;
+                    if (typeof srow[scols[c]] !== 'undefined' &&
+                            typeof srow[scols[c]].value !== 'undefined') {
+                        gvalue = this.getGoogleJsonValue(srow[scols[c]].value, gdatatype[c], srow[scols[c]].type);
+                    }
+                    grow[c] = { 'v': gvalue };
+                }
+                grows[r] = {'c': grow};
+            }
+            return {'cols': gcols, 'rows': grows};
+        },
+
+        getGoogleJsonValue: function (value, gdatatype, stype) {
+            var newvalue;
+            if (gdatatype === 'number') {
+                newvalue = Number(value);
+            } else if (gdatatype === 'date') {
+                //assume format yyyy-MM-dd
+                newvalue = new Date(value.substr(0, 4),
+                                value.substr(5, 2),
+                                value.substr(8, 2));
+            } else if (gdatatype === 'datetime') {
+                //assume format yyyy-MM-ddZHH:mm:ss
+                newvalue = new Date(value.substr(0, 4),
+                                value.substr(5, 2),
+                                value.substr(8, 2),
+                                value.substr(11, 2),
+                                value.substr(14, 2),
+                                value.substr(17, 2));
+            } else if (gdatatype === 'timeofday') {
+                //assume format HH:mm:ss
+                newvalue = [value.substr(0, 2),
+                        value.substr(3, 2),
+                        value.substr(6, 2)];
+            } else { // datatype === 'string' || datatype === 'boolean'
+                if (stype === 'uri') { // replace namespace with prefix
+                    newvalue = this.prefixify(value);
+                }
+                newvalue = value;
+            }
+            return newvalue;
+        },
+
+        getGoogleJsonDatatype: function (stype, sdatatype) {
+            var gdatatype = this.defaultGDatatype,
+                xsdns = sgvizler.option.namespace.xsd;
+            if (typeof stype !== 'undefined' && (stype === 'typed-literal' || stype === 'literal')) {
+                if (sdatatype === xsdns + "float"   ||
+                        sdatatype === xsdns + "double"  ||
+                        sdatatype === xsdns + "decimal" ||
+                        sdatatype === xsdns + "int"     ||
+                        sdatatype === xsdns + "long"    ||
+                        sdatatype === xsdns + "integer") {
+                    gdatatype =  'number';
+                } else if (sdatatype === xsdns + "boolean") {
+                    gdatatype =  'boolean';
+                } else if (sdatatype === xsdns + "date") {
+                    gdatatype =  'date';
+                } else if (sdatatype === xsdns + "dateTime") {
+                    gdatatype =  'datetime';
+                } else if (sdatatype === xsdns + "time") {
+                    gdatatype =  'timeofday';
+                }
+            }
+            return gdatatype;
+        },
+
+        prefixify: function (url) {
+            var ns;
+            for (ns in sgvizler.option.namespace) {
+                if (sgvizler.option.namespace.hasOwnProperty(ns) &&
+                        url.lastIndexOf(sgvizler.option.namespace[ns], 0) === 0) {
+                    return url.replace(sgvizler.option.namespace[ns], ns + ":");
+                }
+            }
+            return url;
+        },
+        unprefixify: function (qname) {
+            var ns;
+            for (ns in sgvizler.option.namespace) {
+                if (sgvizler.option.namespace.hasOwnProperty(ns) &&
+                        qname.lastIndexOf(ns + ":", 0) === 0) {
+                    return qname.replace(ns + ":", sgvizler.option.namespace[ns]);
+                }
+            }
+            return qname;
+        }
+    };
+
+
+    /*global XDomainRequest */
+
+    sgvizler.query = function (container) {
+        this.container = container;
+
+        //defaults
+        this.query = "SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?instance a ?class }\nGROUP BY ?class\nORDER BY ?class";
+        this.endpoint = "http://sws.ifi.uio.no/sparql/world";
+        this.endpoint_output = 'json';  // xml, json, jsonp
+        this.endpoint_query_url = "?output=text&amp;query=";
+        this.validator_query_url = "http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=";
+        this.chart = 'gLineChart';
+        this.loglevel = 2;
+
+        this.chartOptions = {
+            'width':           '800',
+            'height':          '400',
+            'chartArea':       { left: '5%', top: '5%', width: '75%', height: '80%' },
+            'gGeoMap': {
+                'dataMode':           'markers'
+            },
+            'gMap': {
+                'dataMode':           'markers'
+            },
+            'sMap': {
+                'dataMode':           'markers',
+                'showTip':            true,
+                'useMapTypeControl':  true
+            },
+            'gSparkline': {
+                'showAxisLines':      false
+            }
+        };
+    };
+
+    sgvizler.query.prototype.draw = function (listeners,options,callback) {
+        var that = this,
+            chartFunc = sgvizler.charts.getChart(this.container, this.chart);
+        this.setChartSpecificOptions();
+        this.insertFrom();
+        $.extend(this.chartOptions,options);
+        this.runQuery(function (data) {
+            var dataTable = new google.visualization.DataTable(that.processQueryResults(data));
+            for(var listener in listeners) {
+                google.visualization.events.addListener(chartFunc, listener, function(){
+                    listeners[listener](chartFunc,dataTable);
+                });
+            }
+            chartFunc.draw(dataTable,that.chartOptions);
+            if(callback)callback(dataTable);
+        });
+    };
+
+    sgvizler.query.prototype.runQuery = function (callback) {
+        var xdr,
+            url,
+            endpoint_output = this.endpoint_output;
+        sgvizler.ui.displayFeedback(this, "LOADING");
+        this.encodedQuery = encodeURIComponent(this.getPrefixes() + this.query);
+        if (this.endpoint_output !== 'jsonp' && $.browser.msie && window.XDomainRequest) {
+            xdr = new XDomainRequest();
+            url = this.endpoint +
+                "?query=" + this.encodedQuery +
+                "&output=" + this.endpoint_output;
+            xdr.open("GET", url);
+            xdr.onload = function () {
+                var data;
+                if (endpoint_output === "xml") {
+                    data = $.parseXML(xdr.responseText);
+                } else {
+                    data = $.parseJSON(xdr.responseText);
+                }
+                callback(data);
+            };
+            xdr.send();
+        } else {
+            $.get(this.endpoint,
+                  { query: this.getPrefixes() + this.query,
+                    output: (this.endpoint_output === 'jsonp') ? 'json' : this.endpoint_output },
+                  function (data) { callback(data); },
+                  this.endpoint_output)
+                .error(function () {
+                    sgvizler.ui.displayFeedback(this, "ERROR_ENDPOINT");
+                });
+        }
+    };
+
+    sgvizler.query.prototype.processQueryResults = function (data) {
+        this.setResultRowCount(data);
+        if (this.noRows === null) {
+            sgvizler.ui.displayFeedback(this, "ERROR_UNKNOWN");
+        } else if (this.noRows === 0) {
+            sgvizler.ui.displayFeedback(this, "NO_RESULTS");
+        } else {
+            sgvizler.ui.displayFeedback(this, "DRAWING");
+            return this.getGoogleJSON(data);
+        }
+    };
+
+    sgvizler.query.prototype.setResultRowCount = function (data) {
+        if (this.endpoint_output === 'xml') {
+            this.noRows = sgvizler.parser.countRowsSparqlXML(data);
+        } else {
+            this.noRows = sgvizler.parser.countRowsSparqlJSON(data);
+        }
+    };
+
+    sgvizler.query.prototype.getGoogleJSON = function (data) {
+        if (this.endpoint_output === 'xml') {
+            data = sgvizler.parser.SparqlXML2GoogleJSON(data);
+        } else {
+            data = sgvizler.parser.SparqlJSON2GoogleJSON(data);
+        }
+        return data;
+    };
+
+    sgvizler.query.prototype.insertFrom = function () {
+        if (typeof this.rdf !== 'undefined') {
+            var i,
+                froms = this.rdf.split(sgvizler.ui.attr.valueSplit),
+                from = "";
+            for (i = 0; i < froms.length; i += 1) {
+                from += 'FROM <' + froms[i] + '>\n';
+            }
+            this.query = this.query.replace(/(WHERE)?(\s)*\{/, '\n' + from + 'WHERE {');
+        }
+    };
+
+    sgvizler.query.prototype.getPrefixes = function () {
+        var prefix,
+            prefixes = "";
+        for (prefix in sgvizler.option.namespace) {
+            if (sgvizler.option.namespace.hasOwnProperty(prefix)) {
+                prefixes += "PREFIX " + prefix + ": <" + sgvizler.option.namespace[prefix] + ">\n";
+            }
+        }
+        return prefixes;
+    };
+
+    sgvizler.query.prototype.setChartSpecificOptions = function () {
+        var level1,
+            level2;
+        for (level1 in this.chartOptions) {
+            if (this.chartOptions.hasOwnProperty(level1) &&
+                    level1 === this.chart) {
+                for (level2 in this.chartOptions[level1]) {
+                    if (this.chartOptions[level1].hasOwnProperty(level2)) {
+                        this.chartOptions[level2] = this.chartOptions[level1][level2];
+                    }
+                }
+            }
+        }
+    };
+
+    sgvizler.charts = {
+        // Package for handling rendering functions. The rendering
+        // functions themselves are kept in sgvizler.chart.*
+
+        all: [],
+
+        loadCharts: function () {
+            var googlecharts = [
+                { 'id': "gLineChart",        'func': google.visualization.LineChart },
+                { 'id': "gAreaChart",        'func': google.visualization.AreaChart },
+                { 'id': "gSteppedAreaChart", 'func': google.visualization.SteppedAreaChart },
+                { 'id': "gPieChart",         'func': google.visualization.PieChart },
+                { 'id': "gBubbleChart",      'func': google.visualization.BubbleChart },
+                { 'id': "gColumnChart",      'func': google.visualization.ColumnChart },
+                { 'id': "gBarChart",         'func': google.visualization.BarChart },
+                { 'id': "gSparkline",        'func': google.visualization.ImageSparkLine },
+                { 'id': "gScatterChart",     'func': google.visualization.ScatterChart },
+                { 'id': "gCandlestickChart", 'func': google.visualization.CandlestickChart },
+                { 'id': "gGauge",            'func': google.visualization.Gauge },
+                { 'id': "gOrgChart",         'func': google.visualization.OrgChart },
+                { 'id': "gTreeMap",          'func': google.visualization.TreeMap },
+                { 'id': "gTimeline",         'func': google.visualization.AnnotatedTimeLine },
+                { 'id': "gMotionChart",      'func': google.visualization.MotionChart },
+                { 'id': "gGeoChart",         'func': google.visualization.GeoChart },
+                { 'id': "gGeoMap",           'func': google.visualization.GeoMap },
+                { 'id': "gMap",              'func': google.visualization.Map },
+                { 'id': "gTable",            'func': google.visualization.Table }
+            ],
+                chart;
+
+            $.merge(this.all, googlecharts);
+            for (chart in sgvizler.chart) {
+                if (sgvizler.chart.hasOwnProperty(chart)) {
+                    this.register(
+                        sgvizler.chart[chart].prototype.id,
+                        sgvizler.chart[chart]
+                    );
+                }
+            }
+        },
+
+        register: function (id, func) {
+            this.all.push({'id': id, 'func': func});
+        },
+
+        getChart: function (containerId, chartId) {
+            var i,
+                container = document.getElementById(containerId);
+            for (i = 0; i < this.all.length; i += 1) {
+                if (chartId === this.all[i].id) {
+                    return new this.all[i].func(container);
+                }
+            }
+        }
+    };
+
+
+    /*global d3 */
+    /** dForceGraph **
+
+
+        D3 force directed graph. Under development.
+    */
+    sgvizler.chart.dForceGraph = function (container) { this.container = container; };
+    sgvizler.chart.dForceGraph.prototype = {
+        id:   "dForceGraph",
+        draw: function (data, chartOpt) {
+            var noColumns = data.getNumberOfColumns(),
+                noRows = data.getNumberOfRows(),
+                opt = $.extend({'maxnodesize': 15, 'minnodesize': 2 }, chartOpt), // set defaults
+                colors = d3.scale.category20(),
+                w = chartOpt.width,
+                h = chartOpt.height,
+                isNumber = function (n) {  return !isNaN(parseFloat(n)) && isFinite(n); },
+
+                // build arrays of nodes and links.
+                nodes = [],
+                edges = [],
+                t_color = {},
+                t_size = {},
+                t_maxnodesize = 0,
+
+                r,
+                source,
+                target,
+
+                nodesizeratio,
+                i,
+                color,
+                size,
+
+                vis,
+                force,
+                link,
+                node,
+                ticks;
+
+            for (r = 0; r < noRows; r += 1) {
+                source = data.getValue(r, 0);
+                target = data.getValue(r, 1);
+                // nodes
+                if (source !== null && $.inArray(source, nodes) === -1) {
+                    nodes.push(source);
+                    t_size[source] = (noColumns > 2) ? Math.sqrt(data.getValue(r, 2)) : 0;
+                    t_color[source] = (noColumns > 3) ? data.getValue(r, 3) : 0;
+                    if (t_size[source] > t_maxnodesize) {
+                        t_maxnodesize = t_size[source];
+                    }
+                }
+                if (target !== null && $.inArray(target, nodes) === -1) {
+                    nodes.push(target);
+                }
+                // edges
+                if (source !== null && target !== null) {
+                    edges.push({'source': $.inArray(source, nodes),
+                                'target': $.inArray(target, nodes)
+                            }
+                        );
+                }
+            }
+            if (t_maxnodesize === 0) {
+                t_maxnodesize = 1;
+            }
+            nodesizeratio = opt.maxnodesize / t_maxnodesize;
+            for (i = 0; i < nodes.length; i += 1) {
+                color = typeof t_color[nodes[i]] !== 'undefined' ?
+                        t_color[nodes[i]] :
+                        1;
+                size = isNumber(t_size[nodes[i]]) ?
+                        opt.minnodesize + t_size[nodes[i]] * nodesizeratio :
+                        opt.minnodesize;
+
+                nodes[i] = {'name': nodes[i], 'color': color, 'size': size };
+            }
+
+            $(this.container).empty();
+
+            vis = d3.select(this.container)
+                .append("svg:svg")
+                .attr("width", w)
+                .attr("height", h)
+                .attr("pointer-events", "all")
+                .append('svg:g')
+                .call(d3.behavior.zoom().on("zoom", function () {
+                    vis.attr("transform", "translate(" + d3.event.translate + ")" +
+                         " scale(" + d3.event.scale + ")");
+                }))
+                .append('svg:g');
+
+            vis.append('svg:rect')
+                .attr('width', w)
+                .attr('height', h)
+                .attr('fill', 'white');
+
+            force = d3.layout.force()
+                .gravity(0.05)
+                .distance(100)
+                .charge(-100)
+                .nodes(nodes)
+                .links(edges)
+                .size([w, h])
+                .start();
+
+            link = vis.selectAll("line.link")
+                .data(edges)
+                .enter().append("svg:line")
+                .attr("class", "link")
+                //.style("stroke-width", function (d) { return Math.sqrt(d.value); })
+                .attr("x1", function (d) { return d.source.x; })
+                .attr("y1", function (d) { return d.source.y; })
+                .attr("x2", function (d) { return d.target.x; })
+                .attr("y2", function (d) { return d.target.y; });
+
+            node = vis.selectAll("g.node")
+                .data(nodes)
+                .enter().append("svg:g")
+                .attr("class", "node")
+                .call(force.drag);
+
+            node.append("svg:circle")
+                .style("fill", function (d) { return colors(d.color); })
+                .attr("class", "node")
+                .attr("r", function (d) { return d.size; });
+
+            node.append("svg:title")
+                .text(function (d) { return d.name; });
+
+            node.append("svg:text")
+                .attr("class", "nodetext")
+                .attr("dx", 12)
+                .attr("dy", ".35em")
+                .text(function (d) { return d.name; });
+
+            ticks = 0;
+            force.on("tick", function () {
+                ticks += 1;
+                if (ticks > 250) {
+                    force.stop();
+                    force.charge(0)
+                        .linkStrength(0)
+                        .linkDistance(0)
+                        .gravity(0)
+                        .start();
+                }
+
+                link.attr("x1", function (d) { return d.source.x; })
+                    .attr("y1", function (d) { return d.source.y; })
+                    .attr("x2", function (d) { return d.target.x; })
+                    .attr("y2", function (d) { return d.target.y; });
+
+                node.attr("transform", function (d) {
+                    return "translate(" + d.x + "," + d.y + ")";
+                });
+            });
+        }
+    };
+
+
+    /*global Graph */
+    /** rdGraph **
+
+      Original version written by Magnus Stuhr.
+
+      Draws a graph with clickable and movable nodes. 
+
+      Input format:
+      - 7 columns, last three are optional.
+      - each row represents a source node, a target node and an edge from source to target.
+      - the URIs are the id's for the nodes, and make the nodes clickable.
+      
+      1             2         3         4             5           6             7
+      sourceURI sourceLabel   targetURI targetLabel   edgeLabel   sourceColor   targetColor
+
+    */
+    sgvizler.chart.rdGraph = function (container) { this.container = container; };
+    sgvizler.chart.rdGraph.prototype = {
+        id: "rdGraph",
+        draw: function (data, chartOpt) {
+
+            var numberOfColumns = data.getNumberOfColumns(),
+                numberOfRows = data.getNumberOfRows(),
+
+                // set defaults.
+                opt = $.extend({
+                    noderadius: 0.5,
+                    nodefontsize: "10px",
+                    nodeheight: 20,
+                    nodestrokewidth: "1px",
+                    nodecornerradius: "1px",
+                    nodepadding: 7,
+                    nodecolor: "green",
+                    edgestroke: "blue",
+                    edgefill: "blue",
+                    edgestrokewidth: 1,
+                    edgefontsize: "10px",
+                    edgeseparator: ", "
+                }, chartOpt),
+
+                graph = new Graph(),
+                layouter,
+                renderer,
+                row,
+                i,
+                edge,
+                source,
+                target,
+                label,
+
+                // custom node rendering using Raphael.
+                nodeRenderer = function (color, URL) {
+                    return function (r, n) {
+                        return r.set()
+                            // rectangle
+                            .push(r.rect(n.point[0],
+                                        n.point[1],
+                                        n.label.length * opt.nodepadding,
+                                        opt.nodeheight)
+                                 .attr({"fill": color,
+                                        "stroke-width": opt.nodestrokewidth,
+                                        "r" : opt.nodecornerradius}))
+                           // label inside rectangle
+                            .push(r.text(n.point[0] + n.label.length * opt.nodepadding / 2,
+                                        n.point[1] + opt.nodeheight / 2,
+                                        n.label)
+                                 .attr({"font-size": opt.nodefontsize})
+                                 .click(function () { if (URL) { window.open(sgvizler.parser.unprefixify(URL)); } })
+                                );
+                    };
+                },
+
+                // helper function.
+                addNode = function (URL, name, color) {
+                    graph.addNode(URL, {label: name, render: nodeRenderer(color, URL)});
+                    //console.log("add node - name: " + name + ", URL: " + URL);
+                },
+                edges = {},
+                keys_edges = [];
+
+            for (row = 0; row < numberOfRows; row += 1) {
+                source = data.getValue(row, 0);
+                target = data.getValue(row, 2);
+
+                // add source node
+                // Note: dracula library takes care of duplicates?
+                if (source) {
+                    addNode(source,
+                            data.getValue(row, 1) || source,
+                            numberOfColumns > 5 ? data.getValue(row, 5) : opt.nodecolor);
+                }
+                // add target node
+                if (target) {
+                    addNode(target,
+                            data.getValue(row, 3) || target,
+                            numberOfColumns > 6 ? data.getValue(row, 6) : opt.nodecolor);
+                }
+
+                // collect edge labels. Only one edge per pair of nodes,
+                // so we concatinate labels of multiple edges into one.
+                if (source && target) {
+                    label = "";
+                    // test if source--target pair is seen before:
+                    if (typeof edges[source + target] !== 'undefined') {
+                        label = edges[source + target].label; // retrieve accumulated label.
+                    } else {
+                        keys_edges.push(source + target);
+                    }
+
+                    if (numberOfColumns > 4 && data.getValue(row, 4).length > 0) {
+                        if (label.length > 0) {
+                            label += opt.edgeseparator;
+                        }
+                        label += data.getValue(row, 4);
+                    }
+
+                    edges[source + target] = {
+                        'source': source,
+                        'target': target,
+                        'label': label
+                    };
+                }
+            }
+
+            // add edges
+            for (i = 0; i < keys_edges.length; i += 1) {
+                edge = edges[keys_edges[i]];
+                //console.log("add edge - source: " + edge.source + ", target " + edge.target);
+                graph.addEdge(edge.source, edge.target,
+                              { "stroke": opt.edgestroke,
+                                "fill": opt.edgefill,
+                                "label": edge.label,
+                                "width": opt.edgestrokewidth,
+                                "fontsize": opt.edgefontsize
+                              });
+            }
+
+            layouter = new Graph.Layout.Spring(graph);
+            layouter.layout();
+
+            $(this.container).empty();
+            renderer = new Graph.Renderer.Raphael(this.container, graph, opt.width, opt.height, {"noderadius": opt.nodeheight * opt.noderadius});
+            renderer.draw();
+        }
+    };    /** sDefList **
+
+
+     Make a html dt list.
+
+
+     Format, 2--N columns:
+     1. Term
+     2--N. Definition
+
+
+     Available options:
+     'cellSep'   :  string (can be html) to separate cells in definition columns. (default: ' ')
+     'termPrefix  :  string (can be html) to prefix each term with. (default: '')
+     'termPostfix :  string (can be html) to postfix each term with. (default: ':')
+     'definitionPrefix  :  string (can be html) to prefix each definition with. (default: '')
+     'definitionPostfix :  string (can be html) to postfix each definition with. (default: '')
+    */
+    sgvizler.chart.DefList = function (container) { this.container = container; };
+    sgvizler.chart.DefList.prototype = {
+        id:   "sDefList",
+        draw: function (data, chartOpt) {
+            var r,
+                c,
+                term,
+                definition,
+                noColumns = data.getNumberOfColumns(),
+                noRows = data.getNumberOfRows(),
+                opt = $.extend({ cellSep: ' ', termPrefix: '', termPostfix: ':', definitionPrefix: '', definitionPostfix: '' }, chartOpt),
+                list = $(document.createElement('dl'));
+
+
+            for (r = 0; r < noRows; r += 1) {
+                term = opt.termPrefix + data.getValue(r, 0) + opt.termPostfix;
+                list.append($(document.createElement('dt')).html(term));
+                definition = opt.definitionPrefix;
+                for (c = 1; c < noColumns; c += 1) {
+                    definition += data.getValue(r, c);
+                    if (c + 1 !== noColumns) {
+                        definition += opt.cellSep;
+                    }
+                }
+                definition += opt.definitionPostfix;
+                list.append($(document.createElement('dd')).html(definition));
+            }
+            $(this.container).empty();
+            $(this.container).append(list);
+        }
+    };
+    /** sList **
+
+
+     Make a html list, either numbered (ol) or bullets (ul). Each row
+     becomes a list item.
+
+
+     Any number of columns in any format. Everything is displayed as text.
+
+
+     Available options:
+     'list'      :  "ol" / "ul"  (default: "ul")
+     'cellSep'   :  string (can be html) to separate cells in row. (default: ', ')
+     'rowPrefix  :  string (can be html) to prefix each row with. (default: '')
+     'rowPostfix :  string (can be html) to postfix each row with. (default: '')
+    */
+    sgvizler.chart.List = function (container) { this.container = container; };
+    sgvizler.chart.List.prototype = {
+        id:   "sList",
+        draw: function (data, chartOpt) {
+            var noColumns = data.getNumberOfColumns(),
+                noRows = data.getNumberOfRows(),
+                opt = $.extend({ list: 'ul', cellSep: ', ', rowPrefix: '', rowPostfix: '' }, chartOpt),
+                list = $(document.createElement(opt.list)),
+                r,
+                c,
+                rowtext;
+
+
+            for (r = 0; r < noRows; r += 1) {
+                rowtext = opt.rowPrefix;
+                for (c = 0; c < noColumns; c += 1) {
+                    rowtext += data.getValue(r, c);
+                    if (c + 1 !== noColumns) {
+                        rowtext += opt.cellSep;
+                    }
+                }
+                rowtext += opt.rowPostfix;
+                list.append($(document.createElement('li')).html(rowtext));
+            }
+            $(this.container).empty();
+            $(this.container).append(list);
+        }
+    };
+
+
+    /** sMap **
+
+
+     Extends gMap in markers dataMode. Draws textboxes with heading,
+     paragraph, link and image. The idea is to put all columns > 2 into
+     the 3. column with html formatting.
+
+
+     - Data Format 2--6 columns:
+       1. lat
+       2. long
+       3. name  (optional)
+       4. text  (optional)
+       5. link  (optional)
+       6. image (optional)
+
+
+     - If < 4 columns, then behaves just as gMap
+     - Only 6 columns will be read, columns > 6 are ignored.
+    */
+    sgvizler.chart.sMap = function (container) { this.container = container; };
+    sgvizler.chart.sMap.prototype = {
+        id:   "sMap",
+        draw: function (data, chartOpt) {
+            var chart,
+                newData,
+                newValue,
+                noColumns = data.getNumberOfColumns(),
+                r,
+                c;
+
+
+            if (noColumns > 3) {
+                newData = data.clone();
+                // drop columns > 3 from new
+                for (c = noColumns - 1; c > 2; c -= 1) {
+                    newData.removeColumn(c);
+                }
+
+
+                // build new 3. column
+                for (r = 0; r < data.getNumberOfRows(); r += 1) {
+                    newValue = "<div class='sgvizler sgvizler-sMap'>";
+                    newValue += "<h1>" + data.getValue(r, 2) + "</h1>";
+                    if (5 < noColumns && data.getValue(r, 5) !== null) {
+                        newValue += "<div class='img'><img src='" + data.getValue(r, 5) + "'/></div>";
+                    }
+                    if (3 < noColumns && data.getValue(r, 3) !== null) {
+                        newValue += "<p class='text'>" + data.getValue(r, 3) + "</p>";
+                    }
+                    if (4 < noColumns && data.getValue(r, 4) !== null) {
+                        newValue += "<p class='link'><a href='" + sgvizler.parser.unprefixify(data.getValue(r, 4)) + "'>" + data.getValue(r, 4) + "</a></p>";
+                    }
+                    newValue += "</div>";
+                    newData.setCell(r, 2, newValue);
+                }
+            } else { // do nothing.
+                newData = data;
+            }
+
+
+            chart = new google.visualization.Map(this.container);
+            chart.draw(newData, chartOpt);
+        }
+    };
+
+
+    /** sTable **
+
+
+     Make a html table.
+
+
+     Available options:
+     'headings'   :  "true" / "false"  (default: "true")
+    */
+    sgvizler.chart.Table = function (container) { this.container = container; };
+    sgvizler.chart.Table.prototype = {
+        id:   "sTable",
+        draw: function (data, chartOpt) {
+            var noColumns = data.getNumberOfColumns(),
+                noRows = data.getNumberOfRows(),
+                opt = $.extend({'headings': true }, chartOpt),
+                table = $(document.createElement('table')),
+                c,
+                r,
+                row;
+
+
+            if (opt.headings) {
+                row = $(document.createElement('tr'));
+                for (c = 0; c < noColumns; c += 1) {
+                    row.append($(document.createElement('th')).html(data.getColumnLabel(c)));
+                }
+                table.append(row);
+            }
+
+
+            for (r = 0; r < noRows; r += 1) {
+                row = $(document.createElement('tr'));
+                for (c = 0; c < noColumns; c += 1) {
+                    row.append($(document.createElement('td')).html(data.getValue(r, c)));
+                }
+                table.append(row);
+            }
+            $(this.container).empty();
+            $(this.container).append(table);
+        }
+    };
+
+    /** sText **
+
+
+     Write text.
+
+
+     Any number of columns. Everything is displayed as text.
+
+
+     Available options:
+     'cellSep'       :  string (can be html) to separate cells in each column. (default: ', ')
+     'cellPrefix     :  string (can be html) to prefix each cell with. (default: '')
+     'cellPostfix    :  string (can be html) to postfix each cell  with. (default: '')
+     'rowPrefix      :  string (can be html) to prefix each row with. (default: '<p>')
+     'rowPostfix     :  string (can be html) to postfix each row with. (default: '</p>')
+     'resultsPrefix  :  string (can be html) to prefix the results with. (default: '<div>')
+     'resultsPostfix :  string (can be html) to postfix the results with. (default: '</div>')
+    */
+    sgvizler.chart.Text = function (container) { this.container = container; };
+    sgvizler.chart.Text.prototype = {
+        id:   "sText",
+        draw: function (data, chartOpt) {
+            var noColumns = data.getNumberOfColumns(),
+                noRows = data.getNumberOfRows(),
+                opt = $.extend({ cellSep: ', ',
+                                 cellPrefix: '', cellPostfix: '',
+                                 rowPrefix: '<p>', rowPostfix: '</p>',
+                                 resultsPrefix: '<div>', resultsPostfix: '</div>' },
+                               chartOpt),
+                text = opt.resultsPrefix,
+                r,
+                c,
+                row;
+
+
+            for (r = 0; r < noRows; r += 1) {
+                row = opt.rowPrefix;
+                for (c = 0; c < noColumns; c += 1) {
+                    row += opt.cellPrefix + data.getValue(r, c) + opt.cellPostfix;
+                    if (c + 1 !== noColumns) {
+                        row += opt.cellSep;
+                    }
+                }
+                text += row + opt.rowPostfix;
+            }
+            text += opt.resultsPostfix;
+
+
+            $(this.container).empty();
+            $(this.container).html(text);
+        }
+    };
+    global.sgvizler = sgvizler;
+}(window));

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/pom.xml b/extras/webjars/snorql/pom.xml
new file mode 100644
index 0000000..ed52758
--- /dev/null
+++ b/extras/webjars/snorql/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>snorql</artifactId>
+    <version>1.0</version>
+    <packaging>jar</packaging>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <id>assemble-javascript</id>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                        <configuration>
+                            <nomunge>true</nomunge>
+                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                            <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/snorql.js</output>
+                            <includes>
+                                <include>prototype.js</include>
+                                <include>scriptaculous/scriptaculous.js</include>
+                                <include>scriptaculous/builder.js</include>
+                                <include>scriptaculous/effects.js</include>
+                                <include>scriptaculous/dragdrop.js</include>
+                                <include>scriptaculous/controls.js</include>
+                                <include>scriptaculous/slider.js</include>
+                                <include>scriptaculous/sound.js</include>
+                                <include>snorql.js</include>
+                                <include>sparql.js</include>
+                                <include>namespaces.js</include>
+                            </includes>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>assemble-css</id>
+                        <goals>
+                            <goal>aggregate-css</goal>
+                        </goals>
+                        <configuration>
+                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                            <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/snorql.css</output>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>**/*.js</exclude>
+                    <exclude>**/*.css</exclude>
+                </excludes>
+                <filtering>false</filtering>
+                <targetPath>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</targetPath>
+            </resource>
+        </resources>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/LICENSE
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/LICENSE b/extras/webjars/snorql/src/main/resources/LICENSE
new file mode 100755
index 0000000..d645695
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/README
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/README b/extras/webjars/snorql/src/main/resources/README
new file mode 100755
index 0000000..87a5827
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/README
@@ -0,0 +1,11 @@
+SNORQL is an AJAXy front-end for exploring RDF SPARQL endpoints
+
+It was originally created by Richard Cyganaik ( http://richard.cyganiak.de/ )
+for the D2R server project ( http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/ ).
+
+SNORQL can be used with just about any SPARQL endpoint that supports JSON. To
+use SNORQL simply put the ./snorql directory somwhere sensible in the Apache
+web directory and modify ./snorql/snorql.js to conform with your setup.  You
+can also modify the pre-defined namespaces in ./snorql/namespaces.js
+
+SNORQL is licensed under Apache-2 license (see ./LICENSE ).
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/link.png
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/link.png b/extras/webjars/snorql/src/main/resources/link.png
new file mode 100755
index 0000000..419c06f
Binary files /dev/null and b/extras/webjars/snorql/src/main/resources/link.png differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/namespaces.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/namespaces.js b/extras/webjars/snorql/src/main/resources/namespaces.js
new file mode 100755
index 0000000..7db1f83
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/namespaces.js
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var D2R_namespacePrefixes = {
+    rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
+    rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
+    owl: 'http://www.w3.org/2002/07/owl#',
+    skos: 'http://www.w3.org/2004/02/skos/core#',
+    dc: 'http://purl.org/dc/elements/1.1/',
+    foaf: 'http://xmlns.com/foaf/0.1/',
+    xsd: 'http://www.w3.org/2001/XMLSchema#'
+};


[34/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/codemirror.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/codemirror.js b/extras/webjars/codemirror/src/main/resources/codemirror.js
new file mode 100644
index 0000000..72609ee
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/codemirror.js
@@ -0,0 +1,3064 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// CodeMirror version 2.24
+//
+// All functions that need access to the editor's state live inside
+// the CodeMirror function. Below that, at the bottom of the file,
+// some utilities are defined.
+
+// CodeMirror is the only global var we claim
+var CodeMirror = (function() {
+  // This is the function that produces an editor instance. Its
+  // closure is used to store the editor state.
+  function CodeMirror(place, givenOptions) {
+    // Determine effective options based on given values and defaults.
+    var options = {}, defaults = CodeMirror.defaults;
+    for (var opt in defaults)
+      if (defaults.hasOwnProperty(opt))
+        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
+
+    // The element in which the editor lives.
+    var wrapper = document.createElement("div");
+    wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
+    // This mess creates the base DOM structure for the editor.
+    wrapper.innerHTML =
+      '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea
+        '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' +
+          'autocorrect="off" autocapitalize="off"></textarea></div>' +
+      '<div class="CodeMirror-scroll" tabindex="-1">' +
+        '<div style="position: relative">' + // Set to the height of the text, causes scrolling
+          '<div style="position: relative">' + // Moved around its parent to cover visible view
+            '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
+            // Provides positioning relative to (visible) text origin
+            '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' +
+              '<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div>' +
+              '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
+              '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code
+            '</div></div></div></div></div>';
+    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
+    // I've never seen more elegant code in my life.
+    var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
+        scroller = wrapper.lastChild, code = scroller.firstChild,
+        mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,
+        lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,
+        cursor = measure.nextSibling, selectionDiv = cursor.nextSibling,
+        lineDiv = selectionDiv.nextSibling;
+    themeChanged();
+    // Needed to hide big blue blinking cursor on Mobile Safari
+    if (ios) input.style.width = "0px";
+    if (!webkit) lineSpace.draggable = true;
+    lineSpace.style.outline = "none";
+    if (options.tabindex != null) input.tabIndex = options.tabindex;
+    if (options.autofocus) focusInput();
+    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
+    // Needed to handle Tab key in KHTML
+    if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
+
+    // Check for problem with IE innerHTML not working when we have a
+    // P (or similar) parent node.
+    try { stringWidth("x"); }
+    catch (e) {
+      if (e.message.match(/runtime/i))
+        e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
+      throw e;
+    }
+
+    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
+    var poll = new Delayed(), highlight = new Delayed(), blinker;
+
+    // mode holds a mode API object. doc is the tree of Line objects,
+    // work an array of lines that should be parsed, and history the
+    // undo history (instance of History constructor).
+    var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;
+    loadMode();
+    // The selection. These are always maintained to point at valid
+    // positions. Inverted is used to remember that the user is
+    // selecting bottom-to-top.
+    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
+    // Selection-related flags. shiftSelecting obviously tracks
+    // whether the user is holding shift.
+    var shiftSelecting, lastClick, lastDoubleClick, lastScrollPos = 0, draggingText,
+        overwrite = false, suppressEdits = false;
+    // Variables used by startOperation/endOperation to track what
+    // happened during the operation.
+    var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
+        gutterDirty, callbacks;
+    // Current visible range (may be bigger than the view window).
+    var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
+    // bracketHighlighted is used to remember that a bracket has been
+    // marked.
+    var bracketHighlighted;
+    // Tracks the maximum line length so that the horizontal scrollbar
+    // can be kept static when scrolling.
+    var maxLine = "", maxWidth;
+    var tabCache = {};
+
+    // Initialize the content.
+    operation(function(){setValue(options.value || ""); updateInput = false;})();
+    var history = new History();
+
+    // Register our event handlers.
+    connect(scroller, "mousedown", operation(onMouseDown));
+    connect(scroller, "dblclick", operation(onDoubleClick));
+    connect(lineSpace, "selectstart", e_preventDefault);
+    // Gecko browsers fire contextmenu *after* opening the menu, at
+    // which point we can't mess with it anymore. Context menu is
+    // handled in onMouseDown for Gecko.
+    if (!gecko) connect(scroller, "contextmenu", onContextMenu);
+    connect(scroller, "scroll", function() {
+      lastScrollPos = scroller.scrollTop;
+      updateDisplay([]);
+      if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
+      if (options.onScroll) options.onScroll(instance);
+    });
+    connect(window, "resize", function() {updateDisplay(true);});
+    connect(input, "keyup", operation(onKeyUp));
+    connect(input, "input", fastPoll);
+    connect(input, "keydown", operation(onKeyDown));
+    connect(input, "keypress", operation(onKeyPress));
+    connect(input, "focus", onFocus);
+    connect(input, "blur", onBlur);
+
+    if (options.dragDrop) {
+      connect(lineSpace, "dragstart", onDragStart);
+      function drag_(e) {
+        if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
+        e_stop(e);
+      }
+      connect(scroller, "dragenter", drag_);
+      connect(scroller, "dragover", drag_);
+      connect(scroller, "drop", operation(onDrop));
+    }
+    connect(scroller, "paste", function(){focusInput(); fastPoll();});
+    connect(input, "paste", fastPoll);
+    connect(input, "cut", operation(function(){
+      if (!options.readOnly) replaceSelection("");
+    }));
+
+    // Needed to handle Tab key in KHTML
+    if (khtml) connect(code, "mouseup", function() {
+        if (document.activeElement == input) input.blur();
+        focusInput();
+    });
+
+    // IE throws unspecified error in certain cases, when
+    // trying to access activeElement before onload
+    var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
+    if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
+    else onBlur();
+
+    function isLine(l) {return l >= 0 && l < doc.size;}
+    // The instance object that we'll return. Mostly calls out to
+    // local functions in the CodeMirror function. Some do some extra
+    // range checking and/or clipping. operation is used to wrap the
+    // call so that changes it makes are tracked, and the display is
+    // updated afterwards.
+    var instance = wrapper.CodeMirror = {
+      getValue: getValue,
+      setValue: operation(setValue),
+      getSelection: getSelection,
+      replaceSelection: operation(replaceSelection),
+      focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},
+      setOption: function(option, value) {
+        var oldVal = options[option];
+        options[option] = value;
+        if (option == "mode" || option == "indentUnit") loadMode();
+        else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();}
+        else if (option == "readOnly" && !value) {resetInput(true);}
+        else if (option == "theme") themeChanged();
+        else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
+        else if (option == "tabSize") updateDisplay(true);
+        if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") {
+          gutterChanged();
+          updateDisplay(true);
+        }
+      },
+      getOption: function(option) {return options[option];},
+      undo: operation(undo),
+      redo: operation(redo),
+      indentLine: operation(function(n, dir) {
+        if (typeof dir != "string") {
+          if (dir == null) dir = options.smartIndent ? "smart" : "prev";
+          else dir = dir ? "add" : "subtract";
+        }
+        if (isLine(n)) indentLine(n, dir);
+      }),
+      indentSelection: operation(indentSelected),
+      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
+      clearHistory: function() {history = new History();},
+      matchBrackets: operation(function(){matchBrackets(true);}),
+      getTokenAt: operation(function(pos) {
+        pos = clipPos(pos);
+        return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);
+      }),
+      getStateAfter: function(line) {
+        line = clipLine(line == null ? doc.size - 1: line);
+        return getStateBefore(line + 1);
+      },
+      cursorCoords: function(start, mode) {
+        if (start == null) start = sel.inverted;
+        return this.charCoords(start ? sel.from : sel.to, mode);
+      },
+      charCoords: function(pos, mode) {
+        pos = clipPos(pos);
+        if (mode == "local") return localCoords(pos, false);
+        if (mode == "div") return localCoords(pos, true);
+        return pageCoords(pos);
+      },
+      coordsChar: function(coords) {
+        var off = eltOffset(lineSpace);
+        return coordsChar(coords.x - off.left, coords.y - off.top);
+      },
+      markText: operation(markText),
+      setBookmark: setBookmark,
+      findMarksAt: findMarksAt,
+      setMarker: operation(addGutterMarker),
+      clearMarker: operation(removeGutterMarker),
+      setLineClass: operation(setLineClass),
+      hideLine: operation(function(h) {return setLineHidden(h, true);}),
+      showLine: operation(function(h) {return setLineHidden(h, false);}),
+      onDeleteLine: function(line, f) {
+        if (typeof line == "number") {
+          if (!isLine(line)) return null;
+          line = getLine(line);
+        }
+        (line.handlers || (line.handlers = [])).push(f);
+        return line;
+      },
+      lineInfo: lineInfo,
+      addWidget: function(pos, node, scroll, vert, horiz) {
+        pos = localCoords(clipPos(pos));
+        var top = pos.yBot, left = pos.x;
+        node.style.position = "absolute";
+        code.appendChild(node);
+        if (vert == "over") top = pos.y;
+        else if (vert == "near") {
+          var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),
+              hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
+          if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
+            top = pos.y - node.offsetHeight;
+          if (left + node.offsetWidth > hspace)
+            left = hspace - node.offsetWidth;
+        }
+        node.style.top = (top + paddingTop()) + "px";
+        node.style.left = node.style.right = "";
+        if (horiz == "right") {
+          left = code.clientWidth - node.offsetWidth;
+          node.style.right = "0px";
+        } else {
+          if (horiz == "left") left = 0;
+          else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
+          node.style.left = (left + paddingLeft()) + "px";
+        }
+        if (scroll)
+          scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
+      },
+
+      lineCount: function() {return doc.size;},
+      clipPos: clipPos,
+      getCursor: function(start) {
+        if (start == null) start = sel.inverted;
+        return copyPos(start ? sel.from : sel.to);
+      },
+      somethingSelected: function() {return !posEq(sel.from, sel.to);},
+      setCursor: operation(function(line, ch, user) {
+        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user);
+        else setCursor(line, ch, user);
+      }),
+      setSelection: operation(function(from, to, user) {
+        (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));
+      }),
+      getLine: function(line) {if (isLine(line)) return getLine(line).text;},
+      getLineHandle: function(line) {if (isLine(line)) return getLine(line);},
+      setLine: operation(function(line, text) {
+        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
+      }),
+      removeLine: operation(function(line) {
+        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
+      }),
+      replaceRange: operation(replaceRange),
+      getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
+
+      triggerOnKeyDown: operation(onKeyDown),
+      execCommand: function(cmd) {return commands[cmd](instance);},
+      // Stuff used by commands, probably not much use to outside code.
+      moveH: operation(moveH),
+      deleteH: operation(deleteH),
+      moveV: operation(moveV),
+      toggleOverwrite: function() {
+        if(overwrite){
+          overwrite = false;
+          cursor.className = cursor.className.replace(" CodeMirror-overwrite", "");
+        } else {
+          overwrite = true;
+          cursor.className += " CodeMirror-overwrite";
+        }
+      },
+
+      posFromIndex: function(off) {
+        var lineNo = 0, ch;
+        doc.iter(0, doc.size, function(line) {
+          var sz = line.text.length + 1;
+          if (sz > off) { ch = off; return true; }
+          off -= sz;
+          ++lineNo;
+        });
+        return clipPos({line: lineNo, ch: ch});
+      },
+      indexFromPos: function (coords) {
+        if (coords.line < 0 || coords.ch < 0) return 0;
+        var index = coords.ch;
+        doc.iter(0, coords.line, function (line) {
+          index += line.text.length + 1;
+        });
+        return index;
+      },
+      scrollTo: function(x, y) {
+        if (x != null) scroller.scrollLeft = x;
+        if (y != null) scroller.scrollTop = y;
+        updateDisplay([]);
+      },
+
+      operation: function(f){return operation(f)();},
+      compoundChange: function(f){return compoundChange(f);},
+      refresh: function(){
+        updateDisplay(true);
+        if (scroller.scrollHeight > lastScrollPos)
+          scroller.scrollTop = lastScrollPos;
+      },
+      getInputField: function(){return input;},
+      getWrapperElement: function(){return wrapper;},
+      getScrollerElement: function(){return scroller;},
+      getGutterElement: function(){return gutter;}
+    };
+
+    function getLine(n) { return getLineAt(doc, n); }
+    function updateLineHeight(line, height) {
+      gutterDirty = true;
+      var diff = height - line.height;
+      for (var n = line; n; n = n.parent) n.height += diff;
+    }
+
+    function setValue(code) {
+      var top = {line: 0, ch: 0};
+      updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},
+                  splitLines(code), top, top);
+      updateInput = true;
+    }
+    function getValue() {
+      var text = [];
+      doc.iter(0, doc.size, function(line) { text.push(line.text); });
+      return text.join("\n");
+    }
+
+    function onMouseDown(e) {
+      setShift(e_prop(e, "shiftKey"));
+      // Check whether this is a click in a widget
+      for (var n = e_target(e); n != wrapper; n = n.parentNode)
+        if (n.parentNode == code && n != mover) return;
+
+      // See if this is a click in the gutter
+      for (var n = e_target(e); n != wrapper; n = n.parentNode)
+        if (n.parentNode == gutterText) {
+          if (options.onGutterClick)
+            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
+          return e_preventDefault(e);
+        }
+
+      var start = posFromMouse(e);
+
+      switch (e_button(e)) {
+      case 3:
+        if (gecko && !mac) onContextMenu(e);
+        return;
+      case 2:
+        if (start) setCursor(start.line, start.ch, true);
+        return;
+      }
+      // For button 1, if it was clicked inside the editor
+      // (posFromMouse returning non-null), we have to adjust the
+      // selection.
+      if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
+
+      if (!focused) onFocus();
+
+      var now = +new Date;
+      if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
+        e_preventDefault(e);
+        setTimeout(focusInput, 20);
+        return selectLine(start.line);
+      } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
+        lastDoubleClick = {time: now, pos: start};
+        e_preventDefault(e);
+        return selectWordAt(start);
+      } else { lastClick = {time: now, pos: start}; }
+
+      var last = start, going;
+      if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&
+          !posLess(start, sel.from) && !posLess(sel.to, start)) {
+        // Let the drag handler handle this.
+        if (webkit) lineSpace.draggable = true;
+        function dragEnd(e2) {
+          if (webkit) lineSpace.draggable = false;
+          draggingText = false;
+          up(); drop();
+          if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
+            e_preventDefault(e2);
+            setCursor(start.line, start.ch, true);
+            focusInput();
+          }
+        }
+        var up = connect(document, "mouseup", operation(dragEnd), true);
+        var drop = connect(scroller, "drop", operation(dragEnd), true);
+        draggingText = true;
+        // IE's approach to draggable
+        if (lineSpace.dragDrop) lineSpace.dragDrop();
+        return;
+      }
+      e_preventDefault(e);
+      setCursor(start.line, start.ch, true);
+
+      function extend(e) {
+        var cur = posFromMouse(e, true);
+        if (cur && !posEq(cur, last)) {
+          if (!focused) onFocus();
+          last = cur;
+          setSelectionUser(start, cur);
+          updateInput = false;
+          var visible = visibleLines();
+          if (cur.line >= visible.to || cur.line < visible.from)
+            going = setTimeout(operation(function(){extend(e);}), 150);
+        }
+      }
+
+      function done(e) {
+        clearTimeout(going);
+        var cur = posFromMouse(e);
+        if (cur) setSelectionUser(start, cur);
+        e_preventDefault(e);
+        focusInput();
+        updateInput = true;
+        move(); up();
+      }
+      var move = connect(document, "mousemove", operation(function(e) {
+        clearTimeout(going);
+        e_preventDefault(e);
+        if (!ie && !e_button(e)) done(e);
+        else extend(e);
+      }), true);
+      var up = connect(document, "mouseup", operation(done), true);
+    }
+    function onDoubleClick(e) {
+      for (var n = e_target(e); n != wrapper; n = n.parentNode)
+        if (n.parentNode == gutterText) return e_preventDefault(e);
+      var start = posFromMouse(e);
+      if (!start) return;
+      lastDoubleClick = {time: +new Date, pos: start};
+      e_preventDefault(e);
+      selectWordAt(start);
+    }
+    function onDrop(e) {
+      if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
+      e.preventDefault();
+      var pos = posFromMouse(e, true), files = e.dataTransfer.files;
+      if (!pos || options.readOnly) return;
+      if (files && files.length && window.FileReader && window.File) {
+        function loadFile(file, i) {
+          var reader = new FileReader;
+          reader.onload = function() {
+            text[i] = reader.result;
+            if (++read == n) {
+              pos = clipPos(pos);
+              operation(function() {
+                var end = replaceRange(text.join(""), pos, pos);
+                setSelectionUser(pos, end);
+              })();
+            }
+          };
+          reader.readAsText(file);
+        }
+        var n = files.length, text = Array(n), read = 0;
+        for (var i = 0; i < n; ++i) loadFile(files[i], i);
+      }
+      else {
+        try {
+          var text = e.dataTransfer.getData("Text");
+          if (text) {
+            compoundChange(function() {
+              var curFrom = sel.from, curTo = sel.to;
+              setSelectionUser(pos, pos);
+              if (draggingText) replaceRange("", curFrom, curTo);
+              replaceSelection(text);
+              focusInput();
+            });
+          }
+        }
+        catch(e){}
+      }
+    }
+    function onDragStart(e) {
+      var txt = getSelection();
+      e.dataTransfer.setData("Text", txt);
+      
+      // Use dummy image instead of default browsers image.
+      if (gecko || chrome) {
+        var img = document.createElement('img');
+        img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image
+        e.dataTransfer.setDragImage(img, 0, 0);
+      }
+    }
+
+    function doHandleBinding(bound, dropShift) {
+      if (typeof bound == "string") {
+        bound = commands[bound];
+        if (!bound) return false;
+      }
+      var prevShift = shiftSelecting;
+      try {
+        if (options.readOnly) suppressEdits = true;
+        if (dropShift) shiftSelecting = null;
+        bound(instance);
+      } catch(e) {
+        if (e != Pass) throw e;
+        return false;
+      } finally {
+        shiftSelecting = prevShift;
+        suppressEdits = false;
+      }
+      return true;
+    }
+    function handleKeyBinding(e) {
+      // Handle auto keymap transitions
+      var startMap = getKeyMap(options.keyMap), next = startMap.auto;
+      clearTimeout(maybeTransition);
+      if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
+        if (getKeyMap(options.keyMap) == startMap) {
+          options.keyMap = (next.call ? next.call(null, instance) : next);
+        }
+      }, 50);
+
+      var name = keyNames[e_prop(e, "keyCode")], handled = false;
+      if (name == null || e.altGraphKey) return false;
+      if (e_prop(e, "altKey")) name = "Alt-" + name;
+      if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
+      if (e_prop(e, "metaKey")) name = "Cmd-" + name;
+
+      var stopped = false;
+      function stop() { stopped = true; }
+
+      if (e_prop(e, "shiftKey")) {
+        handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
+                            function(b) {return doHandleBinding(b, true);}, stop)
+               || lookupKey(name, options.extraKeys, options.keyMap, function(b) {
+                 if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
+               }, stop);
+      } else {
+        handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);
+      }
+      if (stopped) handled = false;
+      if (handled) {
+        e_preventDefault(e);
+        if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
+      }
+      return handled;
+    }
+    function handleCharBinding(e, ch) {
+      var handled = lookupKey("'" + ch + "'", options.extraKeys,
+                              options.keyMap, function(b) { return doHandleBinding(b, true); });
+      if (handled) e_preventDefault(e);
+      return handled;
+    }
+
+    var lastStoppedKey = null, maybeTransition;
+    function onKeyDown(e) {
+      if (!focused) onFocus();
+      if (ie && e.keyCode == 27) { e.returnValue = false; }
+      if (pollingFast) { if (readInput()) pollingFast = false; }
+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
+      var code = e_prop(e, "keyCode");
+      // IE does strange things with escape.
+      setShift(code == 16 || e_prop(e, "shiftKey"));
+      // First give onKeyEvent option a chance to handle this.
+      var handled = handleKeyBinding(e);
+      if (window.opera) {
+        lastStoppedKey = handled ? code : null;
+        // Opera has no cut event... we try to at least catch the key combo
+        if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
+          replaceSelection("");
+      }
+    }
+    function onKeyPress(e) {
+      if (pollingFast) readInput();
+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
+      var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
+      if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
+      if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return;
+      var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
+      if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
+        if (mode.electricChars.indexOf(ch) > -1)
+          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);
+      }
+      if (handleCharBinding(e, ch)) return;
+      fastPoll();
+    }
+    function onKeyUp(e) {
+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
+      if (e_prop(e, "keyCode") == 16) shiftSelecting = null;
+    }
+
+    function onFocus() {
+      if (options.readOnly == "nocursor") return;
+      if (!focused) {
+        if (options.onFocus) options.onFocus(instance);
+        focused = true;
+        if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
+          wrapper.className += " CodeMirror-focused";
+        if (!leaveInputAlone) resetInput(true);
+      }
+      slowPoll();
+      restartBlink();
+    }
+    function onBlur() {
+      if (focused) {
+        if (options.onBlur) options.onBlur(instance);
+        focused = false;
+        if (bracketHighlighted)
+          operation(function(){
+            if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }
+          })();
+        wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
+      }
+      clearInterval(blinker);
+      setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
+    }
+
+    // Replace the range from from to to by the strings in newText.
+    // Afterwards, set the selection to selFrom, selTo.
+    function updateLines(from, to, newText, selFrom, selTo) {
+      if (suppressEdits) return;
+      if (history) {
+        var old = [];
+        doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });
+        history.addChange(from.line, newText.length, old);
+        while (history.done.length > options.undoDepth) history.done.shift();
+      }
+      updateLinesNoUndo(from, to, newText, selFrom, selTo);
+    }
+    function unredoHelper(from, to) {
+      if (!from.length) return;
+      var set = from.pop(), out = [];
+      for (var i = set.length - 1; i >= 0; i -= 1) {
+        var change = set[i];
+        var replaced = [], end = change.start + change.added;
+        doc.iter(change.start, end, function(line) { replaced.push(line.text); });
+        out.push({start: change.start, added: change.old.length, old: replaced});
+        var pos = clipPos({line: change.start + change.old.length - 1,
+                           ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
+        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
+      }
+      updateInput = true;
+      to.push(out);
+    }
+    function undo() {unredoHelper(history.done, history.undone);}
+    function redo() {unredoHelper(history.undone, history.done);}
+
+    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
+      if (suppressEdits) return;
+      var recomputeMaxLength = false, maxLineLength = maxLine.length;
+      if (!options.lineWrapping)
+        doc.iter(from.line, to.line + 1, function(line) {
+          if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
+        });
+      if (from.line != to.line || newText.length > 1) gutterDirty = true;
+
+      var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
+      // First adjust the line structure, taking some care to leave highlighting intact.
+      if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {
+        // This is a whole-line replace. Treated specially to make
+        // sure line objects move the way they are supposed to.
+        var added = [], prevLine = null;
+        if (from.line) {
+          prevLine = getLine(from.line - 1);
+          prevLine.fixMarkEnds(lastLine);
+        } else lastLine.fixMarkStarts();
+        for (var i = 0, e = newText.length - 1; i < e; ++i)
+          added.push(Line.inheritMarks(newText[i], prevLine));
+        if (nlines) doc.remove(from.line, nlines, callbacks);
+        if (added.length) doc.insert(from.line, added);
+      } else if (firstLine == lastLine) {
+        if (newText.length == 1)
+          firstLine.replace(from.ch, to.ch, newText[0]);
+        else {
+          lastLine = firstLine.split(to.ch, newText[newText.length-1]);
+          firstLine.replace(from.ch, null, newText[0]);
+          firstLine.fixMarkEnds(lastLine);
+          var added = [];
+          for (var i = 1, e = newText.length - 1; i < e; ++i)
+            added.push(Line.inheritMarks(newText[i], firstLine));
+          added.push(lastLine);
+          doc.insert(from.line + 1, added);
+        }
+      } else if (newText.length == 1) {
+        firstLine.replace(from.ch, null, newText[0]);
+        lastLine.replace(null, to.ch, "");
+        firstLine.append(lastLine);
+        doc.remove(from.line + 1, nlines, callbacks);
+      } else {
+        var added = [];
+        firstLine.replace(from.ch, null, newText[0]);
+        lastLine.replace(null, to.ch, newText[newText.length-1]);
+        firstLine.fixMarkEnds(lastLine);
+        for (var i = 1, e = newText.length - 1; i < e; ++i)
+          added.push(Line.inheritMarks(newText[i], firstLine));
+        if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);
+        doc.insert(from.line + 1, added);
+      }
+      if (options.lineWrapping) {
+        var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);
+        doc.iter(from.line, from.line + newText.length, function(line) {
+          if (line.hidden) return;
+          var guess = Math.ceil(line.text.length / perLine) || 1;
+          if (guess != line.height) updateLineHeight(line, guess);
+        });
+      } else {
+        doc.iter(from.line, from.line + newText.length, function(line) {
+          var l = line.text;
+          if (l.length > maxLineLength) {
+            maxLine = l; maxLineLength = l.length; maxWidth = null;
+            recomputeMaxLength = false;
+          }
+        });
+        if (recomputeMaxLength) {
+          maxLineLength = 0; maxLine = ""; maxWidth = null;
+          doc.iter(0, doc.size, function(line) {
+            var l = line.text;
+            if (l.length > maxLineLength) {
+              maxLineLength = l.length; maxLine = l;
+            }
+          });
+        }
+      }
+
+      // Add these lines to the work array, so that they will be
+      // highlighted. Adjust work lines if lines were added/removed.
+      var newWork = [], lendiff = newText.length - nlines - 1;
+      for (var i = 0, l = work.length; i < l; ++i) {
+        var task = work[i];
+        if (task < from.line) newWork.push(task);
+        else if (task > to.line) newWork.push(task + lendiff);
+      }
+      var hlEnd = from.line + Math.min(newText.length, 500);
+      highlightLines(from.line, hlEnd);
+      newWork.push(hlEnd);
+      work = newWork;
+      startWorker(100);
+      // Remember that these lines changed, for updating the display
+      changes.push({from: from.line, to: to.line + 1, diff: lendiff});
+      var changeObj = {from: from, to: to, text: newText};
+      if (textChanged) {
+        for (var cur = textChanged; cur.next; cur = cur.next) {}
+        cur.next = changeObj;
+      } else textChanged = changeObj;
+
+      // Update the selection
+      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
+      setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
+
+      // Make sure the scroll-size div has the correct height.
+      if (scroller.clientHeight)
+        code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px";
+    }
+
+    function replaceRange(code, from, to) {
+      from = clipPos(from);
+      if (!to) to = from; else to = clipPos(to);
+      code = splitLines(code);
+      function adjustPos(pos) {
+        if (posLess(pos, from)) return pos;
+        if (!posLess(to, pos)) return end;
+        var line = pos.line + code.length - (to.line - from.line) - 1;
+        var ch = pos.ch;
+        if (pos.line == to.line)
+          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
+        return {line: line, ch: ch};
+      }
+      var end;
+      replaceRange1(code, from, to, function(end1) {
+        end = end1;
+        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
+      });
+      return end;
+    }
+    function replaceSelection(code, collapse) {
+      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
+        if (collapse == "end") return {from: end, to: end};
+        else if (collapse == "start") return {from: sel.from, to: sel.from};
+        else return {from: sel.from, to: end};
+      });
+    }
+    function replaceRange1(code, from, to, computeSel) {
+      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
+      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
+      updateLines(from, to, code, newSel.from, newSel.to);
+    }
+
+    function getRange(from, to) {
+      var l1 = from.line, l2 = to.line;
+      if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
+      var code = [getLine(l1).text.slice(from.ch)];
+      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
+      code.push(getLine(l2).text.slice(0, to.ch));
+      return code.join("\n");
+    }
+    function getSelection() {
+      return getRange(sel.from, sel.to);
+    }
+
+    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
+    function slowPoll() {
+      if (pollingFast) return;
+      poll.set(options.pollInterval, function() {
+        startOperation();
+        readInput();
+        if (focused) slowPoll();
+        endOperation();
+      });
+    }
+    function fastPoll() {
+      var missed = false;
+      pollingFast = true;
+      function p() {
+        startOperation();
+        var changed = readInput();
+        if (!changed && !missed) {missed = true; poll.set(60, p);}
+        else {pollingFast = false; slowPoll();}
+        endOperation();
+      }
+      poll.set(20, p);
+    }
+
+    // Previnput is a hack to work with IME. If we reset the textarea
+    // on every change, that breaks IME. So we look for changes
+    // compared to the previous content instead. (Modern browsers have
+    // events that indicate IME taking place, but these are not widely
+    // supported or compatible enough yet to rely on.)
+    var prevInput = "";
+    function readInput() {
+      if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;
+      var text = input.value;
+      if (text == prevInput) return false;
+      shiftSelecting = null;
+      var same = 0, l = Math.min(prevInput.length, text.length);
+      while (same < l && prevInput[same] == text[same]) ++same;
+      if (same < prevInput.length)
+        sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
+      else if (overwrite && posEq(sel.from, sel.to))
+        sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
+      replaceSelection(text.slice(same), "end");
+      prevInput = text;
+      return true;
+    }
+    function resetInput(user) {
+      if (!posEq(sel.from, sel.to)) {
+        prevInput = "";
+        input.value = getSelection();
+        selectInput(input);
+      } else if (user) prevInput = input.value = "";
+    }
+
+    function focusInput() {
+      if (options.readOnly != "nocursor") input.focus();
+    }
+
+    function scrollEditorIntoView() {
+      if (!cursor.getBoundingClientRect) return;
+      var rect = cursor.getBoundingClientRect();
+      // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden
+      if (ie && rect.top == rect.bottom) return;
+      var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
+      if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
+    }
+    function scrollCursorIntoView() {
+      var cursor = localCoords(sel.inverted ? sel.from : sel.to);
+      var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
+      return scrollIntoView(x, cursor.y, x, cursor.yBot);
+    }
+    function scrollIntoView(x1, y1, x2, y2) {
+      var pl = paddingLeft(), pt = paddingTop();
+      y1 += pt; y2 += pt; x1 += pl; x2 += pl;
+      var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
+      if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;}
+      else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;}
+
+      var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
+      var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
+      var atLeft = x1 < gutterw + pl + 10;
+      if (x1 < screenleft + gutterw || atLeft) {
+        if (atLeft) x1 = 0;
+        scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
+        scrolled = true;
+      }
+      else if (x2 > screenw + screenleft - 3) {
+        scroller.scrollLeft = x2 + 10 - screenw;
+        scrolled = true;
+        if (x2 > code.clientWidth) result = false;
+      }
+      if (scrolled && options.onScroll) options.onScroll(instance);
+      return result;
+    }
+
+    function visibleLines() {
+      var lh = textHeight(), top = scroller.scrollTop - paddingTop();
+      var fromHeight = Math.max(0, Math.floor(top / lh));
+      var toHeight = Math.ceil((top + scroller.clientHeight) / lh);
+      return {from: lineAtHeight(doc, fromHeight),
+              to: lineAtHeight(doc, toHeight)};
+    }
+    // Uses a set of changes plus the current scroll position to
+    // determine which DOM updates have to be made, and makes the
+    // updates.
+    function updateDisplay(changes, suppressCallback) {
+      if (!scroller.clientWidth) {
+        showingFrom = showingTo = displayOffset = 0;
+        return;
+      }
+      // Compute the new visible window
+      var visible = visibleLines();
+      // Bail out if the visible area is already rendered and nothing changed.
+      if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;
+      var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
+      if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
+      if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);
+
+      // Create a range of theoretically intact lines, and punch holes
+      // in that using the change info.
+      var intact = changes === true ? [] :
+        computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
+      // Clip off the parts that won't be visible
+      var intactLines = 0;
+      for (var i = 0; i < intact.length; ++i) {
+        var range = intact[i];
+        if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
+        if (range.to > to) range.to = to;
+        if (range.from >= range.to) intact.splice(i--, 1);
+        else intactLines += range.to - range.from;
+      }
+      if (intactLines == to - from && from == showingFrom && to == showingTo) return;
+      intact.sort(function(a, b) {return a.domStart - b.domStart;});
+
+      var th = textHeight(), gutterDisplay = gutter.style.display;
+      lineDiv.style.display = "none";
+      patchDisplay(from, to, intact);
+      lineDiv.style.display = gutter.style.display = "";
+
+      // Position the mover div to align with the lines it's supposed
+      // to be showing (which will cover the visible display)
+      var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;
+      // This is just a bogus formula that detects when the editor is
+      // resized or the font size changes.
+      if (different) lastSizeC = scroller.clientHeight + th;
+      showingFrom = from; showingTo = to;
+      displayOffset = heightAtLine(doc, from);
+      mover.style.top = (displayOffset * th) + "px";
+      if (scroller.clientHeight)
+        code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
+
+      // Since this is all rather error prone, it is honoured with the
+      // only assertion in the whole file.
+      if (lineDiv.childNodes.length != showingTo - showingFrom)
+        throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
+                        " nodes=" + lineDiv.childNodes.length);
+
+      function checkHeights() {
+        maxWidth = scroller.clientWidth;
+        var curNode = lineDiv.firstChild, heightChanged = false;
+        doc.iter(showingFrom, showingTo, function(line) {
+          if (!line.hidden) {
+            var height = Math.round(curNode.offsetHeight / th) || 1;
+            if (line.height != height) {
+              updateLineHeight(line, height);
+              gutterDirty = heightChanged = true;
+            }
+          }
+          curNode = curNode.nextSibling;
+        });
+        if (heightChanged)
+          code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
+        return heightChanged;
+      }
+
+      if (options.lineWrapping) {
+        checkHeights();
+      } else {
+        if (maxWidth == null) maxWidth = stringWidth(maxLine);
+        if (maxWidth > scroller.clientWidth) {
+          lineSpace.style.width = maxWidth + "px";
+          // Needed to prevent odd wrapping/hiding of widgets placed in here.
+          code.style.width = "";
+          code.style.width = scroller.scrollWidth + "px";
+        } else {
+          lineSpace.style.width = code.style.width = "";
+        }
+      }
+
+      gutter.style.display = gutterDisplay;
+      if (different || gutterDirty) {
+        // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
+        updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
+      }
+      updateSelection();
+      if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
+      return true;
+    }
+
+    function computeIntact(intact, changes) {
+      for (var i = 0, l = changes.length || 0; i < l; ++i) {
+        var change = changes[i], intact2 = [], diff = change.diff || 0;
+        for (var j = 0, l2 = intact.length; j < l2; ++j) {
+          var range = intact[j];
+          if (change.to <= range.from && change.diff)
+            intact2.push({from: range.from + diff, to: range.to + diff,
+                          domStart: range.domStart});
+          else if (change.to <= range.from || change.from >= range.to)
+            intact2.push(range);
+          else {
+            if (change.from > range.from)
+              intact2.push({from: range.from, to: change.from, domStart: range.domStart});
+            if (change.to < range.to)
+              intact2.push({from: change.to + diff, to: range.to + diff,
+                            domStart: range.domStart + (change.to - range.from)});
+          }
+        }
+        intact = intact2;
+      }
+      return intact;
+    }
+
+    function patchDisplay(from, to, intact) {
+      // The first pass removes the DOM nodes that aren't intact.
+      if (!intact.length) lineDiv.innerHTML = "";
+      else {
+        function killNode(node) {
+          var tmp = node.nextSibling;
+          node.parentNode.removeChild(node);
+          return tmp;
+        }
+        var domPos = 0, curNode = lineDiv.firstChild, n;
+        for (var i = 0; i < intact.length; ++i) {
+          var cur = intact[i];
+          while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}
+          for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}
+        }
+        while (curNode) curNode = killNode(curNode);
+      }
+      // This pass fills in the lines that actually changed.
+      var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
+      var scratch = document.createElement("div");
+      doc.iter(from, to, function(line) {
+        if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
+        if (!nextIntact || nextIntact.from > j) {
+          if (line.hidden) var html = scratch.innerHTML = "<pre></pre>";
+          else {
+            var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>'
+              + line.getHTML(makeTab) + '</pre>';
+            // Kludge to make sure the styled element lies behind the selection (by z-index)
+            if (line.bgClassName)
+              html = '<div style="position: relative"><pre class="' + line.bgClassName +
+              '" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2">&#160;</pre>' + html + "</div>";
+          }
+          scratch.innerHTML = html;
+          lineDiv.insertBefore(scratch.firstChild, curNode);
+        } else {
+          curNode = curNode.nextSibling;
+        }
+        ++j;
+      });
+    }
+
+    function updateGutter() {
+      if (!options.gutter && !options.lineNumbers) return;
+      var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
+      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
+      var html = [], i = showingFrom, normalNode;
+      doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
+        if (line.hidden) {
+          html.push("<pre></pre>");
+        } else {
+          var marker = line.gutterMarker;
+          var text = options.lineNumbers ? i + options.firstLineNumber : null;
+          if (marker && marker.text)
+            text = marker.text.replace("%N%", text != null ? text : "");
+          else if (text == null)
+            text = "\u00a0";
+          html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);
+          for (var j = 1; j < line.height; ++j) html.push("<br/>&#160;");
+          html.push("</pre>");
+          if (!marker) normalNode = i;
+        }
+        ++i;
+      });
+      gutter.style.display = "none";
+      gutterText.innerHTML = html.join("");
+      // Make sure scrolling doesn't cause number gutter size to pop
+      if (normalNode != null) {
+        var node = gutterText.childNodes[normalNode - showingFrom];
+        var minwidth = String(doc.size).length, val = eltText(node), pad = "";
+        while (val.length + pad.length < minwidth) pad += "\u00a0";
+        if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);
+      }
+      gutter.style.display = "";
+      var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;
+      lineSpace.style.marginLeft = gutter.offsetWidth + "px";
+      gutterDirty = false;
+      return resized;
+    }
+    function updateSelection() {
+      var collapsed = posEq(sel.from, sel.to);
+      var fromPos = localCoords(sel.from, true);
+      var toPos = collapsed ? fromPos : localCoords(sel.to, true);
+      var headPos = sel.inverted ? fromPos : toPos, th = textHeight();
+      var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);
+      inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";
+      inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";
+      if (collapsed) {
+        cursor.style.top = headPos.y + "px";
+        cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";
+        cursor.style.display = "";
+        selectionDiv.style.display = "none";
+      } else {
+        var sameLine = fromPos.y == toPos.y, html = "";
+        var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
+        var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
+        function add(left, top, right, height) {
+          var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"
+                                  : "right: " + right + "px";
+          html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left +
+            'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px"></div>';
+        }
+        if (sel.from.ch && fromPos.y >= 0) {
+          var right = sameLine ? clientWidth - toPos.x : 0;
+          add(fromPos.x, fromPos.y, right, th);
+        }
+        var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));
+        var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;
+        if (middleHeight > 0.2 * th)
+          add(0, middleStart, 0, middleHeight);
+        if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
+          add(0, toPos.y, clientWidth - toPos.x, th);
+        selectionDiv.innerHTML = html;
+        cursor.style.display = "none";
+        selectionDiv.style.display = "";
+      }
+    }
+
+    function setShift(val) {
+      if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
+      else shiftSelecting = null;
+    }
+    function setSelectionUser(from, to) {
+      var sh = shiftSelecting && clipPos(shiftSelecting);
+      if (sh) {
+        if (posLess(sh, from)) from = sh;
+        else if (posLess(to, sh)) to = sh;
+      }
+      setSelection(from, to);
+      userSelChange = true;
+    }
+    // Update the selection. Last two args are only used by
+    // updateLines, since they have to be expressed in the line
+    // numbers before the update.
+    function setSelection(from, to, oldFrom, oldTo) {
+      goalColumn = null;
+      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
+      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
+      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
+
+      // Skip over hidden lines.
+      if (from.line != oldFrom) {
+        var from1 = skipHidden(from, oldFrom, sel.from.ch);
+        // If there is no non-hidden line left, force visibility on current line
+        if (!from1) setLineHidden(from.line, false);
+        else from = from1;
+      }
+      if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
+
+      if (posEq(from, to)) sel.inverted = false;
+      else if (posEq(from, sel.to)) sel.inverted = false;
+      else if (posEq(to, sel.from)) sel.inverted = true;
+
+      if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
+        var head = sel.inverted ? from : to;
+        if (head.line != sel.from.line && sel.from.line < doc.size) {
+          var oldLine = getLine(sel.from.line);
+          if (/^\s+$/.test(oldLine.text))
+            setTimeout(operation(function() {
+              if (oldLine.parent && /^\s+$/.test(oldLine.text)) {
+                var no = lineNo(oldLine);
+                replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});
+              }
+            }, 10));
+        }
+      }
+
+      sel.from = from; sel.to = to;
+      selectionChanged = true;
+    }
+    function skipHidden(pos, oldLine, oldCh) {
+      function getNonHidden(dir) {
+        var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;
+        while (lNo != end) {
+          var line = getLine(lNo);
+          if (!line.hidden) {
+            var ch = pos.ch;
+            if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;
+            return {line: lNo, ch: ch};
+          }
+          lNo += dir;
+        }
+      }
+      var line = getLine(pos.line);
+      var toEnd = pos.ch == line.text.length && pos.ch != oldCh;
+      if (!line.hidden) return pos;
+      if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);
+      else return getNonHidden(-1) || getNonHidden(1);
+    }
+    function setCursor(line, ch, user) {
+      var pos = clipPos({line: line, ch: ch || 0});
+      (user ? setSelectionUser : setSelection)(pos, pos);
+    }
+
+    function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}
+    function clipPos(pos) {
+      if (pos.line < 0) return {line: 0, ch: 0};
+      if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};
+      var ch = pos.ch, linelen = getLine(pos.line).text.length;
+      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
+      else if (ch < 0) return {line: pos.line, ch: 0};
+      else return pos;
+    }
+
+    function findPosH(dir, unit) {
+      var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;
+      var lineObj = getLine(line);
+      function findNextLine() {
+        for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {
+          var lo = getLine(l);
+          if (!lo.hidden) { line = l; lineObj = lo; return true; }
+        }
+      }
+      function moveOnce(boundToLine) {
+        if (ch == (dir < 0 ? 0 : lineObj.text.length)) {
+          if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;
+          else return false;
+        } else ch += dir;
+        return true;
+      }
+      if (unit == "char") moveOnce();
+      else if (unit == "column") moveOnce(true);
+      else if (unit == "word") {
+        var sawWord = false;
+        for (;;) {
+          if (dir < 0) if (!moveOnce()) break;
+          if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
+          else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
+          if (dir > 0) if (!moveOnce()) break;
+        }
+      }
+      return {line: line, ch: ch};
+    }
+    function moveH(dir, unit) {
+      var pos = dir < 0 ? sel.from : sel.to;
+      if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);
+      setCursor(pos.line, pos.ch, true);
+    }
+    function deleteH(dir, unit) {
+      if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to);
+      else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to);
+      else replaceRange("", sel.from, findPosH(dir, unit));
+      userSelChange = true;
+    }
+    var goalColumn = null;
+    function moveV(dir, unit) {
+      var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);
+      if (goalColumn != null) pos.x = goalColumn;
+      if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);
+      else if (unit == "line") dist = textHeight();
+      var target = coordsChar(pos.x, pos.y + dist * dir + 2);
+      if (unit == "page") scroller.scrollTop += localCoords(target, true).y - pos.y;
+      setCursor(target.line, target.ch, true);
+      goalColumn = pos.x;
+    }
+
+    function selectWordAt(pos) {
+      var line = getLine(pos.line).text;
+      var start = pos.ch, end = pos.ch;
+      while (start > 0 && isWordChar(line.charAt(start - 1))) --start;
+      while (end < line.length && isWordChar(line.charAt(end))) ++end;
+      setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
+    }
+    function selectLine(line) {
+      setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));
+    }
+    function indentSelected(mode) {
+      if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
+      var e = sel.to.line - (sel.to.ch ? 0 : 1);
+      for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
+    }
+
+    function indentLine(n, how) {
+      if (!how) how = "add";
+      if (how == "smart") {
+        if (!mode.indent) how = "prev";
+        else var state = getStateBefore(n);
+      }
+
+      var line = getLine(n), curSpace = line.indentation(options.tabSize),
+          curSpaceString = line.text.match(/^\s*/)[0], indentation;
+      if (how == "prev") {
+        if (n) indentation = getLine(n-1).indentation(options.tabSize);
+        else indentation = 0;
+      }
+      else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
+      else if (how == "add") indentation = curSpace + options.indentUnit;
+      else if (how == "subtract") indentation = curSpace - options.indentUnit;
+      indentation = Math.max(0, indentation);
+      var diff = indentation - curSpace;
+
+      if (!diff) {
+        if (sel.from.line != n && sel.to.line != n) return;
+        var indentString = curSpaceString;
+      }
+      else {
+        var indentString = "", pos = 0;
+        if (options.indentWithTabs)
+          for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";}
+        while (pos < indentation) {++pos; indentString += " ";}
+      }
+
+      replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
+    }
+
+    function loadMode() {
+      mode = CodeMirror.getMode(options, options.mode);
+      doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
+      work = [0];
+      startWorker();
+    }
+    function gutterChanged() {
+      var visible = options.gutter || options.lineNumbers;
+      gutter.style.display = visible ? "" : "none";
+      if (visible) gutterDirty = true;
+      else lineDiv.parentNode.style.marginLeft = 0;
+    }
+    function wrappingChanged(from, to) {
+      if (options.lineWrapping) {
+        wrapper.className += " CodeMirror-wrap";
+        var perLine = scroller.clientWidth / charWidth() - 3;
+        doc.iter(0, doc.size, function(line) {
+          if (line.hidden) return;
+          var guess = Math.ceil(line.text.length / perLine) || 1;
+          if (guess != 1) updateLineHeight(line, guess);
+        });
+        lineSpace.style.width = code.style.width = "";
+      } else {
+        wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
+        maxWidth = null; maxLine = "";
+        doc.iter(0, doc.size, function(line) {
+          if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
+          if (line.text.length > maxLine.length) maxLine = line.text;
+        });
+      }
+      changes.push({from: 0, to: doc.size});
+    }
+    function makeTab(col) {
+      var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
+      if (cached) return cached;
+      for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " ";
+      return (tabCache[w] = {html: str + "</span>", width: w});
+    }
+    function themeChanged() {
+      scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") +
+        options.theme.replace(/(^|\s)\s*/g, " cm-s-");
+    }
+
+    function TextMarker() { this.set = []; }
+    TextMarker.prototype.clear = operation(function() {
+      var min = Infinity, max = -Infinity;
+      for (var i = 0, e = this.set.length; i < e; ++i) {
+        var line = this.set[i], mk = line.marked;
+        if (!mk || !line.parent) continue;
+        var lineN = lineNo(line);
+        min = Math.min(min, lineN); max = Math.max(max, lineN);
+        for (var j = 0; j < mk.length; ++j)
+          if (mk[j].marker == this) mk.splice(j--, 1);
+      }
+      if (min != Infinity)
+        changes.push({from: min, to: max + 1});
+    });
+    TextMarker.prototype.find = function() {
+      var from, to;
+      for (var i = 0, e = this.set.length; i < e; ++i) {
+        var line = this.set[i], mk = line.marked;
+        for (var j = 0; j < mk.length; ++j) {
+          var mark = mk[j];
+          if (mark.marker == this) {
+            if (mark.from != null || mark.to != null) {
+              var found = lineNo(line);
+              if (found != null) {
+                if (mark.from != null) from = {line: found, ch: mark.from};
+                if (mark.to != null) to = {line: found, ch: mark.to};
+              }
+            }
+          }
+        }
+      }
+      return {from: from, to: to};
+    };
+
+    function markText(from, to, className) {
+      from = clipPos(from); to = clipPos(to);
+      var tm = new TextMarker();
+      if (!posLess(from, to)) return tm;
+      function add(line, from, to, className) {
+        getLine(line).addMark(new MarkedText(from, to, className, tm));
+      }
+      if (from.line == to.line) add(from.line, from.ch, to.ch, className);
+      else {
+        add(from.line, from.ch, null, className);
+        for (var i = from.line + 1, e = to.line; i < e; ++i)
+          add(i, null, null, className);
+        add(to.line, null, to.ch, className);
+      }
+      changes.push({from: from.line, to: to.line + 1});
+      return tm;
+    }
+
+    function setBookmark(pos) {
+      pos = clipPos(pos);
+      var bm = new Bookmark(pos.ch);
+      getLine(pos.line).addMark(bm);
+      return bm;
+    }
+
+    function findMarksAt(pos) {
+      pos = clipPos(pos);
+      var markers = [], marked = getLine(pos.line).marked;
+      if (!marked) return markers;
+      for (var i = 0, e = marked.length; i < e; ++i) {
+        var m = marked[i];
+        if ((m.from == null || m.from <= pos.ch) &&
+            (m.to == null || m.to >= pos.ch))
+          markers.push(m.marker || m);
+      }
+      return markers;
+    }
+
+    function addGutterMarker(line, text, className) {
+      if (typeof line == "number") line = getLine(clipLine(line));
+      line.gutterMarker = {text: text, style: className};
+      gutterDirty = true;
+      return line;
+    }
+    function removeGutterMarker(line) {
+      if (typeof line == "number") line = getLine(clipLine(line));
+      line.gutterMarker = null;
+      gutterDirty = true;
+    }
+
+    function changeLine(handle, op) {
+      var no = handle, line = handle;
+      if (typeof handle == "number") line = getLine(clipLine(handle));
+      else no = lineNo(handle);
+      if (no == null) return null;
+      if (op(line, no)) changes.push({from: no, to: no + 1});
+      else return null;
+      return line;
+    }
+    function setLineClass(handle, className, bgClassName) {
+      return changeLine(handle, function(line) {
+        if (line.className != className || line.bgClassName != bgClassName) {
+          line.className = className;
+          line.bgClassName = bgClassName;
+          return true;
+        }
+      });
+    }
+    function setLineHidden(handle, hidden) {
+      return changeLine(handle, function(line, no) {
+        if (line.hidden != hidden) {
+          line.hidden = hidden;
+          updateLineHeight(line, hidden ? 0 : 1);
+          var fline = sel.from.line, tline = sel.to.line;
+          if (hidden && (fline == no || tline == no)) {
+            var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;
+            var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;
+            // Can't hide the last visible line, we'd have no place to put the cursor
+            if (!to) return;
+            setSelection(from, to);
+          }
+          return (gutterDirty = true);
+        }
+      });
+    }
+
+    function lineInfo(line) {
+      if (typeof line == "number") {
+        if (!isLine(line)) return null;
+        var n = line;
+        line = getLine(line);
+        if (!line) return null;
+      }
+      else {
+        var n = lineNo(line);
+        if (n == null) return null;
+      }
+      var marker = line.gutterMarker;
+      return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
+              markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};
+    }
+
+    function stringWidth(str) {
+      measure.innerHTML = "<pre><span>x</span></pre>";
+      measure.firstChild.firstChild.firstChild.nodeValue = str;
+      return measure.firstChild.firstChild.offsetWidth || 10;
+    }
+    // These are used to go from pixel positions to character
+    // positions, taking varying character widths into account.
+    function charFromX(line, x) {
+      if (x <= 0) return 0;
+      var lineObj = getLine(line), text = lineObj.text;
+      function getX(len) {
+        return measureLine(lineObj, len).left;
+      }
+      var from = 0, fromX = 0, to = text.length, toX;
+      // Guess a suitable upper bound for our search.
+      var estimated = Math.min(to, Math.ceil(x / charWidth()));
+      for (;;) {
+        var estX = getX(estimated);
+        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
+        else {toX = estX; to = estimated; break;}
+      }
+      if (x > toX) return to;
+      // Try to guess a suitable lower bound as well.
+      estimated = Math.floor(to * 0.8); estX = getX(estimated);
+      if (estX < x) {from = estimated; fromX = estX;}
+      // Do a binary search between these bounds.
+      for (;;) {
+        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
+        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
+        if (middleX > x) {to = middle; toX = middleX;}
+        else {from = middle; fromX = middleX;}
+      }
+    }
+
+    var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16);
+    function measureLine(line, ch) {
+      if (ch == 0) return {top: 0, left: 0};
+      var wbr = options.lineWrapping && ch < line.text.length &&
+                spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
+      measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch, tempId, wbr) + "</pre>";
+      var elt = document.getElementById(tempId);
+      var top = elt.offsetTop, left = elt.offsetLeft;
+      // Older IEs report zero offsets for spans directly after a wrap
+      if (ie && top == 0 && left == 0) {
+        var backup = document.createElement("span");
+        backup.innerHTML = "x";
+        elt.parentNode.insertBefore(backup, elt.nextSibling);
+        top = backup.offsetTop;
+      }
+      return {top: top, left: left};
+    }
+    function localCoords(pos, inLineWrap) {
+      var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
+      if (pos.ch == 0) x = 0;
+      else {
+        var sp = measureLine(getLine(pos.line), pos.ch);
+        x = sp.left;
+        if (options.lineWrapping) y += Math.max(0, sp.top);
+      }
+      return {x: x, y: y, yBot: y + lh};
+    }
+    // Coords must be lineSpace-local
+    function coordsChar(x, y) {
+      if (y < 0) y = 0;
+      var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
+      var lineNo = lineAtHeight(doc, heightPos);
+      if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
+      var lineObj = getLine(lineNo), text = lineObj.text;
+      var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;
+      if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};
+      function getX(len) {
+        var sp = measureLine(lineObj, len);
+        if (tw) {
+          var off = Math.round(sp.top / th);
+          return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);
+        }
+        return sp.left;
+      }
+      var from = 0, fromX = 0, to = text.length, toX;
+      // Guess a suitable upper bound for our search.
+      var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));
+      for (;;) {
+        var estX = getX(estimated);
+        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
+        else {toX = estX; to = estimated; break;}
+      }
+      if (x > toX) return {line: lineNo, ch: to};
+      // Try to guess a suitable lower bound as well.
+      estimated = Math.floor(to * 0.8); estX = getX(estimated);
+      if (estX < x) {from = estimated; fromX = estX;}
+      // Do a binary search between these bounds.
+      for (;;) {
+        if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};
+        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
+        if (middleX > x) {to = middle; toX = middleX;}
+        else {from = middle; fromX = middleX;}
+      }
+    }
+    function pageCoords(pos) {
+      var local = localCoords(pos, true), off = eltOffset(lineSpace);
+      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
+    }
+
+    var cachedHeight, cachedHeightFor, measureText;
+    function textHeight() {
+      if (measureText == null) {
+        measureText = "<pre>";
+        for (var i = 0; i < 49; ++i) measureText += "x<br/>";
+        measureText += "x</pre>";
+      }
+      var offsetHeight = lineDiv.clientHeight;
+      if (offsetHeight == cachedHeightFor) return cachedHeight;
+      cachedHeightFor = offsetHeight;
+      measure.innerHTML = measureText;
+      cachedHeight = measure.firstChild.offsetHeight / 50 || 1;
+      measure.innerHTML = "";
+      return cachedHeight;
+    }
+    var cachedWidth, cachedWidthFor = 0;
+    function charWidth() {
+      if (scroller.clientWidth == cachedWidthFor) return cachedWidth;
+      cachedWidthFor = scroller.clientWidth;
+      return (cachedWidth = stringWidth("x"));
+    }
+    function paddingTop() {return lineSpace.offsetTop;}
+    function paddingLeft() {return lineSpace.offsetLeft;}
+
+    function posFromMouse(e, liberal) {
+      var offW = eltOffset(scroller, true), x, y;
+      // Fails unpredictably on IE[67] when mouse is dragged around quickly.
+      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
+      // This is a mess of a heuristic to try and determine whether a
+      // scroll-bar was clicked or not, and to return null if one was
+      // (and !liberal).
+      if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
+        return null;
+      var offL = eltOffset(lineSpace, true);
+      return coordsChar(x - offL.left, y - offL.top);
+    }
+    function onContextMenu(e) {
+      var pos = posFromMouse(e), scrollPos = scroller.scrollTop;
+      if (!pos || window.opera) return; // Opera is difficult.
+      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
+        operation(setCursor)(pos.line, pos.ch);
+
+      var oldCSS = input.style.cssText;
+      inputDiv.style.position = "absolute";
+      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
+        "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
+        "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
+      leaveInputAlone = true;
+      var val = input.value = getSelection();
+      focusInput();
+      selectInput(input);
+      function rehide() {
+        var newVal = splitLines(input.value).join("\n");
+        if (newVal != val) operation(replaceSelection)(newVal, "end");
+        inputDiv.style.position = "relative";
+        input.style.cssText = oldCSS;
+        if (ie_lt9) scroller.scrollTop = scrollPos;
+        leaveInputAlone = false;
+        resetInput(true);
+        slowPoll();
+      }
+
+      if (gecko) {
+        e_stop(e);
+        var mouseup = connect(window, "mouseup", function() {
+          mouseup();
+          setTimeout(rehide, 20);
+        }, true);
+      } else {
+        setTimeout(rehide, 50);
+      }
+    }
+
+    // Cursor-blinking
+    function restartBlink() {
+      clearInterval(blinker);
+      var on = true;
+      cursor.style.visibility = "";
+      blinker = setInterval(function() {
+        cursor.style.visibility = (on = !on) ? "" : "hidden";
+      }, 650);
+    }
+
+    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
+    function matchBrackets(autoclear) {
+      var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
+      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
+      if (!match) return;
+      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
+      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
+        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
+
+      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
+      function scan(line, from, to) {
+        if (!line.text) return;
+        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
+        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
+          var text = st[i];
+          if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
+          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
+            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
+              var match = matching[cur];
+              if (match.charAt(1) == ">" == forward) stack.push(cur);
+              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
+              else if (!stack.length) return {pos: pos, match: true};
+            }
+          }
+        }
+      }
+      for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {
+        var line = getLine(i), first = i == head.line;
+        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
+        if (found) break;
+      }
+      if (!found) found = {pos: null, match: false};
+      var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
+      var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
+          two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
+      var clear = operation(function(){one.clear(); two && two.clear();});
+      if (autoclear) setTimeout(clear, 800);
+      else bracketHighlighted = clear;
+    }
+
+    // Finds the line to start with when starting a parse. Tries to
+    // find a line with a stateAfter, so that it can start with a
+    // valid state. If that fails, it returns the line with the
+    // smallest indentation, which tends to need the least context to
+    // parse correctly.
+    function findStartLine(n) {
+      var minindent, minline;
+      for (var search = n, lim = n - 40; search > lim; --search) {
+        if (search == 0) return 0;
+        var line = getLine(search-1);
+        if (line.stateAfter) return search;
+        var indented = line.indentation(options.tabSize);
+        if (minline == null || minindent > indented) {
+          minline = search - 1;
+          minindent = indented;
+        }
+      }
+      return minline;
+    }
+    function getStateBefore(n) {
+      var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
+      if (!state) state = startState(mode);
+      else state = copyState(mode, state);
+      doc.iter(start, n, function(line) {
+        line.highlight(mode, state, options.tabSize);
+        line.stateAfter = copyState(mode, state);
+      });
+      if (start < n) changes.push({from: start, to: n});
+      if (n < doc.size && !getLine(n).stateAfter) work.push(n);
+      return state;
+    }
+    function highlightLines(start, end) {
+      var state = getStateBefore(start);
+      doc.iter(start, end, function(line) {
+        line.highlight(mode, state, options.tabSize);
+        line.stateAfter = copyState(mode, state);
+      });
+    }
+    function highlightWorker() {
+      var end = +new Date + options.workTime;
+      var foundWork = work.length;
+      while (work.length) {
+        if (!getLine(showingFrom).stateAfter) var task = showingFrom;
+        else var task = work.pop();
+        if (task >= doc.size) continue;
+        var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
+        if (state) state = copyState(mode, state);
+        else state = startState(mode);
+
+        var unchanged = 0, compare = mode.compareStates, realChange = false,
+            i = start, bail = false;
+        doc.iter(i, doc.size, function(line) {
+          var hadState = line.stateAfter;
+          if (+new Date > end) {
+            work.push(i);
+            startWorker(options.workDelay);
+            if (realChange) changes.push({from: task, to: i + 1});
+            return (bail = true);
+          }
+          var changed = line.highlight(mode, state, options.tabSize);
+          if (changed) realChange = true;
+          line.stateAfter = copyState(mode, state);
+          var done = null;
+          if (compare) {
+            var same = hadState && compare(hadState, state);
+            if (same != Pass) done = !!same;
+          }
+          if (done == null) {
+            if (changed !== false || !hadState) unchanged = 0;
+            else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))
+              done = true;
+          }
+          if (done) return true;
+          ++i;
+        });
+        if (bail) return;
+        if (realChange) changes.push({from: task, to: i + 1});
+      }
+      if (foundWork && options.onHighlightComplete)
+        options.onHighlightComplete(instance);
+    }
+    function startWorker(time) {
+      if (!work.length) return;
+      highlight.set(time, operation(highlightWorker));
+    }
+
+    // Operations are used to wrap changes in such a way that each
+    // change won't have to update the cursor and display (which would
+    // be awkward, slow, and error-prone), but instead updates are
+    // batched and then all combined and executed at once.
+    function startOperation() {
+      updateInput = userSelChange = textChanged = null;
+      changes = []; selectionChanged = false; callbacks = [];
+    }
+    function endOperation() {
+      var reScroll = false, updated;
+      if (selectionChanged) reScroll = !scrollCursorIntoView();
+      if (changes.length) updated = updateDisplay(changes, true);
+      else {
+        if (selectionChanged) updateSelection();
+        if (gutterDirty) updateGutter();
+      }
+      if (reScroll) scrollCursorIntoView();
+      if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
+
+      if (focused && !leaveInputAlone &&
+          (updateInput === true || (updateInput !== false && selectionChanged)))
+        resetInput(userSelChange);
+
+      if (selectionChanged && options.matchBrackets)
+        setTimeout(operation(function() {
+          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
+          if (posEq(sel.from, sel.to)) matchBrackets(false);
+        }), 20);
+      var tc = textChanged, cbs = callbacks; // these can be reset by callbacks
+      if (selectionChanged && options.onCursorActivity)
+        options.onCursorActivity(instance);
+      if (tc && options.onChange && instance)
+        options.onChange(instance, tc);
+      for (var i = 0; i < cbs.length; ++i) cbs[i](instance);
+      if (updated && options.onUpdate) options.onUpdate(instance);
+    }
+    var nestedOperation = 0;
+    function operation(f) {
+      return function() {
+        if (!nestedOperation++) startOperation();
+        try {var result = f.apply(this, arguments);}
+        finally {if (!--nestedOperation) endOperation();}
+        return result;
+      };
+    }
+
+    function compoundChange(f) {
+      history.startCompound();
+      try { return f(); } finally { history.endCompound(); }
+    }
+
+    for (var ext in extensions)
+      if (extensions.propertyIsEnumerable(ext) &&
+          !instance.propertyIsEnumerable(ext))
+        instance[ext] = extensions[ext];
+    return instance;
+  } // (end of function CodeMirror)
+
+  // The default configuration options.
+  CodeMirror.defaults = {
+    value: "",
+    mode: null,
+    theme: "default",
+    indentUnit: 2,
+    indentWithTabs: false,
+    smartIndent: true,
+    tabSize: 4,
+    keyMap: "default",
+    extraKeys: null,
+    electricChars: true,
+    autoClearEmptyLines: false,
+    onKeyEvent: null,
+    onDragEvent: null,
+    lineWrapping: false,
+    lineNumbers: false,
+    gutter: false,
+    fixedGutter: false,
+    firstLineNumber: 1,
+    readOnly: false,
+    dragDrop: true,
+    onChange: null,
+    onCursorActivity: null,
+    onGutterClick: null,
+    onHighlightComplete: null,
+    onUpdate: null,
+    onFocus: null, onBlur: null, onScroll: null,
+    matchBrackets: false,
+    workTime: 100,
+    workDelay: 200,
+    pollInterval: 100,
+    undoDepth: 40,
+    tabindex: null,
+    autofocus: null
+  };
+
+  var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
+  var mac = ios || /Mac/.test(navigator.platform);
+  var win = /Win/.test(navigator.platform);
+
+  // Known modes, by name and by MIME
+  var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
+  CodeMirror.defineMode = function(name, mode) {
+    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
+    if (arguments.length > 2) {
+      mode.dependencies = [];
+      for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
+    }
+    modes[name] = mode;
+  };
+  CodeMirror.defineMIME = function(mime, spec) {
+    mimeModes[mime] = spec;
+  };
+  CodeMirror.resolveMode = function(spec) {
+    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
+      spec = mimeModes[spec];
+    else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
+      return CodeMirror.resolveMode("application/xml");
+    if (typeof spec == "string") return {name: spec};
+    else return spec || {name: "null"};
+  };
+  CodeMirror.getMode = function(options, spec) {
+    var spec = CodeMirror.resolveMode(spec);
+    var mfactory = modes[spec.name];
+    if (!mfactory) return CodeMirror.getMode(options, "text/plain");
+    return mfactory(options, spec);
+  };
+  CodeMirror.listModes = function() {
+    var list = [];
+    for (var m in modes)
+      if (modes.propertyIsEnumerable(m)) list.push(m);
+    return list;
+  };
+  CodeMirror.listMIMEs = function() {
+    var list = [];
+    for (var m in mimeModes)
+      if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
+    return list;
+  };
+
+  var extensions = CodeMirror.extensions = {};
+  CodeMirror.defineExtension = function(name, func) {
+    extensions[name] = func;
+  };
+
+  var commands = CodeMirror.commands = {
+    selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
+    killLine: function(cm) {
+      var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
+      if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0});
+      else cm.replaceRange("", from, sel ? to : {line: from.line});
+    },
+    deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});},
+    undo: function(cm) {cm.undo();},
+    redo: function(cm) {cm.redo();},
+    goDocStart: function(cm) {cm.setCursor(0, 0, true);},
+    goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);},
+    goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);},
+    goLineStartSmart: function(cm) {
+      var cur = cm.getCursor();
+      var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/));
+      cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true);
+    },
+    goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);},
+    goLineUp: function(cm) {cm.moveV(-1, "line");},
+    goLineDown: function(cm) {cm.moveV(1, "line");},
+    goPageUp: function(cm) {cm.moveV(-1, "page");},
+    goPageDown: function(cm) {cm.moveV(1, "page");},
+    goCharLeft: function(cm) {cm.moveH(-1, "char");},
+    goCharRight: function(cm) {cm.moveH(1, "char");},
+    goColumnLeft: function(cm) {cm.moveH(-1, "column");},
+    goColumnRight: function(cm) {cm.moveH(1, "column");},
+    goWordLeft: function(cm) {cm.moveH(-1, "word");},
+    goWordRight: function(cm) {cm.moveH(1, "word");},
+    delCharLeft: function(cm) {cm.deleteH(-1, "char");},
+    delCharRight: function(cm) {cm.deleteH(1, "char");},
+    delWordLeft: function(cm) {cm.deleteH(-1, "word");},
+    delWordRight: function(cm) {cm.deleteH(1, "word");},
+    indentAuto: function(cm) {cm.indentSelection("smart");},
+    indentMore: function(cm) {cm.indentSelection("add");},
+    indentLess: function(cm) {cm.indentSelection("subtract");},
+    insertTab: function(cm) {cm.replaceSelection("\t", "end");},
+    transposeChars: function(cm) {
+      var cur = cm.getCursor(), line = cm.getLine(cur.line);
+      if (cur.ch > 0 && cur.ch < line.length - 1)
+        cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
+                        {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
+    },
+    newlineAndIndent: function(cm) {
+      cm.replaceSelection("\n", "end");
+      cm.indentLine(cm.getCursor().line);
+    },
+    toggleOverwrite: function(cm) {cm.toggleOverwrite();}
+  };
+
+  var keyMap = CodeMirror.keyMap = {};
+  keyMap.basic = {
+    "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
+    "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
+    "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "insertTab", "Shift-Tab": "indentAuto",
+    "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
+  };
+  // Note that the save and find-related commands aren't defined by
+  // default. Unknown commands are simply ignored.
+  keyMap.pcDefault = {
+    "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
+    "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
+    "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
+    "Ctrl-Backspace": "d

<TRUNCATED>

[12/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/runmode.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/runmode.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/runmode.js
deleted file mode 100644
index 29b051b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/runmode.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-CodeMirror.runMode = function(string, modespec, callback) {
-  var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
-  var isNode = callback.nodeType == 1;
-  if (isNode) {
-    var node = callback, accum = [];
-    callback = function(string, style) {
-      if (string == "\n")
-        accum.push("<br>");
-      else if (style)
-        accum.push("<span class=\"" + CodeMirror.htmlEscape(style) + "\">" + CodeMirror.htmlEscape(string) + "</span>");
-      else
-        accum.push(CodeMirror.htmlEscape(string));
-    }
-  }
-  var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
-  for (var i = 0, e = lines.length; i < e; ++i) {
-    if (i) callback("\n");
-    var stream = new CodeMirror.StringStream(lines[i]);
-    while (!stream.eol()) {
-      var style = mode.token(stream, state);
-      callback(stream.current(), style);
-      stream.start = stream.pos;
-    }
-  }
-  if (isNode)
-    node.innerHTML = accum.join("");
-};


[29/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/prototype.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/prototype.js b/extras/webjars/snorql/src/main/resources/prototype.js
new file mode 100755
index 0000000..3548fc0
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/prototype.js
@@ -0,0 +1,4238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*  Prototype JavaScript framework, version 1.6.0.2
+ *  (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.2',
+
+  Browser: {
+    IE:     !!(window.attachEvent && !window.opera),
+    Opera:  !!window.opera,
+    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,
+    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 = Object.extend((function(m) {
+          return function() { return ancestor[m].apply(this, arguments) };
+        })(property).wrap(method), {
+          valueOf:  function() { return method },
+          toString: function() { return method.toString() }
+        });
+      }
+      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].split(",").invoke("strip");
+    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);
+  },
+
+  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)));
+    };
+  }
+});
+
+Function.prototype.defer = Function.prototype.delay.curry(0.01);
+
+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.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('')
+});
+
+with (String.prototype.escapeHTML) div.appendChild(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;
+    iterator = iterator.bind(context);
+    try {
+      this._each(function(value) {
+        iterator(value, index++);
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+    return this;
+  },
+
+  eachSlice: function(number, iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var index = -number, slices = [], array = this.toArray();
+    while ((index += number) < array.length)
+      slices.push(array.slice(index, index+number));
+    return slices.collect(iterator, context);
+  },
+
+  all: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!iterator(value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  },
+
+  any: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result = false;
+    this.each(function(value, index) {
+      if (result = !!iterator(value, index))
+        throw $break;
+    });
+    return result;
+  },
+
+  collect: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var results = [];
+    this.each(function(value, index) {
+      results.push(iterator(value, index));
+    });
+    return results;
+  },
+
+  detect: function(iterator, context) {
+    iterator = iterator.bind(context);
+    var result;
+    this.each(function(value, index) {
+      if (iterator(value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  },
+
+  findAll: function(iterator, context) {
+    iterator = iterator.bind(context);
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  grep: function(filter, iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var results = [];
+
+    if (Object.isString(filter))
+      filter = new RegExp(filter);
+
+    this.each(function(value, index) {
+      if (filter.match(value))
+        results.push(iterator(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) {
+    iterator = iterator.bind(context);
+    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, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator(value, index);
+      if (result == null || value >= result)
+        result = value;
+    });
+    return result;
+  },
+
+  min: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator(value, index);
+      if (result == null || value < result)
+        result = value;
+    });
+    return result;
+  },
+
+  partition: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      (iterator(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) {
+    iterator = iterator.bind(context);
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  sortBy: function(iterator, context) {
+    iterator = iterator.bind(context);
+    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 (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 [];
+    if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
+        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) {
+    $R(0, this, true).each(iterator);
+    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) {
+      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.map(function(pair) {
+        var key = encodeURIComponent(pair.key), values = pair.value;
+
+        if (values && typeof values == 'object') {
+          if (Object.isArray(values))
+            return values.map(toQueryPair.curry(key)).join('&');
+        }
+        return toQueryPair(key, values);
+      }).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 || { });
+}).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).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, 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(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);
+    var originalAncestor = ancestor;
+
+    if (element.compareDocumentPosition)
+      return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+    if (element.sourceIndex && !Prototype.Browser.Opera) {
+      var e = element.sourceIndex, a = ancestor.sourceIndex,
+       nextAncestor = ancestor.nextSibling;
+      if (!nextAncestor) {
+        do { ancestor = ancestor.parentNode; }
+        while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
+      }
+      if (nextAncestor && nextAncestor.sourceIndex)
+       return (e > a && e < nextAncestor.sourceIndex);
+    }
+
+    while (element = element.parentNode)
+      if (element == originalAncestor) 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) {
+      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 (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.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 == '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;
+    // 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;
+    // 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 == '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);
+      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);
+        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.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').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 == '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, 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 = { };
+    var B = Prototype.Browser;
+    $w('width height').each(function(d) {
+      var D = d.capitalize();
+      dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
+        (B.Opera) ? document.body['client' + 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();
+    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(this.expression))
+      return false;
+
+    return true;
+  },
+
+  compileMatcher: function() {
+    if (this.shouldUseXPath())
+      return this.compileXPathMatcher();
+
+    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;
+    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
+    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 or translate(text(), ' \t\r\n', '') = '')]",
+      'checked':     "[@checked]",
+      'disabled':    "[@disabled]",
+      'enabled':     "[not(@disabled)]",
+      '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) {
+        

<TRUNCATED>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/rdf_flyer.24.gif
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/rdf_flyer.24.gif b/extras/webjars/snorql/src/main/resources/rdf_flyer.24.gif
new file mode 100755
index 0000000..0291161
Binary files /dev/null and b/extras/webjars/snorql/src/main/resources/rdf_flyer.24.gif differ


[38/41] git commit: - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
- moved SNORQL to WebJar
- moved CodeMirror to WebJar
- moved Sgvizler to WebJar
- cleaned up uses of non-webjar jquery and jquery-ui
- configured YUI compressor for the above packages in build


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/f14c7b0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/f14c7b0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/f14c7b0b

Branch: refs/heads/develop
Commit: f14c7b0bc28a8ed79a8acd0fc70318cae2a75a35
Parents: 5fd590b
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Jul 9 10:50:48 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Jul 9 10:50:48 2013 +0200

----------------------------------------------------------------------
 .../admin/sgvizler/0.5/example/exDBpedia1.html  |  41 -------
 .../web/admin/sgvizler/0.5/example/exFROM1.html |  43 --------
 .../web/admin/sgvizler/0.5/example/exNPD1.html  |  50 ---------
 .../web/admin/sgvizler/0.5/example/exNPD10.html |  40 -------
 .../web/admin/sgvizler/0.5/example/exNPD2.html  |  50 ---------
 .../web/admin/sgvizler/0.5/example/exNPD3.html  |  46 --------
 .../web/admin/sgvizler/0.5/example/exNPD4.html  |  45 --------
 .../web/admin/sgvizler/0.5/example/exNPD5.html  |  40 -------
 .../web/admin/sgvizler/0.5/example/exNPD6.html  |  41 -------
 .../web/admin/sgvizler/0.5/example/exNPD7.html  |  40 -------
 .../web/admin/sgvizler/0.5/example/exNPD8.html  |  40 -------
 .../web/admin/sgvizler/0.5/example/exNPD9.html  |  40 -------
 .../admin/sgvizler/0.5/example/exWorld1.html    |  50 ---------
 .../admin/sgvizler/0.5/example/exWorld2.html    |  41 -------
 .../admin/sgvizler/0.5/example/exWorld3.html    |  41 -------
 .../admin/sgvizler/0.5/example/exWorld4.html    |  41 -------
 .../admin/sgvizler/0.5/example/exWorld5.html    |  40 -------
 .../admin/sgvizler/0.5/example/exWorld6.html    |  47 --------
 .../admin/sgvizler/0.5/example/exWorld7.html    |  43 --------
 .../web/admin/sgvizler/0.5/example/examples.css |  50 ---------
 .../web/admin/sgvizler/0.5/example/index.html   |  12 --
 .../admin/sgvizler/0.5/example/mainframe.html   | 110 -------------------
 .../admin/sgvizler/0.5/example/menuframe.html   |  46 --------
 .../web/admin/sgvizler/0.5/lib/d3.geom.min.js   |   1 -
 .../web/admin/sgvizler/0.5/lib/d3.layout.min.js |   1 -
 .../web/admin/sgvizler/0.5/lib/d3.min.js        |   2 -
 26 files changed, 1041 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exDBpedia1.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exDBpedia1.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exDBpedia1.html
deleted file mode 100644
index c779560..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exDBpedia1.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.dbpo = 'http://dbpedia.org/ontology/';
-      sgvizler.option.namespace.geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#';
-      sgvizler.option.namespace.dct = 'http://purl.org/dc/terms/';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>sMap</code>: Plot of most of the muncipalities of Rogaland, Norway
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://dbpedia.org/sparql" data-sgvizler-query="SELECT ?lat ?long ?name ?text ?url ?image WHERE { ?url a dbpo:AdministrativeRegion ; dct:subject <http://dbpedia.org/resource/Category:Municipalities_of_Rogaland&gt; ; rdfs:label ?name; geo:lat ?lat; geo:long ?long . OPTIONAL{ ?url rdfs:comment ?text } OPTIONAL{ ?url dbpo:thumbnail ?image } FILTER(lang(?text)=&#34;en&#34;) FILTER(lang(?name)=&#34;en&#34;) }" data-sgvizler-chart="sMap" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://dbpedia.org/sparql" 
-   data-sgvizler-query="SELECT ?lat ?long ?name ?text ?url ?image WHERE { ?url a dbpo:AdministrativeRegion ; dct:subject &amp;lt;http://dbpedia.org/resource/Category:Municipalities_of_Rogaland&gt; ; rdfs:label ?name; geo:lat ?lat; geo:long ?long . OPTIONAL{ ?url rdfs:comment ?text } OPTIONAL{ ?url dbpo:thumbnail ?image } FILTER(lang(?text)=&amp;quot;en&amp;quot;) FILTER(lang(?name)=&amp;quot;en&amp;quot;) }" 
-   data-sgvizler-chart="sMap" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://dbpedia.org/sparql" data-sgvizler-query="SELECT ?lat ?long ?name ?text ?url ?image WHERE { ?url a dbpo:AdministrativeRegion ; dct:subject <http://dbpedia.org/resource/Category:Municipalities_of_Rogaland&gt; ; rdfs:label ?name; geo:lat ?lat; geo:long ?long . OPTIONAL{ ?url rdfs:comment ?text } OPTIONAL{ ?url dbpo:thumbnail ?image } FILTER(lang(?text)=&#34;en&#34;) FILTER(lang(?name)=&#34;en&#34;) }" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exFROM1.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exFROM1.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exFROM1.html
deleted file mode 100644
index c77e5ef..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exFROM1.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>dForceGraph</code>: The friends of Martin and Martin and Kjetil
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/from" data-sgvizler-query="PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#&gt; PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt; SELECT ?i ?friend WHERE { ?i foaf:knows ?friend }" data-sgvizler-chart="dForceGraph" data-sgvizler-rdf="http://folk.uio.no/martige/foaf|http://folk.uio.no/martingi/foaf.rdf|http://www.kjetil.kjernsmo.net/foaf#me" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/from" 
-   data-sgvizler-query="PREFIX geo: &amp;lt;http://www.w3.org/2003/01/geo/wgs84_pos#&gt; PREFIX foaf: &amp;lt;http://xmlns.com/foaf/0.1/&gt; SELECT ?i ?friend WHERE { ?i foaf:knows ?friend }" 
-   data-sgvizler-chart="dForceGraph" 
-   data-sgvizler-rdf="http://folk.uio.no/martige/foaf|http://folk.uio.no/martingi/foaf.rdf|http://www.kjetil.kjernsmo.net/foaf#me" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/from" data-sgvizler-query="PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#&gt; PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt; SELECT ?i ?friend WHERE { ?i foaf:knows ?friend }" data-sgvizler-chart="gTable" data-sgvizler-rdf="http://folk.uio.no/martige/foaf|http://folk.uio.no/martingi/foaf.rdf|http://www.kjetil.kjernsmo.net/foaf#me" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>sList</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/from" data-sgvizler-query="PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#&gt; PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt; SELECT ?i ?friend WHERE { ?i foaf:knows ?friend }" data-sgvizler-chart="sList" data-sgvizler-rdf="http://folk.uio.no/martige/foaf|http://folk.uio.no/martingi/foaf.rdf|http://www.kjetil.kjernsmo.net/foaf#me" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD1.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD1.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD1.html
deleted file mode 100644
index 47a9f84..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD1.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gColumnChart</code>: Total production per year on NCS
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gColumnChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) &amp;lt; 2011) } ORDER BY ?year" 
-   data-sgvizler-chart="gColumnChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gBarChart</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gBarChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gLineChart</code></h4>
-      <div id="sgvzl_example_query_copy_2" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gLineChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gAreaChart</code></h4>
-      <div id="sgvzl_example_query_copy_3" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gAreaChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gSteppedAreaChart</code></h4>
-      <div id="sgvzl_example_query_copy_4" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE { [] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?Oil_millSm ; npdv:producedNetGasBillSm ?Gas_billSm ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gSteppedAreaChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD10.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD10.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD10.html
deleted file mode 100644
index 26b308c..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD10.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gSparkline</code>: Total production per year on Ekofisk: Oil, Gas, NGL, Condensate and Water
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gSparkline" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField &amp;lt;http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) &amp;lt; 2011) } ORDER BY ?year" 
-   data-sgvizler-chart="gSparkline" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD2.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD2.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD2.html
deleted file mode 100644
index 276a8d9..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD2.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gColumnChart</code>: Total production per year on Ekofisk
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gColumnChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField &amp;lt;http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) &amp;lt; 2011) } ORDER BY ?year" 
-   data-sgvizler-chart="gColumnChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gBarChart</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gBarChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gLineChart</code></h4>
-      <div id="sgvzl_example_query_copy_2" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gLineChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gAreaChart</code></h4>
-      <div id="sgvzl_example_query_copy_3" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gAreaChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gSteppedAreaChart</code></h4>
-      <div id="sgvzl_example_query_copy_4" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?year ?Oil_millSm3 ?Gas_billSm3 ?NGL_millSm3 ?Condensate_millSm3 ?Water_millSm3 WHERE{ ?period a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm3 ; npdv:producedNetGasBillSm3 ?Gas_billSm3 ; npdv:producedNetNGLMillSm3 ?NGL_millSm3 ; npdv:producedNetCondensateMillSm3 ?Condensate_millSm3 ; npdv:producedWaterMillSm3 ?Water_millSm3 ; OPTIONAL{?period npdv:month ?month} . FILTER (!bound(?month)) FILTER (xsd:int(?year) < 2011) } ORDER BY ?year" data-sgvizler-chart="gSteppedAreaChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD3.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD3.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD3.html
deleted file mode 100644
index c66d11f..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD3.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gPieChart</code>: Who are/have been field operators?
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?name (count(*) AS ?noOfFields) WHERE{ [] a npdv:Field ; npdv:hasCompany [ npdv:name ?name ] . } GROUP BY ?name ORDER BY ?name" data-sgvizler-chart="gPieChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT ?name (count(*) AS ?noOfFields) WHERE{ [] a npdv:Field ; npdv:hasCompany [ npdv:name ?name ] . } GROUP BY ?name ORDER BY ?name" 
-   data-sgvizler-chart="gPieChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?name (count(*) AS ?noOfFields) WHERE{ [] a npdv:Field ; npdv:hasCompany [ npdv:name ?name ] . } GROUP BY ?name ORDER BY ?name" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gBarChart</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?name (count(*) AS ?noOfFields) WHERE{ [] a npdv:Field ; npdv:hasCompany [ npdv:name ?name ] . } GROUP BY ?name ORDER BY ?name" data-sgvizler-chart="gBarChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gColumnChart</code></h4>
-      <div id="sgvzl_example_query_copy_2" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?name (count(*) AS ?noOfFields) WHERE{ [] a npdv:Field ; npdv:hasCompany [ npdv:name ?name ] . } GROUP BY ?name ORDER BY ?name" data-sgvizler-chart="gColumnChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD4.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD4.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD4.html
deleted file mode 100644
index d42f9d9..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD4.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gGeoChart</code>: Some things which have a totalDepth
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE{ [] npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:totalDepth ?depth ; FILTER(?lat &gt; 0 &amp;&amp; ?depth &gt; 0) } LIMIT 100" data-sgvizler-chart="gGeoChart" data-sgvizler-chart-options="region=154" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT * WHERE{ [] npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:totalDepth ?depth ; FILTER(?lat &gt; 0 &amp;amp;&amp;amp; ?depth &gt; 0) } LIMIT 100" 
-   data-sgvizler-chart="gGeoChart" 
-   data-sgvizler-chart-options="region=154" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE{ [] npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:totalDepth ?depth ; FILTER(?lat &gt; 0 &amp;&amp; ?depth &gt; 0) } LIMIT 100" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gGeoMap</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT * WHERE{ [] npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:totalDepth ?depth ; FILTER(?lat &gt; 0 &amp;&amp; ?depth &gt; 0) } LIMIT 100" data-sgvizler-chart="gGeoMap" data-sgvizler-chart-options="region=154" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD5.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD5.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD5.html
deleted file mode 100644
index ece8959..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD5.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gMotionChart</code>: Production per year on NCS
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?cat xsd:int(?year) ?value WHERE{{[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?value ; LET(?cat := &#34;OIL&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetGasBillSm ?value ; LET(?cat := &#34;GAS&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetNGLMillSm3 ?value ; LET(?cat := &#34;NGL&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedWaterMillSm3 ?value ; LET(?cat := &#34;Water&#34;)}}" data-sgvizler-chart="gMotionChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT ?cat xsd:int(?year) ?value WHERE{{[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?value ; LET(?cat := &amp;quot;OIL&amp;quot;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetGasBillSm ?value ; LET(?cat := &amp;quot;GAS&amp;quot;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetNGLMillSm3 ?value ; LET(?cat := &amp;quot;NGL&amp;quot;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedWaterMillSm3 ?value ; LET(?cat := &amp;quot;Water&amp;quot;)}}" 
-   data-sgvizler-chart="gMotionChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?cat xsd:int(?year) ?value WHERE{{[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetOilMillSm ?value ; LET(?cat := &#34;OIL&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetGasBillSm ?value ; LET(?cat := &#34;GAS&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedNetNGLMillSm3 ?value ; LET(?cat := &#34;NGL&#34;)} UNION {[] a npdv:NCSProductionPeriod ; npdv:year ?year ; npdv:producedWaterMillSm3 ?value ; LET(?cat := &#34;Water&#34;)}}" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD6.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD6.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD6.html
deleted file mode 100644
index d4570f6..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD6.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gTreeMap</code>: Draws the structure -&gt; Company -&gt; Field -&gt; ExplorationWellbore, with numberOfDrillingDays
-         deciding the box size and color
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT DISTINCT ?node ?parent ?value WHERE{{ LET(?node := &#34;ALL&#34;) LET(?parent := &#34;&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &#34;ALL&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:ExplorationWellbore ; npdv:hasField [npdv:name ?parent; npdv:hasCompany [] ] ; npdv:numberOfDrillingDays ?value; }}" data-sgvizler-chart="gTreeMap" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT DISTINCT ?node ?parent ?value WHERE{{ LET(?node := &amp;quot;ALL&amp;quot;) LET(?parent := &amp;quot;&amp;quot;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &amp;quot;ALL&amp;quot;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:ExplorationWellbore ; npdv:hasField [npdv:name ?parent; npdv:hasCompany [] ] ; npdv:numberOfDrillingDays ?value; }}" 
-   data-sgvizler-chart="gTreeMap" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT DISTINCT ?node ?parent ?value WHERE{{ LET(?node := &#34;ALL&#34;) LET(?parent := &#34;&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &#34;ALL&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:ExplorationWellbore ; npdv:hasField [npdv:name ?parent; npdv:hasCompany [] ] ; npdv:numberOfDrillingDays ?value; }}" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD7.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD7.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD7.html
deleted file mode 100644
index 097f906..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD7.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gOrgChart</code>: Draws the structure -&gt; Company -&gt; Field with ExplorationWellbore
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT DISTINCT ?node ?parent WHERE{ { LET(?node := &#34;ALL&#34;) LET(?parent := &#34;&#34;) LET(?value := 0)} UNION {?s npdv:name ?node ; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &#34;ALL&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . }}" data-sgvizler-chart="gOrgChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT DISTINCT ?node ?parent WHERE{ { LET(?node := &amp;quot;ALL&amp;quot;) LET(?parent := &amp;quot;&amp;quot;) LET(?value := 0)} UNION {?s npdv:name ?node ; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &amp;quot;ALL&amp;quot;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . }}" 
-   data-sgvizler-chart="gOrgChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT DISTINCT ?node ?parent WHERE{ { LET(?node := &#34;ALL&#34;) LET(?parent := &#34;&#34;) LET(?value := 0)} UNION {?s npdv:name ?node ; a npdv:Company . [] a npdv:Field ; npdv:hasCompany ?s . LET(?parent := &#34;ALL&#34;) LET(?value := 0)} UNION {?s npdv:name ?node; a npdv:Field ; npdv:hasCompany [npdv:name ?parent] . [] a npdv:ExplorationWellbore ; npdv:hasField ?s . }}" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD8.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD8.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD8.html
deleted file mode 100644
index 9dcce03..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD8.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gTimeline</code>: Production oil and gas per month at Ekofisk
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="PREFIX fn: <http://www.w3.org/2005/xpath-functions#&gt; SELECT xsd:date(?date) ?Oil_millSm &#34;&#34; &#34;&#34; ?Gas_billSm &#34;&#34; &#34;&#34; WHERE{ {[] a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &#34;-&#34;), ?month), &#34;-01&#34;)) FILTER (xsd:int(?year) < 2011 &amp;&amp; xsd:int(?month) &gt; 9)} UNION { [] a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &#34;-0&#34;), ?month), &#34;-01&#34;)) FILTER (xsd:int(?year) < 2011 &amp;&amp; x
 sd:int(?month) < 10) } }ORDER BY xsd:date(?date)" data-sgvizler-chart="gTimeline" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="PREFIX fn: &amp;lt;http://www.w3.org/2005/xpath-functions#&gt; SELECT xsd:date(?date) ?Oil_millSm &amp;quot;&amp;quot; &amp;quot;&amp;quot; ?Gas_billSm &amp;quot;&amp;quot; &amp;quot;&amp;quot; WHERE{ {[] a npdv:FieldProductionPeriod ; npdv:hasField &amp;lt;http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &amp;quot;-&amp;quot;), ?month), &amp;quot;-01&amp;quot;)) FILTER (xsd:int(?year) &amp;lt; 2011 &amp;amp;&amp;amp; xsd:int(?month) &gt; 9)} UNION { [] a npdv:FieldProductionPeriod ; npdv:hasField &amp;lt;http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &amp;quot;-0&amp;quot;), ?month), &amp;quot;-01&amp;quot;)) FILTER (xsd:int(?
 year) &amp;lt; 2011 &amp;amp;&amp;amp; xsd:int(?month) &amp;lt; 10) } }ORDER BY xsd:date(?date)" 
-   data-sgvizler-chart="gTimeline" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="PREFIX fn: <http://www.w3.org/2005/xpath-functions#&gt; SELECT xsd:date(?date) ?Oil_millSm &#34;&#34; &#34;&#34; ?Gas_billSm &#34;&#34; &#34;&#34; WHERE{ {[] a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &#34;-&#34;), ?month), &#34;-01&#34;)) FILTER (xsd:int(?year) < 2011 &amp;&amp; xsd:int(?month) &gt; 9)} UNION { [] a npdv:FieldProductionPeriod ; npdv:hasField <http://sws.ifi.uio.no/npd/field/Ekofisk&gt; ; npdv:month ?month ; npdv:year ?year ; npdv:producedNetOilMillSm3 ?Oil_millSm ; npdv:producedNetGasBillSm3 ?Gas_billSm ; LET (?date := fn:concat(fn:concat(fn:concat(?year, &#34;-0&#34;), ?month), &#34;-01&#34;)) FILTER (xsd:int(?year) < 2011 &amp;&amp; x
 sd:int(?month) < 10) } }ORDER BY xsd:date(?date)" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD9.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD9.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD9.html
deleted file mode 100644
index 2ee0a10..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exNPD9.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.npd = 'http://sws.ifi.uio.no/npd/';
-      sgvizler.option.namespace.npdv = 'http://sws.ifi.uio.no/vocab/npd#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>sMap</code>: Things north of 72.5 degrees north
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?lat ?long ?name &#34;&#34; ?url WHERE { ?url npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:name ?name ; FILTER (?lat &gt; 72.5) }" data-sgvizler-chart="sMap" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" 
-   data-sgvizler-query="SELECT ?lat ?long ?name &amp;quot;&amp;quot; ?url WHERE { ?url npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:name ?name ; FILTER (?lat &gt; 72.5) }" 
-   data-sgvizler-chart="sMap" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd" data-sgvizler-query="SELECT ?lat ?long ?name &#34;&#34; ?url WHERE { ?url npdv:nsDecDeg ?lat ; npdv:ewDecDeg ?long ; npdv:name ?name ; FILTER (?lat &gt; 72.5) }" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld1.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld1.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld1.html
deleted file mode 100644
index e0430e8..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld1.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gBarChart</code>: The 10 largest countries by population
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gBarChart" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" 
-   data-sgvizler-chart="gBarChart" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gColumnChart</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gColumnChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gLineChart</code></h4>
-      <div id="sgvzl_example_query_copy_2" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gLineChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <h4><code>gGeoChart</code></h4>
-      <div id="sgvzl_example_query_copy_3" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gGeoChart" data-sgvizler-loglevel="2" style="width:600px; height:250px;"></div>
-      <h4><code>sList</code></h4>
-      <div id="sgvzl_example_query_copy_4" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{ [] a w:Country ; w:hasName ?Name ; w:hasCountryPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="sList" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld2.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld2.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld2.html
deleted file mode 100644
index 8afb82d..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld2.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gMap</code>: The 10 largest cities by population on a map
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Name ?Name WHERE{ [] a w:City ; w:hasName ?Name ; w:hasCityPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gMap" data-sgvizler-chart-options="showTip=true" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT ?Name ?Name WHERE{ [] a w:City ; w:hasName ?Name ; w:hasCityPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" 
-   data-sgvizler-chart="gMap" 
-   data-sgvizler-chart-options="showTip=true" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Name ?Name WHERE{ [] a w:City ; w:hasName ?Name ; w:hasCityPopulation ?Population ; } ORDER BY DESC(?Population) LIMIT 10" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld3.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld3.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld3.html
deleted file mode 100644
index 9425acb..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld3.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gScatterChart</code>: Life expectancy over Gross National Product
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{[] w:hasGNP ?GNP ; w:hasLifeExpectancy ?LifeExpectancy; }" data-sgvizler-chart="gScatterChart" data-sgvizler-chart-options="hAxis.logScale=true|animation.duration=2000|backgroundColor=lightgreen" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT * WHERE{[] w:hasGNP ?GNP ; w:hasLifeExpectancy ?LifeExpectancy; }" 
-   data-sgvizler-chart="gScatterChart" 
-   data-sgvizler-chart-options="hAxis.logScale=true|animation.duration=2000|backgroundColor=lightgreen" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{[] w:hasGNP ?GNP ; w:hasLifeExpectancy ?LifeExpectancy; }" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld4.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld4.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld4.html
deleted file mode 100644
index 98fcedd..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld4.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gBubbleChart</code>: Life expectancy over Gross National Product, Size is Population, Color is Continent
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{[] w:hasCountryCode ?ID ; w:hasGNP ?GNP ; w:hasCountryPopulation ?Population ; w:isCountryInContinent [ rdfs:label ?Continent ] ; w:hasLifeExpectancy ?LifeExpectancy ; }" data-sgvizler-chart="gBubbleChart" data-sgvizler-chart-options="vAxis.logScale=true|hAxis.logScale=true|bubble.textStyle.fontSize=6" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT * WHERE{[] w:hasCountryCode ?ID ; w:hasGNP ?GNP ; w:hasCountryPopulation ?Population ; w:isCountryInContinent [ rdfs:label ?Continent ] ; w:hasLifeExpectancy ?LifeExpectancy ; }" 
-   data-sgvizler-chart="gBubbleChart" 
-   data-sgvizler-chart-options="vAxis.logScale=true|hAxis.logScale=true|bubble.textStyle.fontSize=6" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT * WHERE{[] w:hasCountryCode ?ID ; w:hasGNP ?GNP ; w:hasCountryPopulation ?Population ; w:isCountryInContinent [ rdfs:label ?Continent ] ; w:hasLifeExpectancy ?LifeExpectancy ; }" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld5.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld5.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld5.html
deleted file mode 100644
index 026f83d..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld5.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gTreeMap</code>: The population of the world, sized in boxes per area category
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?a ?b xsd:int(?c) WHERE{ { ?a w:isCountryInRegion ?b ; w:hasCountryPopulation ?c } UNION { ?a w:isRegionInContinent ?b ; LET(?c := 0) } UNION { ?a a w:Continent; LET(?b := &#34;World&#34;) LET(?c := 0) } UNION { LET(?a := &#34;World&#34;) LET(?b := &#34;&#34;) LET(?c := 0) } }" data-sgvizler-chart="gTreeMap" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT ?a ?b xsd:int(?c) WHERE{ { ?a w:isCountryInRegion ?b ; w:hasCountryPopulation ?c } UNION { ?a w:isRegionInContinent ?b ; LET(?c := 0) } UNION { ?a a w:Continent; LET(?b := &amp;quot;World&amp;quot;) LET(?c := 0) } UNION { LET(?a := &amp;quot;World&amp;quot;) LET(?b := &amp;quot;&amp;quot;) LET(?c := 0) } }" 
-   data-sgvizler-chart="gTreeMap" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?a ?b xsd:int(?c) WHERE{ { ?a w:isCountryInRegion ?b ; w:hasCountryPopulation ?c } UNION { ?a w:isRegionInContinent ?b ; LET(?c := 0) } UNION { ?a a w:Continent; LET(?b := &#34;World&#34;) LET(?c := 0) } UNION { LET(?a := &#34;World&#34;) LET(?b := &#34;&#34;) LET(?c := 0) } }" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld6.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld6.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld6.html
deleted file mode 100644
index 85f8350..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld6.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>gGeoMap</code>: The population of South America per country
-      </h3>
-      <p></p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Country ?Population WHERE{ [] w:hasName ?Country ; w:hasCountryPopulation ?Population; w:isCountryInContinent [ rdfs:label &#34;South America&#34; ] ; } ORDER BY DESC(?Population)" data-sgvizler-chart="gGeoMap" data-sgvizler-chart-options="title=South America|region=005" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT ?Country ?Population WHERE{ [] w:hasName ?Country ; w:hasCountryPopulation ?Population; w:isCountryInContinent [ rdfs:label &amp;quot;South America&amp;quot; ] ; } ORDER BY DESC(?Population)" 
-   data-sgvizler-chart="gGeoMap" 
-   data-sgvizler-chart-options="title=South America|region=005" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Country ?Population WHERE{ [] w:hasName ?Country ; w:hasCountryPopulation ?Population; w:isCountryInContinent [ rdfs:label &#34;South America&#34; ] ; } ORDER BY DESC(?Population)" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <h3>Same query, different charts</h3>
-      <p>Not all charts may be well-suited for displaying this dataset.</p>
-      <h4><code>gGeoChart</code></h4>
-      <div id="sgvzl_example_query_copy_1" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Country ?Population WHERE{ [] w:hasName ?Country ; w:hasCountryPopulation ?Population; w:isCountryInContinent [ rdfs:label &#34;South America&#34; ] ; } ORDER BY DESC(?Population)" data-sgvizler-chart="gGeoChart" data-sgvizler-chart-options="region=005" data-sgvizler-loglevel="2" style="width:600px; height:300px;"></div>
-      <h4><code>gPieChart</code></h4>
-      <div id="sgvzl_example_query_copy_2" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?Country ?Population WHERE{ [] w:hasName ?Country ; w:hasCountryPopulation ?Population; w:isCountryInContinent [ rdfs:label &#34;South America&#34; ] ; } ORDER BY DESC(?Population)" data-sgvizler-chart="gPieChart" data-sgvizler-loglevel="2" style="width:800px; height:300px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file


[17/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/index.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/index.html b/platform/marmotta-ldpath/src/main/resources/web/cm/index.html
deleted file mode 100644
index f9ccd3c..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/index.html
+++ /dev/null
@@ -1,255 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!doctype html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>CodeMirror: LDPath Demo</title>
-<link rel="stylesheet" href="codemirror.css">
-<link rel="stylesheet" href="simple-hint.css">
-
-<script src="../../core/public/js/lib/jquery-1.7.2.js" type="text/javascript"></script>
-<!-- 
-<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script>
- -->
-
-<script src="codemirror.js"></script>
-<script src="simple-hint.js"></script>
-<script src="ldpath.js"></script>
-
-<style type="text/css">
-.CodeMirror {
-    border: 1px solid #eee;
-}
-
-td {
-    padding-right: 20px;
-}
-body {
-  font-family: Droid Sans, Arial, sans-serif;
-  line-height: 1.5;
-  max-width: 64.3em;
-  margin: 3em auto;
-  padding: 0 1em;
-}
-
-h1 {
-  letter-spacing: -3px;
-  font-size: 3.23em;
-  font-weight: bold;
-  margin: 0;
-}
-
-h2 {
-  font-size: 1.23em;
-  font-weight: bold;
-  margin: .5em 0;
-  letter-spacing: -1px;
-}
-
-h3 {
-  font-size: 1em;
-  font-weight: bold;
-  margin: .4em 0;
-}
-
-pre {
-  background-color: #eee;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 1em;
-}
-
-pre.code {
-  margin: 0 1em;
-}
-
-.grey {
-  font-size: 2.2em;
-  padding: .5em 1em;
-  line-height: 1.2em;
-  margin-top: .5em;
-  position: relative;
-}
-
-img.logo {
-  position: absolute;
-  right: -25px;
-  bottom: 4px;
-}
-
-a:link, a:visited, .quasilink {
-  color: #df0019;
-  cursor: pointer;
-  text-decoration: none;
-}
-
-a:hover, .quasilink:hover {
-  color: #800004;
-}
-
-h1 a:link, h1 a:visited, h1 a:hover {
-  color: black;
-}
-
-ul {
-  margin: 0;
-  padding-left: 1.2em;
-}
-
-a.download {
-  color: white;
-  background-color: #df0019;
-  width: 100%;
-  display: block;
-  text-align: center;
-  font-size: 1.23em;
-  font-weight: bold;
-  text-decoration: none;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: .5em 0;
-  margin-bottom: 1em;
-}
-
-a.download:hover {
-  background-color: #bb0010;
-}
-
-.rel {
-  margin-bottom: 0;
-}
-
-.rel-note {
-  color: #777;
-  font-size: .9em;
-  margin-top: .1em;
-}
-
-.logo-braces {
-  color: #df0019;
-  position: relative;
-  top: -4px;
-}
-
-.blk {
-  float: left;
-}
-
-.left {
-  width: 37em;
-  padding-right: 6.53em;
-  padding-bottom: 1em;
-}
-
-.left1 {
-  width: 15.24em;
-  padding-right: 6.45em;
-}
-
-.left2 {
-  width: 15.24em;
-}
-
-.right {
-  width: 20.68em;
-}
-
-.leftbig {
-  width: 42.44em;
-  padding-right: 6.53em;
-}
-
-.rightsmall {
-  width: 15.24em;
-}
-
-.clear:after {
-  visibility: hidden;
-  display: block;
-  font-size: 0;
-  content: " ";
-  clear: both;
-  height: 0;
-}
-.clear { display: inline-block; }
-/* start commented backslash hack \*/
-* html .clear { height: 1%; }
-.clear { display: block; }
-/* close commented backslash hack */
-</style>
-</head>
-<body>
-  <h1>CodeMirror: LDPath demo</h1>
-  <div>
-    <button onclick="javascript:createEditor()">Editor</button>
-    <button onclick="javascript:removeEditor()">Plain</button>
-  </div>
-  <form>
-    <textarea id="code" name="code">
-@prefix iptc : &lt;http://iptc.org/std/nar/2006-10-01/&gt; ;
-@prefix foaf ;
-@prefix rss: ;
-@prefix sioc: ;
-@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
-  date = dc:date :: xsd:date(multiValued="false") ;
-  desc = dc:description[@de] :: lmf:text_en ;
-  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
-  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
-  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
-  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
-  user = dc:creator :: xsd:string(multiValue="false") ;
-</textarea>
-  </form>
-  <script type="text/javascript">
-            var editor = null;
-			//var LMF = "http://localhost:8080/LMF/";
-			var LMF = "../../";
-            function createEditor() {
-                if (editor === null) {
-                    var defaultNamespaces = {}
-                    $.getJSON(LMF + "ldpath/util/namespaces", function(data) {
-                        defaultNamespaces = data;
-                    }).complete(function() {
-                      editor = CodeMirror.fromTextArea(document.getElementById("code"), {
-                          lineNumbers : true,
-                          matchBrackets : true,
-	    				  extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
-                          mode : {
-  							name: "ldpath",
-  						    baseURL: LMF,
-  						    namespaces: defaultNamespaces
-                          }
-                      });
-                    });
-                }
-            }
-            function removeEditor() {
-                if (editor) {
-                    editor.toTextArea();
-                    editor = null;
-                }
-            }
-            createEditor();
-        </script>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/ldpath.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/ldpath.js b/platform/marmotta-ldpath/src/main/resources/web/cm/ldpath.js
deleted file mode 100644
index 65a2216..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/ldpath.js
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-if (CodeMirror && CodeMirror.defineMode) {
-CodeMirror.defineMode("ldpath", function(config, parserConfig) {
-    var token = {
-        OP: "operator",
-        KWD: "keyword",
-        PREFIX: "qualifier",
-        IDENT: "atom",
-        DEF: "builtin",
-        TEST: "meta",
-        URL: "link",
-        STR: "string",
-        INT: "number",
-        BRACKET: "bracket",
-        WARNING: "string-2",
-        ERROR: "error"
-    },
-        predefinedNamespaces = parserConfig.namespaces || {},
-        baseURL = parserConfig.baseURL || null;
-    
-    function log(stream, status, result) {
-        return;
-        if (console && console.log) {
-            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
-        }
-    }
-    
-    function getInitialState() {
-        return {
-            tmp: {},
-            namespaces: {},
-            predefinedNamespaces: predefinedNamespaces,
-            lmfBaseURL: baseURL,
-            stack: ['default'],
-            /* STACKING */
-            push: function(next) {
-                this.stack.unshift(next);
-            },
-            pop: function() {
-                if (this.stack.length <= 1) {
-                    return this.current();
-                } else {
-                    return this.stack.shift();
-                }
-            },
-            current: function() {
-                return this.stack[0];
-            },
-            reset: function() {
-                this.stack = ['default'];
-                this.tmp = {};
-            },
-            height: function() {
-                return this.stack.length;
-            },
-            /* PARSING */
-            parser: function(stream, state) {
-                var parser = parsers[this.current()] || parsers['default'];
-                return parser(stream, state);
-            },
-            /* NAMESPACES */
-            addPrefix: function(prefix, namespace) {
-                if (prefix && namespace)
-                    this.namespaces[prefix] = namespace;
-            },
-            getNamespace: function(prefix) {
-                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
-            }
-        };
-    }
-
-    var parsers = {
-        default: tokenDefault,
-        filter: tokenTest,
-        url: tokenURL,
-        test: tokenTest,
-        error: tokenError
-    }
-    
-    function tokenError(stream, state) {
-        if (state.current() !== 'error') state.push('error');
-        stream.skipToEnd();
-        return token.ERROR;
-    }
-    
-    function tokenDefault(stream, state) {
-        // @...
-        var kw = stream.match(/^@(\w+)/, true);
-        if (kw) {
-            state.push(kw[1]);
-            return token.KWD;
-        }
-
-        // <URL>
-        if (stream.eat('<')) {
-            state.push('url');
-            return token.BRACKET;
-        }
-        if (stream.eat('[')) {
-            state.push('test');
-            return token.BRACKET;
-        }
-        if (stream.eat('(')) {
-            if (state.current() == "transformer") {
-                state.push('config');
-            }
-            return token.BRACKET;
-        }
-        if (stream.eat(')')) {
-            if (state.current() == "config") {
-                state.pop();
-            }
-            return token.BRACKET;
-        }
-        if (stream.eat(/[\]>\{\}]/)) {
-            return token.BRACKET;
-        }
-
-        // prefix:label
-        if (stream.match(/^\w+:\w*/, false)) {
-            stream.skipTo(":")
-            if (state.current() == 'prefix') {
-                state.tmp["prefix"] = stream.current();
-                return token.PREFIX;
-            } else {
-                px = stream.current();
-                stream.eat(':');
-                if (state.getNamespace(px))
-                return token.PREFIX;
-                else return token.WARNING;
-            }
-        }
-
-        if (stream.match("=", true)) {
-            if (state.current() == "default") {
-                state.push("path");
-            }
-            return token.DEF;
-        }
-        if (stream.match("::", true)) {
-            state.push("transformer");
-            return token.DEF;
-        }
-        // OPERATORS
-        if (stream.eat(/[:,&\|\/^\+\*.]/)) {
-            return token.OP;
-        }
-
-        if (stream.eat('"')) {
-            if (stream.skipTo('"') && stream.eat('"'))
-                return token.STR;
-            return tokenError(stream, state);
-        }
-        
-        // NUMBERS
-        if (stream.match(/^\d+/, true)) {
-            return token.INT;
-        }
-
-        // IDENT
-        if (state.current() == "prefix") {
-            if (stream.match(/^\w+/, true)) {
-                state.tmp["prefix"] = stream.current();
-                return token.PREFIX;
-            }
-        } else {
-            if (stream.match(/^[\w.-]+/, true)) {
-                return token.IDENT;
-            }
-        }
-
-        return tokenError(stream, state);
-    }
-
-    function tokenURL(stream, state) {
-        if (stream.eat('>')) {
-            state.pop();
-            return token.BRACKET;
-        }
-        if (stream.skipTo('>')) {
-            //state.pop();
-            var url = stream.current();
-            if (url.search(/^https?:\/\//) < 0 || url.search(/\s/) >= 0) {
-                return token.ERROR;
-            }
-            if (state.stack.indexOf("prefix") >= 0) {
-                state.tmp["ns"] = url;
-            }
-            return token.URL;
-        }
-        return tokenError(stream, state);
-    }
-
-    function tokenTest(stream, state) {
-        if (stream.eat(']')) {
-            state.pop();
-            return token.BRACKET;
-        }
-        if (stream.match(/@\w+/, true) || stream.match("^^", true)) {
-            return token.TEST;
-        }
-        if (stream.match("is ", false)) {
-            stream.match("is", true);
-            return token.TEST;
-        }
-        if (stream.eat(/[&\|]/)) {
-            return token.TEST;
-        }
-        return tokenDefault(stream, state);
-    }
-
-    return {
-        startState: getInitialState,
-        compareStates: function(state1, state2) {
-            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
-        },
-        token: function(stream, state) {
-            // ignore spaces
-            if (stream.eatSpace()) return null;
-            if (stream.eat(';')) {
-                if (state.current() == "prefix") {
-                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
-                }
-                log(stream, state, "RESET");
-                state.reset(); 
-                return token.OP;
-            }
-            var result = state.parser(stream, state);
-            log(stream, state, result);
-            return result;
-        },
-        electricChars: "@=[];",
-        indent: function(state, textAfter) {
-            switch (state.current()) {
-            case 'test':
-            case 'filter':
-                return 2 * config.indentUnit;
-                break;
-            case 'default':
-                // no indent for @prefix etc...
-                if (textAfter.search(/^\s*@/) == 0) {
-                    return 0;
-                }
-                return config.indentUnit;
-                break;
-            }
-            return 0;
-        }
-    }
-});
-
-// Autocompletion
-if (CodeMirror.simpleHint && jQuery) {
-    function completePrefix(editor, cur, token) {
-        var line = editor.getLine(cur.line);
-        var match = line.match(/(^|;)\s*@prefix\s+(\w+)\s*(:\s*<?)?(;|$)/);
-        if (match && match[2] && match[2] !== "") {
-            var prefix = match[2], result;
-            try {
-                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-                    async: false,
-                    data: {prefix: prefix},
-                    success: function(data) {
-                        result = data[prefix];
-                    },
-                    dataType: "json"
-                });
-            } catch (e) {}
-            if (result !== undefined) {
-                var pfx = line.substr(0,cur.ch);
-                var st = pfx.search(/\s*(:\s*<?)?$/);
-                return {
-                    list: [ ": <"+result+">;" ],
-                    from: {line: cur.line, ch: st},
-                    to: cur
-                };
-            }
-        }
-        return false;
-    }
-    function completeURI(editor, cur, token) {
-        var bC = token.string.substr(0, cur.ch - token.start),
-        aC = token.string.substr(cur.ch - token.start),
-        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['uri'] = bC;
-            
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    suggestions[i] = "<" + suggestions[i] + "> ";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: token.start - 1},
-              to: {line: cur.line, ch: replUntil}
-            };
-        }
-        return false;
-    }
-    function completeCUIE(editor, cur, token) {
-        var from = token.start, 
-            to = token.end, 
-            req = token.string.substr(0, cur.ch - token.start);
-        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
-        if (token.className == 'atom' && prevToken.className == 'qualifier') {
-            from = prevToken.start;
-            req = prevToken.string + req;
-        }
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['prefix'] = req;
-
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    // prefix only
-                    suggestions[i] = suggestions[i] + ":";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: from},
-              to: {line: cur.line, ch: to}
-            };
-        }
-        
-        return false;
-    }
-    function insertPrefixDef(editor, cur, token) {
-        var prefix = token.string.replace(/:?$/, ""), result;
-        try {
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-//            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                async: false,
-                data: {prefix: prefix},
-                success: function(data) {
-                    result = data[prefix];
-                },
-                dataType: "json"
-            });
-        } catch (e) {}
-        if (result !== undefined) {
-            // check if this url is already prefixed
-            var px;
-            for (var i in token.state.namespaces) {
-                if (token.state.namespaces[i] == result) {
-                    px = i;
-                    break;
-                }
-            } 
-            if (px) {
-                return {
-                    list: [ px + ":" ],
-                    from: { line: cur.line, ch: token.start },
-                    to: { line: cur.line, ch: token.end }
-                };
-            } else {
-            return {
-                list: [ "@prefix " + prefix + ": <" + result + "> ;\n" ],
-                from: {line: 0, ch: 0},
-                to: {line: 0, ch: 0}
-            };
-            } 
-        }
-    }
-    CodeMirror.commands.ldpathAutocomplete = function(cm) {
-        CodeMirror.simpleHint(cm, function(editor) {
-            var cur = editor.getCursor();
-            var line = editor.getLine(cur.line);
-            var token = editor.getTokenAt(cur);
-        
-            if (token.state.stack.indexOf('prefix') >= 0) {
-                return completePrefix(editor, cur, token);
-            } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
-                return completeURI(editor, cur, token);
-            } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
-                return completeCUIE(editor, cur, token);
-            } else if (token.className == "string-2") {
-                return insertPrefixDef(editor, cur, token);
-            } else {
-                if (console && console.log) {
-                    console.log("State: " + token.state.stack);
-                }
-            }
-        });
-    }
-}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.css b/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.css
deleted file mode 100644
index c7a040c..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.css
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#center .CodeMirror-completions, .CodeMirror-completions {
-  position: absolute;
-  z-index: 10;
-  overflow: hidden;
-  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-}
-#center .CodeMirror-completions select, .CodeMirror-completions select {
-  background: #fafafa;
-  outline: none;
-  border: none;
-  padding: 0;
-  margin: 0;
-  font-family: monospace;
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.js b/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.js
deleted file mode 100644
index f144c9e..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/simple-hint.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-(function() {
-  CodeMirror.simpleHint = function(editor, getHints) {
-    // We want a single cursor position.
-    if (editor.somethingSelected()) return;
-    //don't show completion if the token is empty
-    var tempToken = editor.getTokenAt(editor.getCursor());
-    if(!(/[\S]/gi.test(tempToken.string))) return;
-
-    var result = getHints(editor);
-    if (!result || !result.list.length) return;
-    var completions = result.list;
-    function insert(str) {
-      editor.replaceRange(str, result.from, result.to);
-    }
-    // When there is only one completion, use it directly.
-    if (completions.length == 1) {insert(completions[0]); return true;}
-
-    // Build the select widget
-    var complete = document.createElement("div");
-    complete.className = "CodeMirror-completions";
-    var sel = complete.appendChild(document.createElement("select"));
-    // Opera doesn't move the selection when pressing up/down in a
-    // multi-select, but it does properly support the size property on
-    // single-selects, so no multi-select is necessary.
-    if (!window.opera) sel.multiple = true;
-    for (var i = 0; i < completions.length; ++i) {
-      var opt = sel.appendChild(document.createElement("option"));
-      opt.appendChild(document.createTextNode(completions[i]));
-    }
-    sel.firstChild.selected = true;
-    sel.size = Math.min(10, completions.length);
-    var pos = editor.cursorCoords();
-    complete.style.left = pos.x + "px";
-    complete.style.top = pos.yBot + "px";
-    document.body.appendChild(complete);
-    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
-    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
-    if(winW - pos.x < sel.clientWidth)
-      complete.style.left = (pos.x - sel.clientWidth) + "px";
-    // Hack to hide the scrollbar.
-    if (completions.length <= 10)
-      complete.style.width = (sel.clientWidth - 1) + "px";
-
-    var done = false;
-    function close() {
-      if (done) return;
-      done = true;
-      complete.parentNode.removeChild(complete);
-    }
-    function pick() {
-      insert(completions[sel.selectedIndex]);
-      close();
-      setTimeout(function(){editor.focus();}, 50);
-    }
-    CodeMirror.connect(sel, "blur", close);
-    CodeMirror.connect(sel, "keydown", function(event) {
-      var code = event.keyCode;
-      // Enter
-      if (code == 13) {CodeMirror.e_stop(event); pick();}
-      // Escape
-      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
-      else if (code != 38 && code != 40) {
-        close(); editor.focus();
-        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
-        editor.triggerOnKeyDown(event);
-        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
-      }
-    });
-    CodeMirror.connect(sel, "dblclick", pick);
-
-    sel.focus();
-    // Opera sometimes ignores focusing a freshly created node
-    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
-    return true;
-  };
-})();

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-reasoner/src/main/resources/web/admin/configure.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-reasoner/src/main/resources/web/admin/configure.html b/platform/marmotta-reasoner/src/main/resources/web/admin/configure.html
index 5a6a8f1..b3d6142 100644
--- a/platform/marmotta-reasoner/src/main/resources/web/admin/configure.html
+++ b/platform/marmotta-reasoner/src/main/resources/web/admin/configure.html
@@ -23,7 +23,7 @@
 <head>
 <!--###BEGIN_HEAD###-->
     <title>Reasoning Module</title>
-    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="widget/conf_reasoner.js"></script>
     <script type="text/javascript">
         jQuery(document).ready(function(){

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-security/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-security/src/main/resources/web/admin/configuration.html b/platform/marmotta-security/src/main/resources/web/admin/configuration.html
index 3241b05..830ef20 100644
--- a/platform/marmotta-security/src/main/resources/web/admin/configuration.html
+++ b/platform/marmotta-security/src/main/resources/web/admin/configuration.html
@@ -24,7 +24,7 @@
 	var _SERVER_URL = "http://localhost:8080/LMF/";
 </script>
 <!--###BEGIN_HEAD###-->
-<script type="text/javascript" src="../../core/public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="../../core/public/js/widgets/configurator/configurator.js"></script>
     <link rel="stylesheet" href="style.css" />
     <link type="text/css" rel="stylesheet" href="../../core/public/js/widgets/configurator/style.css">

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-security/src/main/resources/web/admin/profiles.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-security/src/main/resources/web/admin/profiles.html b/platform/marmotta-security/src/main/resources/web/admin/profiles.html
index 348afc2..b2dc3ab 100644
--- a/platform/marmotta-security/src/main/resources/web/admin/profiles.html
+++ b/platform/marmotta-security/src/main/resources/web/admin/profiles.html
@@ -21,7 +21,7 @@
 <head>
     <!--###BEGIN_HEAD###-->
     <title>Security Profiles</title>
-    <script type="text/javascript" src="../../core/public/js/lib/jquery-1.7.2.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <!--###END_HEAD###-->
 </head>
 <body>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-security/src/main/resources/web/admin/rules.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-security/src/main/resources/web/admin/rules.html b/platform/marmotta-security/src/main/resources/web/admin/rules.html
index 921d258..a1c7fb7 100644
--- a/platform/marmotta-security/src/main/resources/web/admin/rules.html
+++ b/platform/marmotta-security/src/main/resources/web/admin/rules.html
@@ -21,7 +21,7 @@
 <head>
     <!--###BEGIN_HEAD###-->
     <title>Security Rules</title>
-    <script type="text/javascript" src="../../core/public/js/lib/jquery-1.7.2.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <style type="text/css">
         table#security_rules tr td {
             font-size: 10px;

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/jooq-config.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/jooq-config.xml b/platform/marmotta-sparql/jooq-config.xml
deleted file mode 100644
index 3eaf82b..0000000
--- a/platform/marmotta-sparql/jooq-config.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<configuration>
-    <!-- Configure the database connection here -->
-    <jdbc>
-        <driver>org.postgresql.Driver</driver>
-        <url>jdbc:postgresql://localhost:5433/lmf</url>
-        <user>lmf</user>
-        <password>lmf</password>
-        <!-- You can also pass user/password and other JDBC properties in the optional properties tag: -->
- <!--       <properties>
-            <property><key>user</key><value>[db-user]</value></property>
-            <property><key>password</key><value>[db-password]</value></property>
-        </properties>
--->    </jdbc>
-
-    <generator>
-        <database>
-            <!-- The database dialect from jooq-meta. Available dialects are
-    named org.util.[database].[database]Database. Known values are:
-
-    org.jooq.util.ase.ASEDatabase
-    org.jooq.util.db2.DB2Database
-    org.jooq.util.derby.DerbyDatabase
-    org.jooq.util.h2.H2Database
-    org.jooq.util.hsqldb.HSQLDBDatabase
-    org.jooq.util.ingres.IngresDatabase
-    org.jooq.util.mysql.MySQLDatabase
-    org.jooq.util.oracle.OracleDatabase
-    org.jooq.util.postgres.PostgresDatabase
-    org.jooq.util.sqlite.SQLiteDatabaes
-    org.jooq.util.sqlserver.SQLServerDatabase
-    org.jooq.util.sybase.SybaseDatabase
-
-    You can also provide your own org.jooq.util.Database implementation
-    here, if your database is currently not supported -->
-            <name>org.jooq.util.postgres.PostgresDatabase</name>
-
-            <!-- All elements that are generated from your schema (several Java
-           regular expressions, separated by comma) Watch out for
-           case-sensitivity. Depending on your database, this might be
-           important! You can create case-insensitive regular expressions
-           using this syntax: (?i:expr)A comma-separated list of regular
-           expressions -->
-            <includes>(?i:KIWINODE),(?i:TRIPLES)</includes>
-
-            <!-- All elements that are excluded from your schema (several Java
-           regular expressions, separated by comma). Excludes match before
-           includes -->
-            <excludes></excludes>
-
-            <!-- The schema that is used locally as a source for meta information.
-    This could be your development schema or the production schema, etc
-    This cannot be combined with the schemata element. -->
-            <inputSchema>public</inputSchema>
-        </database>
-
-        <generate>
-            <!-- See advanced configuration properties -->
-        </generate>
-
-        <target>
-            <!-- The destination package of your generated classes (within the
-          destination directory) -->
-            <packageName>org.apache.marmotta.platform.sparql.model</packageName>
-
-            <!-- The destination directory of your generated classes -->
-            <directory>/Users/sschaffe/Documents/projects/LMF/lmf-sparql/src/main/java</directory>
-        </target>
-    </generator>
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/pom.xml b/platform/marmotta-sparql/pom.xml
index d690f08..3808063 100644
--- a/platform/marmotta-sparql/pom.xml
+++ b/platform/marmotta-sparql/pom.xml
@@ -165,6 +165,22 @@
             <artifactId>marmotta-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>jquery-ui</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>codemirror</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>snorql</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>sgvizler</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.marmotta</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/kiwi-module.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/kiwi-module.properties b/platform/marmotta-sparql/src/main/resources/kiwi-module.properties
index d7e19dd..5641ea4 100644
--- a/platform/marmotta-sparql/src/main/resources/kiwi-module.properties
+++ b/platform/marmotta-sparql/src/main/resources/kiwi-module.properties
@@ -27,5 +27,5 @@ icon_small = /admin/img/sparql_small.png
 
 webservices=org.apache.marmotta.platform.sparql.webservices.SparqlWebService
 
-adminpages=/admin/about.html,/admin/configuration.html,/admin/snorql/snorql.html,/admin/update.html
+adminpages=/admin/about.html,/admin/configuration.html,/admin/snorql.html,/admin/update.html
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/configuration.html b/platform/marmotta-sparql/src/main/resources/web/admin/configuration.html
index 15eae48..15b8fdb 100644
--- a/platform/marmotta-sparql/src/main/resources/web/admin/configuration.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/configuration.html
@@ -24,7 +24,7 @@
 	var _SERVER_URL = "http://localhost:8080/LMF/";
 </script>
 <!--###BEGIN_HEAD###-->
-<script type="text/javascript" src="../../core/public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="../../core/public/js/widgets/configurator/configurator.js"></script>
     <link rel="stylesheet" href="style.css" />
     <link type="text/css" rel="stylesheet" href="../../core/public/js/widgets/configurator/style.css">

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/.gitignore
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/.gitignore b/platform/marmotta-sparql/src/main/resources/web/admin/editor/.gitignore
deleted file mode 100644
index e17be69..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.svn
-*.db

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/CodeMirror_license.txt
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/CodeMirror_license.txt b/platform/marmotta-sparql/src/main/resources/web/admin/editor/CodeMirror_license.txt
deleted file mode 100644
index 3f7c0bb..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/CodeMirror_license.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2011 by Marijn Haverbeke <ma...@gmail.com>
-
-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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/Flint_license.txt
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/Flint_license.txt b/platform/marmotta-sparql/src/main/resources/web/admin/editor/Flint_license.txt
deleted file mode 100644
index 14285a6..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/Flint_license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Licence
------------
-
-Flint in released under the MIT license - http://www.opensource.org/licenses/mit-license.php
-
-Copyright (c) 2011 TSO Ltd
-
-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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/README.txt
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/README.txt b/platform/marmotta-sparql/src/main/resources/web/admin/editor/README.txt
deleted file mode 100644
index 64fb26b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/README.txt
+++ /dev/null
@@ -1,134 +0,0 @@
-==============================
-Flint SPARQL Editor v0.5
-==============================
-
-Released 23 June 2011
-
-http://openuplabs.tso.co.uk/demos/sparqleditor
-
-Bug reports/discussion at 
-
-https://groups.google.com/group/flint-sparql-editor
-
-Created by TSO - www.tso.co.uk
-
-You can contact the developers on the Flint Google Group or at flintsparqleditor@tso.co.uk.  If you are deploying Flint on your site, please let us know and we'll keep you informed of new releases.
-
-
-Installation instructions
----------------------------------
-
-Flint can be used locally or on a website.
-
-To install Flint simply unzip all of the files in the download file into a folder, maintaining the structure of the download ZIP.
-
-If the installation is local you can 'run' Flint by opening sparqleditor.html in your browser.
-
-To use within a web page you need to reference the necessary files. This can be done by including the following lines in your web page:
-
-<script type="text/javascript" src="sparql/jquery-1.5.2.min.js">//</script>
-<script type="text/javascript" src="sparql/lib/codemirror.js">//</script>
-<script type="text/javascript" src="sparql/sparqlmode_ll1.js">//</script>
-<script type="text/javascript" src="sparql/flint-editor.js">//</script>
-<link rel="stylesheet" href="sparql/lib/codemirror.css"/>
-<link rel="stylesheet" href="sparql/css/sparqlcolors.css"/>
-<link rel="stylesheet" href="sparql/css/docs.css"/>
-
-To create an instance of Flint in a web page you will need to use Javascript to create a FlintEditor object, passing in the relevant parameters. An example if given below:
-
-var flintEd = new FlintEditor("flint-test", "sparql/images", flintConfig);
-
-The parameters are: 
-
-The id of a container element (e.g. a <div> element) in which Flint will be created
-The relative path of the images for Flint. By default this will use the supplied images
-A Flint configuration object. You can simply look at init-local.js as an example of how to do it or follow the instructions below.
-
-
-Flint Configuration
---------------------------
-
-Flint is configured using a JSON array. An example file is given below:
-
-	var flintConfig = {
-		"interface": {
-			"toolbar": true,
-			"menu": true
-		},
-		"namespaces": [
-			{"name": "Friend of a friend", "prefix": "foaf", "uri": "http://xmlns.com/foaf/0.1/"},
-		],
-		"defaultEndpointParameters": {
-			"queryParameters": {
-				"format": "output",
-				"query": "query"
-			},
-			"selectFormats": [
-				{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "SPARQL-XML", "format": "sparql", "type": "application/sparql-results+xml"},
-				{"name": "JSON", "format": "json", "type": "application/sparql-results+json"}
-			],
-			"constructFormats": [
-				{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "RDF/XML", "format": "rdfxml", "type": "application/rdf+xml"},
-				{"name": "Turtle", "format": "turtle", "type": "application/turtle"}
-			]
-		},
-		"endpoints": [	
-			{"name": "Legislation",
-				"uri": "http://gov.tso.co.uk/legislation/sparql",
-				queries: [
-					{"name": "Sample Legislation Query 1", "description": "Select up to 100 pieces of legislation after a given date, with most recent first.", "query": sampleQuery1},
-					{"name": "Sample Legislation Query 2", "description": "The RDF description of each piece of legislation is stored in a separate named graph, so all of the RDF for the item can be retrieved with the following query.", "query": sampleQuery2}
-				]
-			}
-		}
-
-interface:
-This defines whether certain aspects of the UI should be visible or not. The options are:
-
-toolbar
-menu
-
-The permissible values are true or false
-
-namespaces:
-This defines the namespaces that the application 'knows' about. This should be an array of namespaces. Each namespace should define the following:
-
-	name					UI name
-	prefix					A prefix for the application to use for the namespace
-	uri						The URI of the namespace
-
-defaultEndpointParameters:
-These are default values to use for endpoints. In future versions these will be customisable at the endpoint level
-
-queryParameters
-Details about the query parameter settings. This should define:
-
-	format					The query parameter name for the format to return. Note this is not currently used
-	query					They query parameter that will carry the SPARQL
-	
-selectFormats
-This should be an array of possible formats that can be returned for SELECT queries. Each format should define:
-
-	name					UI name
-	format					query parameter value. Note this is not currently used
-	type						The MIME type of the format. This is used in the request and assumes that an endpoint correctly performs content negotiation
-
-constructFormats
-This should be an array of possible formats that can be returned for CONSTRUCT queries. Each format should define:
-
-	name					UI name
-	format					query parameter value. Note this is not currently used
-	type						The MIME type of the format. This is used in the request and assumes that an endpoint correctly performs content negotiation
-
-endpoints
-This defines a list of pre-defined endpoints that will appear in the UI. Each endpoint should define:
-
-	name					UI name
-	uri						The URI of the endpoint
-	queries					An array of sample queries for this endpoint (optional). Each of these queries should define:
-	
-		name				UI name of query
-		description		A description of the what the query does
-		query				The actual query. (Note you will need to do some tricky escaping, which is why in init-local.js they are defined using variables)

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/flint_sparql_editor.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/flint_sparql_editor.html b/platform/marmotta-sparql/src/main/resources/web/admin/editor/flint_sparql_editor.html
deleted file mode 100644
index 09a602b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/flint_sparql_editor.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!DOCTYPE html>
-<!--
-  ~ Copyright (c) 2012 Salzburg Research.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<!--###BEGIN_HEAD###-->
-<title>Flint SPARQL Editor</title>
-<script type="text/javascript" src="sparql/jquery-1.5.2.min.js"></script>
-<script type="text/javascript" src="sparql/lib/codemirror.js"></script>
-<script type="text/javascript" src="sparql/sparqlmode_ll1.js"></script>
-<script type="text/javascript" src="sparql/init-local.js"></script>
-<script type="text/javascript" src="sparql/flint-editor.js"></script>
-<link rel="stylesheet" href="sparql/lib/codemirror.css"/>
-<link rel="stylesheet" href="sparql/css/sparqlcolors.css"/>
-<link rel="stylesheet" href="sparql/css/docs.css"/>
-<style type="text/css">
-
-    #flint-editor #flint-title{
-        background: #333;
-        background:  -moz-linear-gradient(top, #333, #999);
-        background:  -webkit-gradient(linear, left top, left bottom, from(#333), to(#999));
-    }
-
-    #flint-editor {
-        border: 1px solid #666666;
-    }
-
-    .flint-dialog h2 {
-        background: #333;
-        background:  -moz-linear-gradient(top, #333, #999);
-        background:  -webkit-gradient(linear, left top, left bottom, from(#333), to(#999));
-    }
-</style>
-<!--###END_HEAD###-->
-</head>
-<body>
-<!--###BEGIN_CONTENT###-->
-<div id="flint-test"></div>
-<!--###END_CONTENT###-->
-</div>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/Remove_16x16.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/Remove_16x16.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/Remove_16x16.png
deleted file mode 100644
index 234f9f5..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/Remove_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/docs.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/docs.css b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/docs.css
deleted file mode 100644
index 455641b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/docs.css
+++ /dev/null
@@ -1,704 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.CodeMirror-gutter {
-	width: 3em;
-	background: white;
-}
-
-.CodeMirror {
-	font-size: 14px;
-	float:left;
-	width: 95%;
-	height: 303px;
-	background: white;
-	margin-left: 3px;
-	border: solid 1px #aaa;
-}
-
-.CodeMirror div div pre {
-	margin: 3px;      
-}
-
-.CodeMirror pre {
-	-moz-border-radius: 0;
-	-webkit-border-radius: 0;
-	-o-border-radius: 0;
-	border-radius: 0;
-	border-width: 0; margin: 0; padding: 0; background: transparent;
-	font-family: inherit;
-	margin: 0;        
-}
-
-/* Main Flint editor */
-
-#flint-editor {
-	overflow: auto;	
-	border: 3px solid #aaa;
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-	font-family: verdana;
-	padding: 0em;
-	margin: 0em;
-	background: #eee;
-}
-	
-#flint-editor form {
-	margin: 0em;
-	padding: 0em;
-}
-	
-#flint-editor #flint-title {
-	font-size: 0.9em;
-	background: #1373d8;
-	background: -moz-linear-gradient(top, #1373d8, #42a2d7);
-	background: -webkit-gradient(linear, left top, left bottom, from(#1373d8), to(#42a2d7));
-	font-weight: bold;
-	font-style: normal;
-	color: #FFF;
-	padding: 5px 10px;
-	margin: 0em;
-}
-
-#flint-editor #flint-toolbar
-{
-	display: block;
-	padding: 0em;
-	margin: 0em;
-	width: 100%;
-	font-size: 0.8em;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	overflow: auto;
-	border-bottom: solid 1px #ddd;
-}
-
-#flint-editor #flint-status
-{
-	clear: both;
-	display: block;
-	padding: 3px 10px;
-	margin: 0em;
-	font-size: 0.8em;
-	background: #eee;
-	overflow: auto;
-	border-bottom: solid 1px #ddd;
-	border-top: solid 1px #ddd
-}
-
-#flint-toolbar img {
-	height: 20px
-}
-
-#flint-editor #flint-menu
-{
-	display: block;
-	padding: 0em;
-	margin: 0em;
-	width: 100%;
-	font-size: 0.8em;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	overflow: auto;
-	border-bottom: solid 1px #888;
-	list-style-type: none;
-	list-style-image: none;
-}
-
-
-#flint-editor #flint-menu li
-{
-float: left;
-	display: block;
-	width: 80px;
-	height: 25px;
-	overflow: hidden;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	border-right: solid 1px #ddd
-}
-
-#flint-editor #flint-menu li span {
-	color: black;
-	padding: 3px 10px;
-	height: 25px;
-	line-height: 25px;
-}
-
-#flint-editor #flint-menu li:hover {
-	background: #aaa;
-}
-
-#flint-menu li:hover ul {
-	display: block;
-	margin: 0em;
-	padding: 0em;
-	z-index: 200;
-	position: absolute;
-	border-bottom: solid 1px #888;
-}
-
-*+html #flint-menu li:hover ul {
-	position: relative;
-}
-
-#flint-menu span {
-	cursor: default;
-}
-
-.flint-submenu {
-	display: none
-	list-style-type: none;
-	list-style-image: none;
-}
-
-#flint-editor li, #flint-editor img {
-    clear:none;
-    margin:0 !important;
-}
-
-#flint-editor #flint-menu li li {
-	float: none;
-	display: block;
-	border-right: solid 1px #888;
-	border-bottom: solid 1px #ddd;
-	width: 170px;
-	background: #eee;
-}
-
-#flint-editor #flint-menu li li span img {
-	border: none;
-	padding-right: 10px;
-	vertical-align: middle
-}
-
-#flint-editor #flint-menu li li .flint-menu-filler {
-	padding-left: 0px;
-	padding-right: 26px;
-	margin: 0px;
-	float: left;
-}
-
-#flint-editor #flint-menu li li[class=flint-menu-disabled] span {
-	color: #bbb;
-}
-
-#flint-editor #flint-menu li li[class=flint-menu-z]:hover {
-	background-color: #eee;
-}
-
-#flint-editor #flint-menu li li[class=flint-menu-enabled]:hover {
-	background-color: #ddd;
-}
-
-#flint-editor #flint-toolbar li
-{
-	float: left;
-	display: block;
-	text-align: center;
-	width: 30px;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	color: black;
-	padding: 5px 10px;
-}
-
-#flint-editor #flint-toolbar li.flint-toolbar-enabled:hover {
-	cursor: default;
-	background: #ddd;
-}
-
-#flint-editor #flint-toolbar li.flint-toolbar-disabled {
-	opacity: 0.5;
-}
-
-.flint-toolbar-start {
-	border-left: solid 1px #ccc;
-}
-
-#flint-coolbar, #flint-endpoint-bar {
-	clear: both;
-	background: #eee;
-	overflow: auto;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-}
-
-#flint-endpoint-bar {
-	display: none;
-}
-
-
-#flint-coolbar h2, #flint-endpoint-bar h2 {
-	display: block;
-	float: left;
-	font-weight: normal;
-	width: 60px;
-	font-size: 0.8em;
-	padding: 7px 10px;
-	margin: 0em;
-	color: #000;
-}
-
-#flint-dataset-output-formats h2, #flint-endpoint-output-formats h2 {
-	width: 100px;
-	color: #000;
-}
-
-#flint-endpoint--mimeset-construct-chooser {
-	display: none;
-}
-
-#flint-coolbar select, #flint-endpoint-bar select {
-	float: left;	
-	width: 180px;
-	margin-top: 5px;
-}
-
-#flint-coolbar input {
-	display: block;
-	margin-top: 8px;
-	float: left;
-	width: 25px;
-}
-
-#flint-endpoint-bar input , #flint-coolbar input {
-	display: block;
-	margin-top: 4px;
-	float: left;
-	width: 250px;
-}
-
-#flint-coolbar label {
-	display: block;
-	margin-top: 7px;
-	float: left;
-	width: 85px;
-	font-size: 0.8em
-}
-
-#flint-dataset, #flint-endpoint-input {
-	float: left;
-	width: 340px;
-}
-
-#flint-editor input.flint-submit-button {
-	float: right;
-	width: 60px;
-	margin: 2px 10px;
-	display: block;
-	border: solid 5px #ccc;
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-	background-color: #ccc;
-}
-
-#flint-editor input.flint-info-button {
-	float: right;
-	width: 60px;
-	margin: 2px 10px;
-	display: block;
-	border: solid 5px #ccc;
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-	background-color: #ccc;
-}
-
-#flint-editor #flint-endpoint-datainfo {
-	width: 120px;
-}
-
-#flint-editor input.flint-info-button:hover {
-	cursor: default;
-	background-color: #aaa;
-	border: solid 5px #aaa;
-}
-
-#flint-editor input.flint-submit-button:hover {
-	cursor: default;
-	background-color: #aaa;
-	border: solid 5px #aaa;
-}
-
-#flint-editor #flint-form {
-	padding: 0em;
-	margin: 0em;
-}
-
-#flint-sidebar {
-	float: right;
-	width: 3%;
-	height: 305px;
-	padding: 3px;
-	overflow: hidden;
-}
-
-#flint-sidebar-grabber {
-	float: right;
-	width: 8px;
-	margin-top: 38px;
-	height: 266px;
-	border-right: solid 1px #aaa;
-	margin-right: -2px
-}
-
-#flint-sidebar-grabber:hover {
-	cursor: default;
-}
-
-#flint-sidebar-grabber-button {
-	float: none;
-	margin-top: 121px;
-	width: 8px;
-	height: 20px;
-	background: #bbb;
-	-webkit-border-top-left-radius: 5px;
-	-webkit-border-bottom-left-radius: 5px;
-	-moz-border-radius-topleft: 5px;
-	-moz-border-radius-bottomleft: 5px;
-	border-top-left-radius: 5px;
-	border-bottom-left-radius: 5px;
-	border-right: solid 1px #bbb;
-	display: block;
-}
-
-
-#flint-sidebar-content {
-	border-left: solid 1px #aaa;
-	border-top: solid 1px #aaa;
-	min-width: 100px;
-	max-width: 98%;
-	height: 255px;
-	font-size: 0.8em;
-	padding: 5px;
-	overflow: hidden;
-	background: #fff;
-}
-
-#flint-sidebar-content ul {
-	list-style-type: none;
-	list-style-image: none;
-	margin-left: 0em;
-	margin-top: 0em;
-	padding-left: 0em;
-	white-space: nowrap;
-	font-size: 0.85em;
-}
-
-#flint-sidebar-content li:hover {
-	cursor: default;
-}
-
-#flint-sidebar-options {
-	display: block;
-	margin: 0em;
-	padding-left: 5px;
-	width: 100%;
-	font-size: 0.8em;
-	overflow: hidden;
-	height: 35px;
-	list-style-type: none;
-	list-style-image: none;
-	background: #eee
-}
-
-
-#flint-sidebar-options li
-{
-	float: left;
-	display: block;
-	width: 80px;
-	padding-left: 3px;;
-	height: 35px;
-	text-align: center;
-	line-height: 35px;
-	overflow: hidden;
-	border-top: solid 1px #888;
-	border-left: solid 1px #888;
-	border-right: solid 1px #888;
-	-webkit-border-top-left-radius: 12px;
-	-webkit-border-top-right-radius: 12px;
-	-moz-border-radius-topleft: 12px;
-	-moz-border-radius-topright: 12px;
-	border-top-left-radius: 12px;
-	border-top-right-radius: 12px;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-}
-
-#flint-sidebar-options li:hover {
-	cursor: default;
-	background: #aaa;
-}
-
-#flint-sidebar-options li.flint-sidebar-selected {
-	background: #ccc;
-}
-
-#flint-command-table td {
-        border: none;
-	/* border: 1px solid #aaa;*/
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-	padding: 2px;
-	width: 100px;
-}
-
-/*
-#flint-command-table td:hover {
-	cursor: default;
-	background: #aaa;
-}
-*/
-
-.flint-property {
-	padding: 2px;
-}
-
-.flint-property:hover {
-	background: #aaa;
-}
-
-.flint-class {
-	padding: 2px;
-}
-
-.flint-class:hover {
-	background: #aaa;
-}
-
-#flint-samples {
-	font-size: 1em;
-}
-
-#flint-samples h3 {
-	font-weight: bold;
-	font-style: normal;
-	font-size: 1em;
-	margin: 0em;
-	color: white;
-	padding: 3px;
-	background: #1373d8;
-	background: -moz-linear-gradient(top, #1373d8, #42a2d7);
-	background: -webkit-gradient(linear, left top, left bottom, from(#1373d8), to(#42a2d7));
-	border-radius: 5px;
-	-moz-border-radius: 5px;	
-}
-
-.flint-sample {
-	border: solid 1px #fff;
-	padding-bottom: 20px;
-	font-size: 1.2em;
-	padding: 5px;
-}
-
-.flint-sample p {
-	color: black;
-	font-size: 0.8em;
-	margin-top: 10px;
-	margin-bottom: 0em;
-	margin-left: 0em;
-	margin-right: 0em;
-	padding: 0em;
-	font-style: italic;
-}
-
-.flint-sample pre {
-	font-size: 1.1em;
-}
-
-.flint-sample:hover {
-	border: dashed 1px #ccc;
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-}
-
-.flint-prefix {
-	padding: 2px;
-	font-size: 1.2em;
-}
-
-.flint-prefix:hover {
-	background: #aaa;
-}
-
-#flint-results-area {
-	height: 200px;
-	background: white;
-	padding: 3px
-}
-
-#flint-results {
-	width: 100%;
-	height: 197px;
-	margin: 0px;
-	padding: 0em;
-	font-size: 0.85em;
-	border: none;
-}
-
-#flint-results-loader {
-	width: 100%;	
-	margin: 0px;
-	padding-top: 20px;
-	padding-bottom: 0px;
-	text-align: center;
-	font-size: 0.8em;
-	font-weight: normal;
-	display: none;
-	background: white;
-	border: none;
-}
-
-#flint-results-loader img {
-	vertical-align: middle;
-}
-
-h2#flint-results-heading {
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	font-size: 0.80em;
-	font-weight: normal;
-	font-style: normal;
-	color: black;
-	padding: 5px 10px;
-	margin: 0em;	
-	border-top: solid 1px #888;
-	border-bottom: none;
-}
-
-
-.flint-dialog {
-	z-index: 10000;
-	position: absolute;
-	top: 0px;
-	left: 0px;
-	width: 100%;
-	height: 100%;
-	visibility: hidden;
-}
-
-.flint-dialog-body {
-	margin-top: 200px;
-	margin-left: auto;
-	margin-right: auto;
-	width: 450px;
-	height: 200px;
-	border: solid 5px #888;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	background: #eee;
-	background: -moz-linear-gradient(top, #fff, #eee);
-	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
-	-moz-box-shadow: rgba(0, 0, 0, 0.25) 0 8px 12px;
-	-webkit-box-shadow: rgba(0, 0, 0, 0.25) 0 8px 12px;
-	box-shadow: rgba(0, 0, 0, 0.25) 0 8px 12px;
-}
-
-.flint-dialog-body-container {
-	position: relative;
-	height: 200px;
-}
-
-.flint-dialog h2 {
-	font-size: 0.9em;
-	background: #1373d8;
-	background: -moz-linear-gradient(top, #1373d8, #42a2d7);
-	background: -webkit-gradient(linear, left top, left bottom, from(#1373d8), to(#42a2d7));
-	padding: 1%;
-	color: white;
-	margin: 0em;
-}
-
-.flint-dialog p {
-	padding: 5px;
-	font-size: 0.8em;
-	margin-bottom: 0.5em;
-}
-
-#flint-dialog-buttons {
-}
-
-.flint-close {
-	width: 16px;
-	height: 16px;
-	float: right;
-	display: block;
-	background-image: url('Remove_16x16.png');
-}
-
-.flint-close-button, .flint-okay-button {
-	position: absolute;
-	width: 60px;
-	font-size: 0.8em;
-	text-align: center;
-	margin: 2px 10px;
-	display: block;
-	border: solid 5px #ccc;
-	border-radius: 3px;
-	-moz-border-radius: 3px;
-	background-color: #ccc;
-}
-
-.flint-close-button {
-	bottom: 5px;
-	right: 5px;
-}
-
-.flint-okay-button {
-	bottom: 5px;
-	right: 85px;
-}
-
-
-.flint-keyword-button {
-    border-style:solid;
-    border-color:#777;
-    border-width:1px;
-    background-color: #fff;
-    margin: 0px 0px 0px 0px;
-    color: #000;
-    font-size: 1em;
-}
-.flint-keyword-button:hover {
-    background-color: #ccc;
-}
-
-.flint-keyword-button[disabled] {
-    border-style:solid;
-    border-color:#ccc;
-    border-width:1px;
-    background-color: #fff;
-    margin: 0px 0px 0px 0px;
-   
-    color: #bbb;
-}
-.flint-keyword-button:hover[disabled] {
-    background-color: #fff;
-}
-
-.flint-close-button:hover, .flint-okay-button:hover {
-	cursor: default;
-	background-color: #aaa;
-	border: solid 5px #aaa;
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/font.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/font.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/font.js
deleted file mode 100644
index c09828e..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/font.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-function waitForStyles() {
-  for (var i = 0; i < document.styleSheets.length; i++)
-    if (/googleapis/.test(document.styleSheets[i].href))
-      return document.body.className += " droid";
-  setTimeout(waitForStyles, 100);
-}
-setTimeout(function() {
-  if (/AppleWebKit/.test(navigator.userAgent) && /iP[oa]d|iPhone/.test(navigator.userAgent)) return;
-  var link = document.createElement("LINK");
-  link.type = "text/css";
-  link.rel = "stylesheet";
-  link.href = "http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold";
-  document.documentElement.getElementsByTagName("HEAD")[0].appendChild(link);
-  waitForStyles();
-}, 10);

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/sparqlcolors.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/sparqlcolors.css b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/sparqlcolors.css
deleted file mode 100644
index 5711b8c..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/css/sparqlcolors.css
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-html {
-  cursor: text;
-}
-
-.editbox {
-  margin: .4em;
-  padding: 0;
-  font-family: monospace;
-  font-size: 10pt;
-  color: black;
-}
-
-.editbox p {
-  margin: 0;
-}
-
-span.sp-keyword {
-  color: #92a;
-}
-
-span.sp-prefixed {
-  color: #f80;
-}
-
-span.sp-var {
-  color: #00c;
-}
-
-span.sp-comment {
-  color: #a70;
-}
-
-span.sp-literal {
-  color: #a22;
-}
-
-span.sp-uri {
-  color: #292;
-}
-
-span.sp-operator {
-  color: #088;
-}
-
-span.sp-punc {
-  color: #088;
-}
-
-span.sp-number {
-  color: #a22;
-}
-
-
-span.sp-error {
-  /* color:rgb(0,255,255); */
-  /* background-color:rgb(255,0,0); */
-  /* text-decoration: underline; */
-  border-bottom:2px dotted red;
-}


[05/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/effects.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/effects.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/effects.js
deleted file mode 100755
index 113aff6..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/effects.js
+++ /dev/null
@@ -1,1130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable  
-String.prototype.parseColor = function() {  
-  var color = '#';
-  if (this.slice(0,4) == 'rgb(') {  
-    var cols = this.slice(4,this.length-1).split(',');  
-    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
-  } else {  
-    if (this.slice(0,1) == '#') {  
-      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
-      if (this.length==7) color = this.toLowerCase();  
-    }  
-  }  
-  return (color.length==7 ? color : (arguments[0] || this));  
-};
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {  
-  return $A($(element).childNodes).collect( function(node) {
-    return (node.nodeType==3 ? node.nodeValue : 
-      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
-  }).flatten().join('');
-};
-
-Element.collectTextNodesIgnoreClass = function(element, className) {  
-  return $A($(element).childNodes).collect( function(node) {
-    return (node.nodeType==3 ? node.nodeValue : 
-      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
-        Element.collectTextNodesIgnoreClass(node, className) : ''));
-  }).flatten().join('');
-};
-
-Element.setContentZoom = function(element, percent) {
-  element = $(element);  
-  element.setStyle({fontSize: (percent/100) + 'em'});   
-  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
-  return element;
-};
-
-Element.getInlineOpacity = function(element){
-  return $(element).style.opacity || '';
-};
-
-Element.forceRerendering = function(element) {
-  try {
-    element = $(element);
-    var n = document.createTextNode(' ');
-    element.appendChild(n);
-    element.removeChild(n);
-  } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
-  _elementDoesNotExistError: {
-    name: 'ElementDoesNotExistError',
-    message: 'The specified DOM element does not exist, but is required for this effect to operate'
-  },
-  Transitions: {
-    linear: Prototype.K,
-    sinoidal: function(pos) {
-      return (-Math.cos(pos*Math.PI)/2) + 0.5;
-    },
-    reverse: function(pos) {
-      return 1-pos;
-    },
-    flicker: function(pos) {
-      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
-      return pos > 1 ? 1 : pos;
-    },
-    wobble: function(pos) {
-      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
-    },
-    pulse: function(pos, pulses) { 
-      pulses = pulses || 5; 
-      return (
-        ((pos % (1/pulses)) * pulses).round() == 0 ? 
-              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
-          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
-        );
-    },
-    spring: function(pos) { 
-      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
-    },
-    none: function(pos) {
-      return 0;
-    },
-    full: function(pos) {
-      return 1;
-    }
-  },
-  DefaultOptions: {
-    duration:   1.0,   // seconds
-    fps:        100,   // 100= assume 66fps max.
-    sync:       false, // true for combining
-    from:       0.0,
-    to:         1.0,
-    delay:      0.0,
-    queue:      'parallel'
-  },
-  tagifyText: function(element) {
-    var tagifyStyle = 'position:relative';
-    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
-    
-    element = $(element);
-    $A(element.childNodes).each( function(child) {
-      if (child.nodeType==3) {
-        child.nodeValue.toArray().each( function(character) {
-          element.insertBefore(
-            new Element('span', {style: tagifyStyle}).update(
-              character == ' ' ? String.fromCharCode(160) : character), 
-              child);
-        });
-        Element.remove(child);
-      }
-    });
-  },
-  multiple: function(element, effect) {
-    var elements;
-    if (((typeof element == 'object') || 
-        Object.isFunction(element)) && 
-       (element.length))
-      elements = element;
-    else
-      elements = $(element).childNodes;
-      
-    var options = Object.extend({
-      speed: 0.1,
-      delay: 0.0
-    }, arguments[2] || { });
-    var masterDelay = options.delay;
-
-    $A(elements).each( function(element, index) {
-      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
-    });
-  },
-  PAIRS: {
-    'slide':  ['SlideDown','SlideUp'],
-    'blind':  ['BlindDown','BlindUp'],
-    'appear': ['Appear','Fade']
-  },
-  toggle: function(element, effect) {
-    element = $(element);
-    effect = (effect || 'appear').toLowerCase();
-    var options = Object.extend({
-      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
-    }, arguments[2] || { });
-    Effect[element.visible() ? 
-      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
-  }
-};
-
-Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create(Enumerable, {
-  initialize: function() {
-    this.effects  = [];
-    this.interval = null;    
-  },
-  _each: function(iterator) {
-    this.effects._each(iterator);
-  },
-  add: function(effect) {
-    var timestamp = new Date().getTime();
-    
-    var position = Object.isString(effect.options.queue) ? 
-      effect.options.queue : effect.options.queue.position;
-    
-    switch(position) {
-      case 'front':
-        // move unstarted effects after this effect  
-        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
-            e.startOn  += effect.finishOn;
-            e.finishOn += effect.finishOn;
-          });
-        break;
-      case 'with-last':
-        timestamp = this.effects.pluck('startOn').max() || timestamp;
-        break;
-      case 'end':
-        // start effect after last queued effect has finished
-        timestamp = this.effects.pluck('finishOn').max() || timestamp;
-        break;
-    }
-    
-    effect.startOn  += timestamp;
-    effect.finishOn += timestamp;
-
-    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
-      this.effects.push(effect);
-    
-    if (!this.interval)
-      this.interval = setInterval(this.loop.bind(this), 15);
-  },
-  remove: function(effect) {
-    this.effects = this.effects.reject(function(e) { return e==effect });
-    if (this.effects.length == 0) {
-      clearInterval(this.interval);
-      this.interval = null;
-    }
-  },
-  loop: function() {
-    var timePos = new Date().getTime();
-    for(var i=0, len=this.effects.length;i<len;i++) 
-      this.effects[i] && this.effects[i].loop(timePos);
-  }
-});
-
-Effect.Queues = {
-  instances: $H(),
-  get: function(queueName) {
-    if (!Object.isString(queueName)) return queueName;
-    
-    return this.instances.get(queueName) ||
-      this.instances.set(queueName, new Effect.ScopedQueue());
-  }
-};
-Effect.Queue = Effect.Queues.get('global');
-
-Effect.Base = Class.create({
-  position: null,
-  start: function(options) {
-    function codeForEvent(options,eventName){
-      return (
-        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
-        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
-      );
-    }
-    if (options && options.transition === false) options.transition = Effect.Transitions.linear;
-    this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
-    this.currentFrame = 0;
-    this.state        = 'idle';
-    this.startOn      = this.options.delay*1000;
-    this.finishOn     = this.startOn+(this.options.duration*1000);
-    this.fromToDelta  = this.options.to-this.options.from;
-    this.totalTime    = this.finishOn-this.startOn;
-    this.totalFrames  = this.options.fps*this.options.duration;
-    
-    eval('this.render = function(pos){ '+
-      'if (this.state=="idle"){this.state="running";'+
-      codeForEvent(this.options,'beforeSetup')+
-      (this.setup ? 'this.setup();':'')+ 
-      codeForEvent(this.options,'afterSetup')+
-      '};if (this.state=="running"){'+
-      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
-      'this.position=pos;'+
-      codeForEvent(this.options,'beforeUpdate')+
-      (this.update ? 'this.update(pos);':'')+
-      codeForEvent(this.options,'afterUpdate')+
-      '}}');
-    
-    this.event('beforeStart');
-    if (!this.options.sync)
-      Effect.Queues.get(Object.isString(this.options.queue) ? 
-        'global' : this.options.queue.scope).add(this);
-  },
-  loop: function(timePos) {
-    if (timePos >= this.startOn) {
-      if (timePos >= this.finishOn) {
-        this.render(1.0);
-        this.cancel();
-        this.event('beforeFinish');
-        if (this.finish) this.finish(); 
-        this.event('afterFinish');
-        return;  
-      }
-      var pos   = (timePos - this.startOn) / this.totalTime,
-          frame = (pos * this.totalFrames).round();
-      if (frame > this.currentFrame) {
-        this.render(pos);
-        this.currentFrame = frame;
-      }
-    }
-  },
-  cancel: function() {
-    if (!this.options.sync)
-      Effect.Queues.get(Object.isString(this.options.queue) ? 
-        'global' : this.options.queue.scope).remove(this);
-    this.state = 'finished';
-  },
-  event: function(eventName) {
-    if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
-    if (this.options[eventName]) this.options[eventName](this);
-  },
-  inspect: function() {
-    var data = $H();
-    for(property in this)
-      if (!Object.isFunction(this[property])) data.set(property, this[property]);
-    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
-  }
-});
-
-Effect.Parallel = Class.create(Effect.Base, {
-  initialize: function(effects) {
-    this.effects = effects || [];
-    this.start(arguments[1]);
-  },
-  update: function(position) {
-    this.effects.invoke('render', position);
-  },
-  finish: function(position) {
-    this.effects.each( function(effect) {
-      effect.render(1.0);
-      effect.cancel();
-      effect.event('beforeFinish');
-      if (effect.finish) effect.finish(position);
-      effect.event('afterFinish');
-    });
-  }
-});
-
-Effect.Tween = Class.create(Effect.Base, {
-  initialize: function(object, from, to) {
-    object = Object.isString(object) ? $(object) : object;
-    var args = $A(arguments), method = args.last(), 
-      options = args.length == 5 ? args[3] : null;
-    this.method = Object.isFunction(method) ? method.bind(object) :
-      Object.isFunction(object[method]) ? object[method].bind(object) : 
-      function(value) { object[method] = value };
-    this.start(Object.extend({ from: from, to: to }, options || { }));
-  },
-  update: function(position) {
-    this.method(position);
-  }
-});
-
-Effect.Event = Class.create(Effect.Base, {
-  initialize: function() {
-    this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
-  },
-  update: Prototype.emptyFunction
-});
-
-Effect.Opacity = Class.create(Effect.Base, {
-  initialize: function(element) {
-    this.element = $(element);
-    if (!this.element) throw(Effect._elementDoesNotExistError);
-    // make this work on IE on elements without 'layout'
-    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
-      this.element.setStyle({zoom: 1});
-    var options = Object.extend({
-      from: this.element.getOpacity() || 0.0,
-      to:   1.0
-    }, arguments[1] || { });
-    this.start(options);
-  },
-  update: function(position) {
-    this.element.setOpacity(position);
-  }
-});
-
-Effect.Move = Class.create(Effect.Base, {
-  initialize: function(element) {
-    this.element = $(element);
-    if (!this.element) throw(Effect._elementDoesNotExistError);
-    var options = Object.extend({
-      x:    0,
-      y:    0,
-      mode: 'relative'
-    }, arguments[1] || { });
-    this.start(options);
-  },
-  setup: function() {
-    this.element.makePositioned();
-    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
-    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
-    if (this.options.mode == 'absolute') {
-      this.options.x = this.options.x - this.originalLeft;
-      this.options.y = this.options.y - this.originalTop;
-    }
-  },
-  update: function(position) {
-    this.element.setStyle({
-      left: (this.options.x  * position + this.originalLeft).round() + 'px',
-      top:  (this.options.y  * position + this.originalTop).round()  + 'px'
-    });
-  }
-});
-
-// for backwards compatibility
-Effect.MoveBy = function(element, toTop, toLeft) {
-  return new Effect.Move(element, 
-    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
-};
-
-Effect.Scale = Class.create(Effect.Base, {
-  initialize: function(element, percent) {
-    this.element = $(element);
-    if (!this.element) throw(Effect._elementDoesNotExistError);
-    var options = Object.extend({
-      scaleX: true,
-      scaleY: true,
-      scaleContent: true,
-      scaleFromCenter: false,
-      scaleMode: 'box',        // 'box' or 'contents' or { } with provided values
-      scaleFrom: 100.0,
-      scaleTo:   percent
-    }, arguments[2] || { });
-    this.start(options);
-  },
-  setup: function() {
-    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
-    this.elementPositioning = this.element.getStyle('position');
-    
-    this.originalStyle = { };
-    ['top','left','width','height','fontSize'].each( function(k) {
-      this.originalStyle[k] = this.element.style[k];
-    }.bind(this));
-      
-    this.originalTop  = this.element.offsetTop;
-    this.originalLeft = this.element.offsetLeft;
-    
-    var fontSize = this.element.getStyle('font-size') || '100%';
-    ['em','px','%','pt'].each( function(fontSizeType) {
-      if (fontSize.indexOf(fontSizeType)>0) {
-        this.fontSize     = parseFloat(fontSize);
-        this.fontSizeType = fontSizeType;
-      }
-    }.bind(this));
-    
-    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-    
-    this.dims = null;
-    if (this.options.scaleMode=='box')
-      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
-    if (/^content/.test(this.options.scaleMode))
-      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
-    if (!this.dims)
-      this.dims = [this.options.scaleMode.originalHeight,
-                   this.options.scaleMode.originalWidth];
-  },
-  update: function(position) {
-    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
-    if (this.options.scaleContent && this.fontSize)
-      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
-    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
-  },
-  finish: function(position) {
-    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
-  },
-  setDimensions: function(height, width) {
-    var d = { };
-    if (this.options.scaleX) d.width = width.round() + 'px';
-    if (this.options.scaleY) d.height = height.round() + 'px';
-    if (this.options.scaleFromCenter) {
-      var topd  = (height - this.dims[0])/2;
-      var leftd = (width  - this.dims[1])/2;
-      if (this.elementPositioning == 'absolute') {
-        if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
-        if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
-      } else {
-        if (this.options.scaleY) d.top = -topd + 'px';
-        if (this.options.scaleX) d.left = -leftd + 'px';
-      }
-    }
-    this.element.setStyle(d);
-  }
-});
-
-Effect.Highlight = Class.create(Effect.Base, {
-  initialize: function(element) {
-    this.element = $(element);
-    if (!this.element) throw(Effect._elementDoesNotExistError);
-    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
-    this.start(options);
-  },
-  setup: function() {
-    // Prevent executing on elements not in the layout flow
-    if (this.element.getStyle('display')=='none') { this.cancel(); return; }
-    // Disable background image during the effect
-    this.oldStyle = { };
-    if (!this.options.keepBackgroundImage) {
-      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
-      this.element.setStyle({backgroundImage: 'none'});
-    }
-    if (!this.options.endcolor)
-      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
-    if (!this.options.restorecolor)
-      this.options.restorecolor = this.element.getStyle('background-color');
-    // init color calculations
-    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
-    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
-  },
-  update: function(position) {
-    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
-      return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
-  },
-  finish: function() {
-    this.element.setStyle(Object.extend(this.oldStyle, {
-      backgroundColor: this.options.restorecolor
-    }));
-  }
-});
-
-Effect.ScrollTo = function(element) {
-  var options = arguments[1] || { },
-    scrollOffsets = document.viewport.getScrollOffsets(),
-    elementOffsets = $(element).cumulativeOffset(),
-    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  
-
-  if (options.offset) elementOffsets[1] += options.offset;
-
-  return new Effect.Tween(null,
-    scrollOffsets.top,
-    elementOffsets[1] > max ? max : elementOffsets[1],
-    options,
-    function(p){ scrollTo(scrollOffsets.left, p.round()) }
-  );
-};
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
-  element = $(element);
-  var oldOpacity = element.getInlineOpacity();
-  var options = Object.extend({
-    from: element.getOpacity() || 1.0,
-    to:   0.0,
-    afterFinishInternal: function(effect) { 
-      if (effect.options.to!=0) return;
-      effect.element.hide().setStyle({opacity: oldOpacity}); 
-    }
-  }, arguments[1] || { });
-  return new Effect.Opacity(element,options);
-};
-
-Effect.Appear = function(element) {
-  element = $(element);
-  var options = Object.extend({
-  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
-  to:   1.0,
-  // force Safari to render floated elements properly
-  afterFinishInternal: function(effect) {
-    effect.element.forceRerendering();
-  },
-  beforeSetup: function(effect) {
-    effect.element.setOpacity(effect.options.from).show(); 
-  }}, arguments[1] || { });
-  return new Effect.Opacity(element,options);
-};
-
-Effect.Puff = function(element) {
-  element = $(element);
-  var oldStyle = { 
-    opacity: element.getInlineOpacity(), 
-    position: element.getStyle('position'),
-    top:  element.style.top,
-    left: element.style.left,
-    width: element.style.width,
-    height: element.style.height
-  };
-  return new Effect.Parallel(
-   [ new Effect.Scale(element, 200, 
-      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
-     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
-     Object.extend({ duration: 1.0, 
-      beforeSetupInternal: function(effect) {
-        Position.absolutize(effect.effects[0].element)
-      },
-      afterFinishInternal: function(effect) {
-         effect.effects[0].element.hide().setStyle(oldStyle); }
-     }, arguments[1] || { })
-   );
-};
-
-Effect.BlindUp = function(element) {
-  element = $(element);
-  element.makeClipping();
-  return new Effect.Scale(element, 0,
-    Object.extend({ scaleContent: false, 
-      scaleX: false, 
-      restoreAfterFinish: true,
-      afterFinishInternal: function(effect) {
-        effect.element.hide().undoClipping();
-      } 
-    }, arguments[1] || { })
-  );
-};
-
-Effect.BlindDown = function(element) {
-  element = $(element);
-  var elementDimensions = element.getDimensions();
-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
-    scaleX: false,
-    scaleFrom: 0,
-    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
-    restoreAfterFinish: true,
-    afterSetup: function(effect) {
-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
-    },  
-    afterFinishInternal: function(effect) {
-      effect.element.undoClipping();
-    }
-  }, arguments[1] || { }));
-};
-
-Effect.SwitchOff = function(element) {
-  element = $(element);
-  var oldOpacity = element.getInlineOpacity();
-  return new Effect.Appear(element, Object.extend({
-    duration: 0.4,
-    from: 0,
-    transition: Effect.Transitions.flicker,
-    afterFinishInternal: function(effect) {
-      new Effect.Scale(effect.element, 1, { 
-        duration: 0.3, scaleFromCenter: true,
-        scaleX: false, scaleContent: false, restoreAfterFinish: true,
-        beforeSetup: function(effect) { 
-          effect.element.makePositioned().makeClipping();
-        },
-        afterFinishInternal: function(effect) {
-          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
-        }
-      })
-    }
-  }, arguments[1] || { }));
-};
-
-Effect.DropOut = function(element) {
-  element = $(element);
-  var oldStyle = {
-    top: element.getStyle('top'),
-    left: element.getStyle('left'),
-    opacity: element.getInlineOpacity() };
-  return new Effect.Parallel(
-    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
-      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
-    Object.extend(
-      { duration: 0.5,
-        beforeSetup: function(effect) {
-          effect.effects[0].element.makePositioned(); 
-        },
-        afterFinishInternal: function(effect) {
-          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
-        } 
-      }, arguments[1] || { }));
-};
-
-Effect.Shake = function(element) {
-  element = $(element);
-  var options = Object.extend({
-    distance: 20,
-    duration: 0.5
-  }, arguments[1] || {});
-  var distance = parseFloat(options.distance);
-  var split = parseFloat(options.duration) / 10.0;
-  var oldStyle = {
-    top: element.getStyle('top'),
-    left: element.getStyle('left') };
-    return new Effect.Move(element,
-      { x:  distance, y: 0, duration: split, afterFinishInternal: function(effect) {
-    new Effect.Move(effect.element,
-      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
-    new Effect.Move(effect.element,
-      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
-    new Effect.Move(effect.element,
-      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
-    new Effect.Move(effect.element,
-      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
-    new Effect.Move(effect.element,
-      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
-        effect.element.undoPositioned().setStyle(oldStyle);
-  }}) }}) }}) }}) }}) }});
-};
-
-Effect.SlideDown = function(element) {
-  element = $(element).cleanWhitespace();
-  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
-  var oldInnerBottom = element.down().getStyle('bottom');
-  var elementDimensions = element.getDimensions();
-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
-    scaleX: false, 
-    scaleFrom: window.opera ? 0 : 1,
-    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
-    restoreAfterFinish: true,
-    afterSetup: function(effect) {
-      effect.element.makePositioned();
-      effect.element.down().makePositioned();
-      if (window.opera) effect.element.setStyle({top: ''});
-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
-    },
-    afterUpdateInternal: function(effect) {
-      effect.element.down().setStyle({bottom:
-        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
-    },
-    afterFinishInternal: function(effect) {
-      effect.element.undoClipping().undoPositioned();
-      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
-    }, arguments[1] || { })
-  );
-};
-
-Effect.SlideUp = function(element) {
-  element = $(element).cleanWhitespace();
-  var oldInnerBottom = element.down().getStyle('bottom');
-  var elementDimensions = element.getDimensions();
-  return new Effect.Scale(element, window.opera ? 0 : 1,
-   Object.extend({ scaleContent: false, 
-    scaleX: false, 
-    scaleMode: 'box',
-    scaleFrom: 100,
-    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
-    restoreAfterFinish: true,
-    afterSetup: function(effect) {
-      effect.element.makePositioned();
-      effect.element.down().makePositioned();
-      if (window.opera) effect.element.setStyle({top: ''});
-      effect.element.makeClipping().show();
-    },  
-    afterUpdateInternal: function(effect) {
-      effect.element.down().setStyle({bottom:
-        (effect.dims[0] - effect.element.clientHeight) + 'px' });
-    },
-    afterFinishInternal: function(effect) {
-      effect.element.hide().undoClipping().undoPositioned();
-      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
-    }
-   }, arguments[1] || { })
-  );
-};
-
-// Bug in opera makes the TD containing this element expand for a instance after finish 
-Effect.Squish = function(element) {
-  return new Effect.Scale(element, window.opera ? 1 : 0, { 
-    restoreAfterFinish: true,
-    beforeSetup: function(effect) {
-      effect.element.makeClipping(); 
-    },  
-    afterFinishInternal: function(effect) {
-      effect.element.hide().undoClipping(); 
-    }
-  });
-};
-
-Effect.Grow = function(element) {
-  element = $(element);
-  var options = Object.extend({
-    direction: 'center',
-    moveTransition: Effect.Transitions.sinoidal,
-    scaleTransition: Effect.Transitions.sinoidal,
-    opacityTransition: Effect.Transitions.full
-  }, arguments[1] || { });
-  var oldStyle = {
-    top: element.style.top,
-    left: element.style.left,
-    height: element.style.height,
-    width: element.style.width,
-    opacity: element.getInlineOpacity() };
-
-  var dims = element.getDimensions();    
-  var initialMoveX, initialMoveY;
-  var moveX, moveY;
-  
-  switch (options.direction) {
-    case 'top-left':
-      initialMoveX = initialMoveY = moveX = moveY = 0; 
-      break;
-    case 'top-right':
-      initialMoveX = dims.width;
-      initialMoveY = moveY = 0;
-      moveX = -dims.width;
-      break;
-    case 'bottom-left':
-      initialMoveX = moveX = 0;
-      initialMoveY = dims.height;
-      moveY = -dims.height;
-      break;
-    case 'bottom-right':
-      initialMoveX = dims.width;
-      initialMoveY = dims.height;
-      moveX = -dims.width;
-      moveY = -dims.height;
-      break;
-    case 'center':
-      initialMoveX = dims.width / 2;
-      initialMoveY = dims.height / 2;
-      moveX = -dims.width / 2;
-      moveY = -dims.height / 2;
-      break;
-  }
-  
-  return new Effect.Move(element, {
-    x: initialMoveX,
-    y: initialMoveY,
-    duration: 0.01, 
-    beforeSetup: function(effect) {
-      effect.element.hide().makeClipping().makePositioned();
-    },
-    afterFinishInternal: function(effect) {
-      new Effect.Parallel(
-        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
-          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
-          new Effect.Scale(effect.element, 100, {
-            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
-            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
-        ], Object.extend({
-             beforeSetup: function(effect) {
-               effect.effects[0].element.setStyle({height: '0px'}).show(); 
-             },
-             afterFinishInternal: function(effect) {
-               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
-             }
-           }, options)
-      )
-    }
-  });
-};
-
-Effect.Shrink = function(element) {
-  element = $(element);
-  var options = Object.extend({
-    direction: 'center',
-    moveTransition: Effect.Transitions.sinoidal,
-    scaleTransition: Effect.Transitions.sinoidal,
-    opacityTransition: Effect.Transitions.none
-  }, arguments[1] || { });
-  var oldStyle = {
-    top: element.style.top,
-    left: element.style.left,
-    height: element.style.height,
-    width: element.style.width,
-    opacity: element.getInlineOpacity() };
-
-  var dims = element.getDimensions();
-  var moveX, moveY;
-  
-  switch (options.direction) {
-    case 'top-left':
-      moveX = moveY = 0;
-      break;
-    case 'top-right':
-      moveX = dims.width;
-      moveY = 0;
-      break;
-    case 'bottom-left':
-      moveX = 0;
-      moveY = dims.height;
-      break;
-    case 'bottom-right':
-      moveX = dims.width;
-      moveY = dims.height;
-      break;
-    case 'center':  
-      moveX = dims.width / 2;
-      moveY = dims.height / 2;
-      break;
-  }
-  
-  return new Effect.Parallel(
-    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
-      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
-      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
-    ], Object.extend({            
-         beforeStartInternal: function(effect) {
-           effect.effects[0].element.makePositioned().makeClipping(); 
-         },
-         afterFinishInternal: function(effect) {
-           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
-       }, options)
-  );
-};
-
-Effect.Pulsate = function(element) {
-  element = $(element);
-  var options    = arguments[1] || { };
-  var oldOpacity = element.getInlineOpacity();
-  var transition = options.transition || Effect.Transitions.sinoidal;
-  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
-  reverser.bind(transition);
-  return new Effect.Opacity(element, 
-    Object.extend(Object.extend({  duration: 2.0, from: 0,
-      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
-    }, options), {transition: reverser}));
-};
-
-Effect.Fold = function(element) {
-  element = $(element);
-  var oldStyle = {
-    top: element.style.top,
-    left: element.style.left,
-    width: element.style.width,
-    height: element.style.height };
-  element.makeClipping();
-  return new Effect.Scale(element, 5, Object.extend({   
-    scaleContent: false,
-    scaleX: false,
-    afterFinishInternal: function(effect) {
-    new Effect.Scale(element, 1, { 
-      scaleContent: false, 
-      scaleY: false,
-      afterFinishInternal: function(effect) {
-        effect.element.hide().undoClipping().setStyle(oldStyle);
-      } });
-  }}, arguments[1] || { }));
-};
-
-Effect.Morph = Class.create(Effect.Base, {
-  initialize: function(element) {
-    this.element = $(element);
-    if (!this.element) throw(Effect._elementDoesNotExistError);
-    var options = Object.extend({
-      style: { }
-    }, arguments[1] || { });
-    
-    if (!Object.isString(options.style)) this.style = $H(options.style);
-    else {
-      if (options.style.include(':'))
-        this.style = options.style.parseStyle();
-      else {
-        this.element.addClassName(options.style);
-        this.style = $H(this.element.getStyles());
-        this.element.removeClassName(options.style);
-        var css = this.element.getStyles();
-        this.style = this.style.reject(function(style) {
-          return style.value == css[style.key];
-        });
-        options.afterFinishInternal = function(effect) {
-          effect.element.addClassName(effect.options.style);
-          effect.transforms.each(function(transform) {
-            effect.element.style[transform.style] = '';
-          });
-        }
-      }
-    }
-    this.start(options);
-  },
-  
-  setup: function(){
-    function parseColor(color){
-      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
-      color = color.parseColor();
-      return $R(0,2).map(function(i){
-        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
-      });
-    }
-    this.transforms = this.style.map(function(pair){
-      var property = pair[0], value = pair[1], unit = null;
-
-      if (value.parseColor('#zzzzzz') != '#zzzzzz') {
-        value = value.parseColor();
-        unit  = 'color';
-      } else if (property == 'opacity') {
-        value = parseFloat(value);
-        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
-          this.element.setStyle({zoom: 1});
-      } else if (Element.CSS_LENGTH.test(value)) {
-          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
-          value = parseFloat(components[1]);
-          unit = (components.length == 3) ? components[2] : null;
-      }
-
-      var originalValue = this.element.getStyle(property);
-      return { 
-        style: property.camelize(), 
-        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
-        targetValue: unit=='color' ? parseColor(value) : value,
-        unit: unit
-      };
-    }.bind(this)).reject(function(transform){
-      return (
-        (transform.originalValue == transform.targetValue) ||
-        (
-          transform.unit != 'color' &&
-          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
-        )
-      )
-    });
-  },
-  update: function(position) {
-    var style = { }, transform, i = this.transforms.length;
-    while(i--)
-      style[(transform = this.transforms[i]).style] = 
-        transform.unit=='color' ? '#'+
-          (Math.round(transform.originalValue[0]+
-            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
-          (Math.round(transform.originalValue[1]+
-            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
-          (Math.round(transform.originalValue[2]+
-            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
-        (transform.originalValue +
-          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
-            (transform.unit === null ? '' : transform.unit);
-    this.element.setStyle(style, true);
-  }
-});
-
-Effect.Transform = Class.create({
-  initialize: function(tracks){
-    this.tracks  = [];
-    this.options = arguments[1] || { };
-    this.addTracks(tracks);
-  },
-  addTracks: function(tracks){
-    tracks.each(function(track){
-      track = $H(track);
-      var data = track.values().first();
-      this.tracks.push($H({
-        ids:     track.keys().first(),
-        effect:  Effect.Morph,
-        options: { style: data }
-      }));
-    }.bind(this));
-    return this;
-  },
-  play: function(){
-    return new Effect.Parallel(
-      this.tracks.map(function(track){
-        var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
-        var elements = [$(ids) || $$(ids)].flatten();
-        return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
-      }).flatten(),
-      this.options
-    );
-  }
-});
-
-Element.CSS_PROPERTIES = $w(
-  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
-  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
-  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
-  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
-  'fontSize fontWeight height left letterSpacing lineHeight ' +
-  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
-  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
-  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
-  'right textIndent top width wordSpacing zIndex');
-  
-Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
-
-String.__parseStyleElement = document.createElement('div');
-String.prototype.parseStyle = function(){
-  var style, styleRules = $H();
-  if (Prototype.Browser.WebKit)
-    style = new Element('div',{style:this}).style;
-  else {
-    String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
-    style = String.__parseStyleElement.childNodes[0].style;
-  }
-  
-  Element.CSS_PROPERTIES.each(function(property){
-    if (style[property]) styleRules.set(property, style[property]); 
-  });
-  
-  if (Prototype.Browser.IE && this.include('opacity'))
-    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
-
-  return styleRules;
-};
-
-if (document.defaultView && document.defaultView.getComputedStyle) {
-  Element.getStyles = function(element) {
-    var css = document.defaultView.getComputedStyle($(element), null);
-    return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
-      styles[property] = css[property];
-      return styles;
-    });
-  };
-} else {
-  Element.getStyles = function(element) {
-    element = $(element);
-    var css = element.currentStyle, styles;
-    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
-      results[property] = css[property];
-      return results;
-    });
-    if (!styles.opacity) styles.opacity = element.getOpacity();
-    return styles;
-  };
-};
-
-Effect.Methods = {
-  morph: function(element, style) {
-    element = $(element);
-    new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
-    return element;
-  },
-  visualEffect: function(element, effect, options) {
-    element = $(element)
-    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
-    new Effect[klass](element, options);
-    return element;
-  },
-  highlight: function(element, options) {
-    element = $(element);
-    new Effect.Highlight(element, options);
-    return element;
-  }
-};
-
-$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
-  'pulsate shake puff squish switchOff dropOut').each(
-  function(effect) { 
-    Effect.Methods[effect] = function(element, options){
-      element = $(element);
-      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
-      return element;
-    }
-  }
-);
-
-$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
-  function(f) { Effect.Methods[f] = Element[f]; }
-);
-
-Element.addMethods(Effect.Methods);

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/scriptaculous.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/scriptaculous.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/scriptaculous.js
deleted file mode 100755
index 6d5a6ee..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/scriptaculous.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-var Scriptaculous = {
-  Version: '1.8.1',
-  require: function(libraryName) {
-    // inserting via DOM fails in Safari 2.0, so brute force approach
-    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
-  },
-  REQUIRED_PROTOTYPE: '1.6.0',
-  load: function() {
-    function convertVersionString(versionString){
-      var r = versionString.split('.');
-      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
-    }
- 
-    if((typeof Prototype=='undefined') || 
-       (typeof Element == 'undefined') || 
-       (typeof Element.Methods=='undefined') ||
-       (convertVersionString(Prototype.Version) < 
-        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
-       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
-        Scriptaculous.REQUIRED_PROTOTYPE);
-    
-    $A(document.getElementsByTagName("script")).findAll( function(s) {
-      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
-    }).each( function(s) {
-      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
-      var includes = s.src.match(/\?.*load=([a-z,]*)/);
-      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
-       function(include) { Scriptaculous.require(path+include+'.js') });
-    });
-  }
-}
-
-Scriptaculous.load();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/slider.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/slider.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/slider.js
deleted file mode 100755
index 1279f94..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/slider.js
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-if (!Control) var Control = { };
-
-// options:
-//  axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-//  onChange(value)
-//  onSlide(value)
-Control.Slider = Class.create({
-  initialize: function(handle, track, options) {
-    var slider = this;
-    
-    if (Object.isArray(handle)) {
-      this.handles = handle.collect( function(e) { return $(e) });
-    } else {
-      this.handles = [$(handle)];
-    }
-    
-    this.track   = $(track);
-    this.options = options || { };
-
-    this.axis      = this.options.axis || 'horizontal';
-    this.increment = this.options.increment || 1;
-    this.step      = parseInt(this.options.step || '1');
-    this.range     = this.options.range || $R(0,1);
-    
-    this.value     = 0; // assure backwards compat
-    this.values    = this.handles.map( function() { return 0 });
-    this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
-    this.options.startSpan = $(this.options.startSpan || null);
-    this.options.endSpan   = $(this.options.endSpan || null);
-
-    this.restricted = this.options.restricted || false;
-
-    this.maximum   = this.options.maximum || this.range.end;
-    this.minimum   = this.options.minimum || this.range.start;
-
-    // Will be used to align the handle onto the track, if necessary
-    this.alignX = parseInt(this.options.alignX || '0');
-    this.alignY = parseInt(this.options.alignY || '0');
-    
-    this.trackLength = this.maximumOffset() - this.minimumOffset();
-
-    this.handleLength = this.isVertical() ? 
-      (this.handles[0].offsetHeight != 0 ? 
-        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 
-      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 
-        this.handles[0].style.width.replace(/px$/,""));
-
-    this.active   = false;
-    this.dragging = false;
-    this.disabled = false;
-
-    if (this.options.disabled) this.setDisabled();
-
-    // Allowed values array
-    this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
-    if (this.allowedValues) {
-      this.minimum = this.allowedValues.min();
-      this.maximum = this.allowedValues.max();
-    }
-
-    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
-    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
-    this.eventMouseMove = this.update.bindAsEventListener(this);
-
-    // Initialize handles in reverse (make sure first handle is active)
-    this.handles.each( function(h,i) {
-      i = slider.handles.length-1-i;
-      slider.setValue(parseFloat(
-        (Object.isArray(slider.options.sliderValue) ? 
-          slider.options.sliderValue[i] : slider.options.sliderValue) || 
-         slider.range.start), i);
-      h.makePositioned().observe("mousedown", slider.eventMouseDown);
-    });
-    
-    this.track.observe("mousedown", this.eventMouseDown);
-    document.observe("mouseup", this.eventMouseUp);
-    document.observe("mousemove", this.eventMouseMove);
-    
-    this.initialized = true;
-  },
-  dispose: function() {
-    var slider = this;    
-    Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
-    Event.stopObserving(document, "mouseup", this.eventMouseUp);
-    Event.stopObserving(document, "mousemove", this.eventMouseMove);
-    this.handles.each( function(h) {
-      Event.stopObserving(h, "mousedown", slider.eventMouseDown);
-    });
-  },
-  setDisabled: function(){
-    this.disabled = true;
-  },
-  setEnabled: function(){
-    this.disabled = false;
-  },  
-  getNearestValue: function(value){
-    if (this.allowedValues){
-      if (value >= this.allowedValues.max()) return(this.allowedValues.max());
-      if (value <= this.allowedValues.min()) return(this.allowedValues.min());
-      
-      var offset = Math.abs(this.allowedValues[0] - value);
-      var newValue = this.allowedValues[0];
-      this.allowedValues.each( function(v) {
-        var currentOffset = Math.abs(v - value);
-        if (currentOffset <= offset){
-          newValue = v;
-          offset = currentOffset;
-        } 
-      });
-      return newValue;
-    }
-    if (value > this.range.end) return this.range.end;
-    if (value < this.range.start) return this.range.start;
-    return value;
-  },
-  setValue: function(sliderValue, handleIdx){
-    if (!this.active) {
-      this.activeHandleIdx = handleIdx || 0;
-      this.activeHandle    = this.handles[this.activeHandleIdx];
-      this.updateStyles();
-    }
-    handleIdx = handleIdx || this.activeHandleIdx || 0;
-    if (this.initialized && this.restricted) {
-      if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
-        sliderValue = this.values[handleIdx-1];
-      if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
-        sliderValue = this.values[handleIdx+1];
-    }
-    sliderValue = this.getNearestValue(sliderValue);
-    this.values[handleIdx] = sliderValue;
-    this.value = this.values[0]; // assure backwards compat
-    
-    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
-      this.translateToPx(sliderValue);
-    
-    this.drawSpans();
-    if (!this.dragging || !this.event) this.updateFinished();
-  },
-  setValueBy: function(delta, handleIdx) {
-    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 
-      handleIdx || this.activeHandleIdx || 0);
-  },
-  translateToPx: function(value) {
-    return Math.round(
-      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 
-      (value - this.range.start)) + "px";
-  },
-  translateToValue: function(offset) {
-    return ((offset/(this.trackLength-this.handleLength) * 
-      (this.range.end-this.range.start)) + this.range.start);
-  },
-  getRange: function(range) {
-    var v = this.values.sortBy(Prototype.K); 
-    range = range || 0;
-    return $R(v[range],v[range+1]);
-  },
-  minimumOffset: function(){
-    return(this.isVertical() ? this.alignY : this.alignX);
-  },
-  maximumOffset: function(){
-    return(this.isVertical() ? 
-      (this.track.offsetHeight != 0 ? this.track.offsetHeight :
-        this.track.style.height.replace(/px$/,"")) - this.alignY : 
-      (this.track.offsetWidth != 0 ? this.track.offsetWidth : 
-        this.track.style.width.replace(/px$/,"")) - this.alignX);
-  },  
-  isVertical:  function(){
-    return (this.axis == 'vertical');
-  },
-  drawSpans: function() {
-    var slider = this;
-    if (this.spans)
-      $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
-    if (this.options.startSpan)
-      this.setSpan(this.options.startSpan,
-        $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
-    if (this.options.endSpan)
-      this.setSpan(this.options.endSpan, 
-        $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
-  },
-  setSpan: function(span, range) {
-    if (this.isVertical()) {
-      span.style.top = this.translateToPx(range.start);
-      span.style.height = this.translateToPx(range.end - range.start + this.range.start);
-    } else {
-      span.style.left = this.translateToPx(range.start);
-      span.style.width = this.translateToPx(range.end - range.start + this.range.start);
-    }
-  },
-  updateStyles: function() {
-    this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
-    Element.addClassName(this.activeHandle, 'selected');
-  },
-  startDrag: function(event) {
-    if (Event.isLeftClick(event)) {
-      if (!this.disabled){
-        this.active = true;
-        
-        var handle = Event.element(event);
-        var pointer  = [Event.pointerX(event), Event.pointerY(event)];
-        var track = handle;
-        if (track==this.track) {
-          var offsets  = Position.cumulativeOffset(this.track); 
-          this.event = event;
-          this.setValue(this.translateToValue( 
-           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
-          ));
-          var offsets  = Position.cumulativeOffset(this.activeHandle);
-          this.offsetX = (pointer[0] - offsets[0]);
-          this.offsetY = (pointer[1] - offsets[1]);
-        } else {
-          // find the handle (prevents issues with Safari)
-          while((this.handles.indexOf(handle) == -1) && handle.parentNode) 
-            handle = handle.parentNode;
-            
-          if (this.handles.indexOf(handle)!=-1) {
-            this.activeHandle    = handle;
-            this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
-            this.updateStyles();
-            
-            var offsets  = Position.cumulativeOffset(this.activeHandle);
-            this.offsetX = (pointer[0] - offsets[0]);
-            this.offsetY = (pointer[1] - offsets[1]);
-          }
-        }
-      }
-      Event.stop(event);
-    }
-  },
-  update: function(event) {
-   if (this.active) {
-      if (!this.dragging) this.dragging = true;
-      this.draw(event);
-      if (Prototype.Browser.WebKit) window.scrollBy(0,0);
-      Event.stop(event);
-   }
-  },
-  draw: function(event) {
-    var pointer = [Event.pointerX(event), Event.pointerY(event)];
-    var offsets = Position.cumulativeOffset(this.track);
-    pointer[0] -= this.offsetX + offsets[0];
-    pointer[1] -= this.offsetY + offsets[1];
-    this.event = event;
-    this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
-    if (this.initialized && this.options.onSlide)
-      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
-  },
-  endDrag: function(event) {
-    if (this.active && this.dragging) {
-      this.finishDrag(event, true);
-      Event.stop(event);
-    }
-    this.active = false;
-    this.dragging = false;
-  },  
-  finishDrag: function(event, success) {
-    this.active = false;
-    this.dragging = false;
-    this.updateFinished();
-  },
-  updateFinished: function() {
-    if (this.initialized && this.options.onChange) 
-      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
-    this.event = null;
-  }
-});

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/sound.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/sound.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/sound.js
deleted file mode 100755
index 4d1b027..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/sound.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-Sound = {
-  tracks: {},
-  _enabled: true,
-  template:
-    new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
-  enable: function(){
-    Sound._enabled = true;
-  },
-  disable: function(){
-    Sound._enabled = false;
-  },
-  play: function(url){
-    if(!Sound._enabled) return;
-    var options = Object.extend({
-      track: 'global', url: url, replace: false
-    }, arguments[1] || {});
-    
-    if(options.replace && this.tracks[options.track]) {
-      $R(0, this.tracks[options.track].id).each(function(id){
-        var sound = $('sound_'+options.track+'_'+id);
-        sound.Stop && sound.Stop();
-        sound.remove();
-      })
-      this.tracks[options.track] = null;
-    }
-      
-    if(!this.tracks[options.track])
-      this.tracks[options.track] = { id: 0 }
-    else
-      this.tracks[options.track].id++;
-      
-    options.id = this.tracks[options.track].id;
-    $$('body')[0].insert( 
-      Prototype.Browser.IE ? new Element('bgsound',{
-        id: 'sound_'+options.track+'_'+options.id,
-        src: options.url, loop: 1, autostart: true
-      }) : Sound.template.evaluate(options));
-  }
-};
-
-if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
-  if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
-    Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
-  else
-    Sound.play = function(){}
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/unittest.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/unittest.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/unittest.js
deleted file mode 100755
index e40149c..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/unittest.js
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us unittest.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-// experimental, Firefox-only
-Event.simulateMouse = function(element, eventName) {
-  var options = Object.extend({
-    pointerX: 0,
-    pointerY: 0,
-    buttons:  0,
-    ctrlKey:  false,
-    altKey:   false,
-    shiftKey: false,
-    metaKey:  false
-  }, arguments[2] || {});
-  var oEvent = document.createEvent("MouseEvents");
-  oEvent.initMouseEvent(eventName, true, true, document.defaultView, 
-    options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, 
-    options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element));
-  
-  if(this.mark) Element.remove(this.mark);
-  this.mark = document.createElement('div');
-  this.mark.appendChild(document.createTextNode(" "));
-  document.body.appendChild(this.mark);
-  this.mark.style.position = 'absolute';
-  this.mark.style.top = options.pointerY + "px";
-  this.mark.style.left = options.pointerX + "px";
-  this.mark.style.width = "5px";
-  this.mark.style.height = "5px;";
-  this.mark.style.borderTop = "1px solid red;"
-  this.mark.style.borderLeft = "1px solid red;"
-  
-  if(this.step)
-    alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
-  
-  $(element).dispatchEvent(oEvent);
-};
-
-// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
-// You need to downgrade to 1.0.4 for now to get this working
-// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
-Event.simulateKey = function(element, eventName) {
-  var options = Object.extend({
-    ctrlKey: false,
-    altKey: false,
-    shiftKey: false,
-    metaKey: false,
-    keyCode: 0,
-    charCode: 0
-  }, arguments[2] || {});
-
-  var oEvent = document.createEvent("KeyEvents");
-  oEvent.initKeyEvent(eventName, true, true, window, 
-    options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
-    options.keyCode, options.charCode );
-  $(element).dispatchEvent(oEvent);
-};
-
-Event.simulateKeys = function(element, command) {
-  for(var i=0; i<command.length; i++) {
-    Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
-  }
-};
-
-var Test = {}
-Test.Unit = {};
-
-// security exception workaround
-Test.Unit.inspect = Object.inspect;
-
-Test.Unit.Logger = Class.create();
-Test.Unit.Logger.prototype = {
-  initialize: function(log) {
-    this.log = $(log);
-    if (this.log) {
-      this._createLogTable();
-    }
-  },
-  start: function(testName) {
-    if (!this.log) return;
-    this.testName = testName;
-    this.lastLogLine = document.createElement('tr');
-    this.statusCell = document.createElement('td');
-    this.nameCell = document.createElement('td');
-    this.nameCell.className = "nameCell";
-    this.nameCell.appendChild(document.createTextNode(testName));
-    this.messageCell = document.createElement('td');
-    this.lastLogLine.appendChild(this.statusCell);
-    this.lastLogLine.appendChild(this.nameCell);
-    this.lastLogLine.appendChild(this.messageCell);
-    this.loglines.appendChild(this.lastLogLine);
-  },
-  finish: function(status, summary) {
-    if (!this.log) return;
-    this.lastLogLine.className = status;
-    this.statusCell.innerHTML = status;
-    this.messageCell.innerHTML = this._toHTML(summary);
-    this.addLinksToResults();
-  },
-  message: function(message) {
-    if (!this.log) return;
-    this.messageCell.innerHTML = this._toHTML(message);
-  },
-  summary: function(summary) {
-    if (!this.log) return;
-    this.logsummary.innerHTML = this._toHTML(summary);
-  },
-  _createLogTable: function() {
-    this.log.innerHTML =
-    '<div id="logsummary"></div>' +
-    '<table id="logtable">' +
-    '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
-    '<tbody id="loglines"></tbody>' +
-    '</table>';
-    this.logsummary = $('logsummary')
-    this.loglines = $('loglines');
-  },
-  _toHTML: function(txt) {
-    return txt.escapeHTML().replace(/\n/g,"<br/>");
-  },
-  addLinksToResults: function(){ 
-    $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
-      td.title = "Run only this test"
-      Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
-    });
-    $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
-      td.title = "Run all tests"
-      Event.observe(td, 'click', function(){ window.location.search = "";});
-    });
-  }
-}
-
-Test.Unit.Runner = Class.create();
-Test.Unit.Runner.prototype = {
-  initialize: function(testcases) {
-    this.options = Object.extend({
-      testLog: 'testlog'
-    }, arguments[1] || {});
-    this.options.resultsURL = this.parseResultsURLQueryParameter();
-    this.options.tests      = this.parseTestsQueryParameter();
-    if (this.options.testLog) {
-      this.options.testLog = $(this.options.testLog) || null;
-    }
-    if(this.options.tests) {
-      this.tests = [];
-      for(var i = 0; i < this.options.tests.length; i++) {
-        if(/^test/.test(this.options.tests[i])) {
-          this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
-        }
-      }
-    } else {
-      if (this.options.test) {
-        this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
-      } else {
-        this.tests = [];
-        for(var testcase in testcases) {
-          if(/^test/.test(testcase)) {
-            this.tests.push(
-               new Test.Unit.Testcase(
-                 this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, 
-                 testcases[testcase], testcases["setup"], testcases["teardown"]
-               ));
-          }
-        }
-      }
-    }
-    this.currentTest = 0;
-    this.logger = new Test.Unit.Logger(this.options.testLog);
-    setTimeout(this.runTests.bind(this), 1000);
-  },
-  parseResultsURLQueryParameter: function() {
-    return window.location.search.parseQuery()["resultsURL"];
-  },
-  parseTestsQueryParameter: function(){
-    if (window.location.search.parseQuery()["tests"]){
-        return window.location.search.parseQuery()["tests"].split(',');
-    };
-  },
-  // Returns:
-  //  "ERROR" if there was an error,
-  //  "FAILURE" if there was a failure, or
-  //  "SUCCESS" if there was neither
-  getResult: function() {
-    var hasFailure = false;
-    for(var i=0;i<this.tests.length;i++) {
-      if (this.tests[i].errors > 0) {
-        return "ERROR";
-      }
-      if (this.tests[i].failures > 0) {
-        hasFailure = true;
-      }
-    }
-    if (hasFailure) {
-      return "FAILURE";
-    } else {
-      return "SUCCESS";
-    }
-  },
-  postResults: function() {
-    if (this.options.resultsURL) {
-      new Ajax.Request(this.options.resultsURL, 
-        { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
-    }
-  },
-  runTests: function() {
-    var test = this.tests[this.currentTest];
-    if (!test) {
-      // finished!
-      this.postResults();
-      this.logger.summary(this.summary());
-      return;
-    }
-    if(!test.isWaiting) {
-      this.logger.start(test.name);
-    }
-    test.run();
-    if(test.isWaiting) {
-      this.logger.message("Waiting for " + test.timeToWait + "ms");
-      setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
-    } else {
-      this.logger.finish(test.status(), test.summary());
-      this.currentTest++;
-      // tail recursive, hopefully the browser will skip the stackframe
-      this.runTests();
-    }
-  },
-  summary: function() {
-    var assertions = 0;
-    var failures = 0;
-    var errors = 0;
-    var messages = [];
-    for(var i=0;i<this.tests.length;i++) {
-      assertions +=   this.tests[i].assertions;
-      failures   +=   this.tests[i].failures;
-      errors     +=   this.tests[i].errors;
-    }
-    return (
-      (this.options.context ? this.options.context + ': ': '') + 
-      this.tests.length + " tests, " + 
-      assertions + " assertions, " + 
-      failures   + " failures, " +
-      errors     + " errors");
-  }
-}
-
-Test.Unit.Assertions = Class.create();
-Test.Unit.Assertions.prototype = {
-  initialize: function() {
-    this.assertions = 0;
-    this.failures   = 0;
-    this.errors     = 0;
-    this.messages   = [];
-  },
-  summary: function() {
-    return (
-      this.assertions + " assertions, " + 
-      this.failures   + " failures, " +
-      this.errors     + " errors" + "\n" +
-      this.messages.join("\n"));
-  },
-  pass: function() {
-    this.assertions++;
-  },
-  fail: function(message) {
-    this.failures++;
-    this.messages.push("Failure: " + message);
-  },
-  info: function(message) {
-    this.messages.push("Info: " + message);
-  },
-  error: function(error) {
-    this.errors++;
-    this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
-  },
-  status: function() {
-    if (this.failures > 0) return 'failed';
-    if (this.errors > 0) return 'error';
-    return 'passed';
-  },
-  assert: function(expression) {
-    var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
-    try { expression ? this.pass() : 
-      this.fail(message); }
-    catch(e) { this.error(e); }
-  },
-  assertEqual: function(expected, actual) {
-    var message = arguments[2] || "assertEqual";
-    try { (expected == actual) ? this.pass() :
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) + 
-        '", actual "' + Test.Unit.inspect(actual) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertInspect: function(expected, actual) {
-    var message = arguments[2] || "assertInspect";
-    try { (expected == actual.inspect()) ? this.pass() :
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) + 
-        '", actual "' + Test.Unit.inspect(actual) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertEnumEqual: function(expected, actual) {
-    var message = arguments[2] || "assertEnumEqual";
-    try { $A(expected).length == $A(actual).length && 
-      expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ?
-        this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + 
-          ', actual ' + Test.Unit.inspect(actual)); }
-    catch(e) { this.error(e); }
-  },
-  assertNotEqual: function(expected, actual) {
-    var message = arguments[2] || "assertNotEqual";
-    try { (expected != actual) ? this.pass() : 
-      this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertIdentical: function(expected, actual) { 
-    var message = arguments[2] || "assertIdentical"; 
-    try { (expected === actual) ? this.pass() : 
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
-        '", actual "' + Test.Unit.inspect(actual) + '"'); } 
-    catch(e) { this.error(e); } 
-  },
-  assertNotIdentical: function(expected, actual) { 
-    var message = arguments[2] || "assertNotIdentical"; 
-    try { !(expected === actual) ? this.pass() : 
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
-        '", actual "' + Test.Unit.inspect(actual) + '"'); } 
-    catch(e) { this.error(e); } 
-  },
-  assertNull: function(obj) {
-    var message = arguments[1] || 'assertNull'
-    try { (obj==null) ? this.pass() : 
-      this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertMatch: function(expected, actual) {
-    var message = arguments[2] || 'assertMatch';
-    var regex = new RegExp(expected);
-    try { (regex.exec(actual)) ? this.pass() :
-      this.fail(message + ' : regex: "' +  Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertHidden: function(element) {
-    var message = arguments[1] || 'assertHidden';
-    this.assertEqual("none", element.style.display, message);
-  },
-  assertNotNull: function(object) {
-    var message = arguments[1] || 'assertNotNull';
-    this.assert(object != null, message);
-  },
-  assertType: function(expected, actual) {
-    var message = arguments[2] || 'assertType';
-    try { 
-      (actual.constructor == expected) ? this.pass() : 
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
-        '", actual "' + (actual.constructor) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertNotOfType: function(expected, actual) {
-    var message = arguments[2] || 'assertNotOfType';
-    try { 
-      (actual.constructor != expected) ? this.pass() : 
-      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
-        '", actual "' + (actual.constructor) + '"'); }
-    catch(e) { this.error(e); }
-  },
-  assertInstanceOf: function(expected, actual) {
-    var message = arguments[2] || 'assertInstanceOf';
-    try { 
-      (actual instanceof expected) ? this.pass() : 
-      this.fail(message + ": object was not an instance of the expected type"); }
-    catch(e) { this.error(e); } 
-  },
-  assertNotInstanceOf: function(expected, actual) {
-    var message = arguments[2] || 'assertNotInstanceOf';
-    try { 
-      !(actual instanceof expected) ? this.pass() : 
-      this.fail(message + ": object was an instance of the not expected type"); }
-    catch(e) { this.error(e); } 
-  },
-  assertRespondsTo: function(method, obj) {
-    var message = arguments[2] || 'assertRespondsTo';
-    try {
-      (obj[method] && typeof obj[method] == 'function') ? this.pass() : 
-      this.fail(message + ": object doesn't respond to [" + method + "]"); }
-    catch(e) { this.error(e); }
-  },
-  assertReturnsTrue: function(method, obj) {
-    var message = arguments[2] || 'assertReturnsTrue';
-    try {
-      var m = obj[method];
-      if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
-      m() ? this.pass() : 
-      this.fail(message + ": method returned false"); }
-    catch(e) { this.error(e); }
-  },
-  assertReturnsFalse: function(method, obj) {
-    var message = arguments[2] || 'assertReturnsFalse';
-    try {
-      var m = obj[method];
-      if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
-      !m() ? this.pass() : 
-      this.fail(message + ": method returned true"); }
-    catch(e) { this.error(e); }
-  },
-  assertRaise: function(exceptionName, method) {
-    var message = arguments[2] || 'assertRaise';
-    try { 
-      method();
-      this.fail(message + ": exception expected but none was raised"); }
-    catch(e) {
-      ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); 
-    }
-  },
-  assertElementsMatch: function() {
-    var expressions = $A(arguments), elements = $A(expressions.shift());
-    if (elements.length != expressions.length) {
-      this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions');
-      return false;
-    }
-    elements.zip(expressions).all(function(pair, index) {
-      var element = $(pair.first()), expression = pair.last();
-      if (element.match(expression)) return true;
-      this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect());
-    }.bind(this)) && this.pass();
-  },
-  assertElementMatches: function(element, expression) {
-    this.assertElementsMatch([element], expression);
-  },
-  benchmark: function(operation, iterations) {
-    var startAt = new Date();
-    (iterations || 1).times(operation);
-    var timeTaken = ((new Date())-startAt);
-    this.info((arguments[2] || 'Operation') + ' finished ' + 
-       iterations + ' iterations in ' + (timeTaken/1000)+'s' );
-    return timeTaken;
-  },
-  _isVisible: function(element) {
-    element = $(element);
-    if(!element.parentNode) return true;
-    this.assertNotNull(element);
-    if(element.style && Element.getStyle(element, 'display') == 'none')
-      return false;
-    
-    return this._isVisible(element.parentNode);
-  },
-  assertNotVisible: function(element) {
-    this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
-  },
-  assertVisible: function(element) {
-    this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
-  },
-  benchmark: function(operation, iterations) {
-    var startAt = new Date();
-    (iterations || 1).times(operation);
-    var timeTaken = ((new Date())-startAt);
-    this.info((arguments[2] || 'Operation') + ' finished ' + 
-       iterations + ' iterations in ' + (timeTaken/1000)+'s' );
-    return timeTaken;
-  }
-}
-
-Test.Unit.Testcase = Class.create();
-Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
-  initialize: function(name, test, setup, teardown) {
-    Test.Unit.Assertions.prototype.initialize.bind(this)();
-    this.name           = name;
-    
-    if(typeof test == 'string') {
-      test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,');
-      test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)');
-      this.test = function() {
-        eval('with(this){'+test+'}');
-      }
-    } else {
-      this.test = test || function() {};
-    }
-    
-    this.setup          = setup || function() {};
-    this.teardown       = teardown || function() {};
-    this.isWaiting      = false;
-    this.timeToWait     = 1000;
-  },
-  wait: function(time, nextPart) {
-    this.isWaiting = true;
-    this.test = nextPart;
-    this.timeToWait = time;
-  },
-  run: function() {
-    try {
-      try {
-        if (!this.isWaiting) this.setup.bind(this)();
-        this.isWaiting = false;
-        this.test.bind(this)();
-      } finally {
-        if(!this.isWaiting) {
-          this.teardown.bind(this)();
-        }
-      }
-    }
-    catch(e) { this.error(e); }
-  }
-});
-
-// *EXPERIMENTAL* BDD-style testing to please non-technical folk
-// This draws many ideas from RSpec http://rspec.rubyforge.org/
-
-Test.setupBDDExtensionMethods = function(){
-  var METHODMAP = {
-    shouldEqual:     'assertEqual',
-    shouldNotEqual:  'assertNotEqual',
-    shouldEqualEnum: 'assertEnumEqual',
-    shouldBeA:       'assertType',
-    shouldNotBeA:    'assertNotOfType',
-    shouldBeAn:      'assertType',
-    shouldNotBeAn:   'assertNotOfType',
-    shouldBeNull:    'assertNull',
-    shouldNotBeNull: 'assertNotNull',
-    
-    shouldBe:        'assertReturnsTrue',
-    shouldNotBe:     'assertReturnsFalse',
-    shouldRespondTo: 'assertRespondsTo'
-  };
-  var makeAssertion = function(assertion, args, object) { 
-   	this[assertion].apply(this,(args || []).concat([object]));
-  }
-  
-  Test.BDDMethods = {};   
-  $H(METHODMAP).each(function(pair) { 
-    Test.BDDMethods[pair.key] = function() { 
-       var args = $A(arguments); 
-       var scope = args.shift(); 
-       makeAssertion.apply(scope, [pair.value, args, this]); }; 
-  });
-  
-  [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
-    function(p){ Object.extend(p, Test.BDDMethods) }
-  );
-}
-
-Test.context = function(name, spec, log){
-  Test.setupBDDExtensionMethods();
-  
-  var compiledSpec = {};
-  var titles = {};
-  for(specName in spec) {
-    switch(specName){
-      case "setup":
-      case "teardown":
-        compiledSpec[specName] = spec[specName];
-        break;
-      default:
-        var testName = 'test'+specName.gsub(/\s+/,'-').camelize();
-        var body = spec[specName].toString().split('\n').slice(1);
-        if(/^\{/.test(body[0])) body = body.slice(1);
-        body.pop();
-        body = body.map(function(statement){ 
-          return statement.strip()
-        });
-        compiledSpec[testName] = body.join('\n');
-        titles[testName] = specName;
-    }
-  }
-  new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name });
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.html b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.html
deleted file mode 100755
index bc2b2c2..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/snorql.html
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <!--###BEGIN_HEAD###-->
-    <title>Snorql: A SPARQL Explorer</title>
-    <link rel="stylesheet" type="text/css" href="style.css" />
-    <link rel="stylesheet" href="../../cm/codemirror.css" />
-    <link rel="stylesheet" href="../../cm/simple-hint.css" />
-    <style type="text/css">
-        .CodeMirror {
-            background-color: #fff;
-        }
-    </style>
-    <!--###END_HEAD###-->
-</head>
-
-<body>
-<!--###BEGIN_CONTENT###-->
-<h1>SPARQL Query Form</h1>
-
-<p id="title">Query</p>
-
-<div class="snorql">    
-
-    <div class="section" style="float: right; width: 8em">
-        <h2 style="color:#464646;font-size:18px">Browse:</h2>
-        <ul style="margin:10px 0 0;list-style:none;padding:0;font-size:12px; font-family: Courier;">
-            <li><a class="graph-link" href="?browse=classes">Classes</a></li>
-            <li><a class="graph-link" href="?browse=properties">Properties</a></li>
-            <li id="browse-named-graphs-link"><a href="?browse=graphs">Named Graphs</a></li>
-        </ul>
-    </div>
-
-    <div id="default-graph-section" class="section" style="margin-right: 12em">
-        <h2 style="display: inline;color:#464646;font-size:18px">GRAPH:</h2>
-        <p style="display: inline">
-            Default graph.
-            <a href="?browse=graphs">List named graphs</a>
-        </p>
-    </div>
-
-    <div id="named-graph-section" class="section" style="margin-right: 12em">
-        <h2 style="display: inline;font-size:18px;color:#464646;">GRAPH:</h2>
-        <p style="display: inline">
-            <span id="selected-named-graph">Named graph goes here</span>.
-            <a href="javascript:snorql.switchToDefaultGraph()">Switch back to default graph</a>
-        </p>
-    </div>
-
-    <div class="section">
-        <pre id="prefixestext"></pre>
-        <form id="queryform" action="#" method="get">
-          <div>
-            <input type="hidden" name="prefixes" value="" id="prefixes" />
-            <input type="hidden" name="query" value="" id="query" />
-            <input type="hidden" name="output" value="json" id="jsonoutput" disabled="disabled" />
-            <input type="hidden" name="stylesheet" value="" id="stylesheet" disabled="disabled" />
-            <input type="hidden" name="graph" value="" id="graph-uri" disabled="disabled" />
-          </div>
-        </form>
-        <div>
-            <textarea name="query" rows="9" cols="80" id="querytext"></textarea>
-            <span style="color:#464646;">Results:</span>
-            <select id="selectoutput" onchange="snorql.updateOutputMode()">
-                <option selected="selected" value="browse">Browse</option>
-                <option value="json">as JSON</option>
-                <option value="xml">as XML</option>
-                <option value="html">as HTML</option>
-                <option value="csv">as CSV</option>
-            </select>
-        <span id="xsltcontainer"><span id="xsltinput">
-          XSLT stylesheet URL:
-          <input id="xsltstylesheet" type="text" value="snorql/xml-to-html.xsl" size="30" />
-        </span></span>
-            <input type="button" value="Go!" onclick="editor.save(); snorql.submitQuery()" />
-        </div>
-    </div>
-
-    <div class="section">
-        <div id="result"><span></span></div>
-    </div>
-
-    <!-- <div id="footer_snorql">Powered by <a id="poweredby" href="#">Snorql</a></div>  -->
-    
-    <script type="text/javascript" src="prototype.js"></script>
-    <script type="text/javascript" src="scriptaculous/scriptaculous.js"></script>
-    <script type="text/javascript" src="../../../core/public/js/lib/jquery-1.7.2.js"></script>
-    <script type="text/javascript">
-        jQuery.noConflict();
-    </script>
-
-    <script type="text/javascript" src="sparql.js"></script>
-    <script type="text/javascript" src="namespaces.js"></script>
-    <script type="text/javascript" src="snorql.js"></script>
-    <script type="text/javascript" src="../../cm/codemirror.js"></script>
-    <script type="text/javascript" src="../../cm/simple-hint.js"></script>
-    <script type="text/javascript" src="../../cm/sparql.js"></script>
-    <script type="text/javascript">
-        var editor;
-        jQuery(document).ready(function(){
-            jQuery("#querytext").addClass("editor_cm");
-
-            snorql.start();
-
-            editor = CodeMirror.fromTextArea(document.getElementById("querytext"),{
-                lineNumbers : true,
-                matchBrackets : true,
-                tabMode: "indent",
-                extraKeys: {"Ctrl-Space": "sparqlAutocomplete"},
-                mode: "application/x-sparql-query",
-                firstLineNumber: Object.keys(D2R_namespacePrefixes).length + 1
-            });
-
-            jQuery.getJSON("../../../prefix", function(data) {
-                var ns = {};
-                jQuery.each(data, function(prefix, namespace) {
-                    ns[prefix] = namespace;
-                });
-                snorql.setNamespaces(ns);
-                editor.setOption("firstLineNumber", Object.keys(ns).length + 1);
-            });   
-            
-        });
-    </script>    
-    
-</div>
-<!--###END_CONTENT###-->
-</body>
-</html>


[03/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.js b/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.js
deleted file mode 100644
index 72609ee..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/codemirror.js
+++ /dev/null
@@ -1,3064 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// CodeMirror version 2.24
-//
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-
-// CodeMirror is the only global var we claim
-var CodeMirror = (function() {
-  // This is the function that produces an editor instance. Its
-  // closure is used to store the editor state.
-  function CodeMirror(place, givenOptions) {
-    // Determine effective options based on given values and defaults.
-    var options = {}, defaults = CodeMirror.defaults;
-    for (var opt in defaults)
-      if (defaults.hasOwnProperty(opt))
-        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
-
-    // The element in which the editor lives.
-    var wrapper = document.createElement("div");
-    wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
-    // This mess creates the base DOM structure for the editor.
-    wrapper.innerHTML =
-      '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea
-        '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' +
-          'autocorrect="off" autocapitalize="off"></textarea></div>' +
-      '<div class="CodeMirror-scroll" tabindex="-1">' +
-        '<div style="position: relative">' + // Set to the height of the text, causes scrolling
-          '<div style="position: relative">' + // Moved around its parent to cover visible view
-            '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
-            // Provides positioning relative to (visible) text origin
-            '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' +
-              '<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div>' +
-              '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
-              '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code
-            '</div></div></div></div></div>';
-    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
-    // I've never seen more elegant code in my life.
-    var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
-        scroller = wrapper.lastChild, code = scroller.firstChild,
-        mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,
-        lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,
-        cursor = measure.nextSibling, selectionDiv = cursor.nextSibling,
-        lineDiv = selectionDiv.nextSibling;
-    themeChanged();
-    // Needed to hide big blue blinking cursor on Mobile Safari
-    if (ios) input.style.width = "0px";
-    if (!webkit) lineSpace.draggable = true;
-    lineSpace.style.outline = "none";
-    if (options.tabindex != null) input.tabIndex = options.tabindex;
-    if (options.autofocus) focusInput();
-    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
-    // Needed to handle Tab key in KHTML
-    if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
-
-    // Check for problem with IE innerHTML not working when we have a
-    // P (or similar) parent node.
-    try { stringWidth("x"); }
-    catch (e) {
-      if (e.message.match(/runtime/i))
-        e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
-      throw e;
-    }
-
-    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
-    var poll = new Delayed(), highlight = new Delayed(), blinker;
-
-    // mode holds a mode API object. doc is the tree of Line objects,
-    // work an array of lines that should be parsed, and history the
-    // undo history (instance of History constructor).
-    var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;
-    loadMode();
-    // The selection. These are always maintained to point at valid
-    // positions. Inverted is used to remember that the user is
-    // selecting bottom-to-top.
-    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
-    // Selection-related flags. shiftSelecting obviously tracks
-    // whether the user is holding shift.
-    var shiftSelecting, lastClick, lastDoubleClick, lastScrollPos = 0, draggingText,
-        overwrite = false, suppressEdits = false;
-    // Variables used by startOperation/endOperation to track what
-    // happened during the operation.
-    var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
-        gutterDirty, callbacks;
-    // Current visible range (may be bigger than the view window).
-    var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
-    // bracketHighlighted is used to remember that a bracket has been
-    // marked.
-    var bracketHighlighted;
-    // Tracks the maximum line length so that the horizontal scrollbar
-    // can be kept static when scrolling.
-    var maxLine = "", maxWidth;
-    var tabCache = {};
-
-    // Initialize the content.
-    operation(function(){setValue(options.value || ""); updateInput = false;})();
-    var history = new History();
-
-    // Register our event handlers.
-    connect(scroller, "mousedown", operation(onMouseDown));
-    connect(scroller, "dblclick", operation(onDoubleClick));
-    connect(lineSpace, "selectstart", e_preventDefault);
-    // Gecko browsers fire contextmenu *after* opening the menu, at
-    // which point we can't mess with it anymore. Context menu is
-    // handled in onMouseDown for Gecko.
-    if (!gecko) connect(scroller, "contextmenu", onContextMenu);
-    connect(scroller, "scroll", function() {
-      lastScrollPos = scroller.scrollTop;
-      updateDisplay([]);
-      if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
-      if (options.onScroll) options.onScroll(instance);
-    });
-    connect(window, "resize", function() {updateDisplay(true);});
-    connect(input, "keyup", operation(onKeyUp));
-    connect(input, "input", fastPoll);
-    connect(input, "keydown", operation(onKeyDown));
-    connect(input, "keypress", operation(onKeyPress));
-    connect(input, "focus", onFocus);
-    connect(input, "blur", onBlur);
-
-    if (options.dragDrop) {
-      connect(lineSpace, "dragstart", onDragStart);
-      function drag_(e) {
-        if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
-        e_stop(e);
-      }
-      connect(scroller, "dragenter", drag_);
-      connect(scroller, "dragover", drag_);
-      connect(scroller, "drop", operation(onDrop));
-    }
-    connect(scroller, "paste", function(){focusInput(); fastPoll();});
-    connect(input, "paste", fastPoll);
-    connect(input, "cut", operation(function(){
-      if (!options.readOnly) replaceSelection("");
-    }));
-
-    // Needed to handle Tab key in KHTML
-    if (khtml) connect(code, "mouseup", function() {
-        if (document.activeElement == input) input.blur();
-        focusInput();
-    });
-
-    // IE throws unspecified error in certain cases, when
-    // trying to access activeElement before onload
-    var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
-    if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
-    else onBlur();
-
-    function isLine(l) {return l >= 0 && l < doc.size;}
-    // The instance object that we'll return. Mostly calls out to
-    // local functions in the CodeMirror function. Some do some extra
-    // range checking and/or clipping. operation is used to wrap the
-    // call so that changes it makes are tracked, and the display is
-    // updated afterwards.
-    var instance = wrapper.CodeMirror = {
-      getValue: getValue,
-      setValue: operation(setValue),
-      getSelection: getSelection,
-      replaceSelection: operation(replaceSelection),
-      focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},
-      setOption: function(option, value) {
-        var oldVal = options[option];
-        options[option] = value;
-        if (option == "mode" || option == "indentUnit") loadMode();
-        else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();}
-        else if (option == "readOnly" && !value) {resetInput(true);}
-        else if (option == "theme") themeChanged();
-        else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
-        else if (option == "tabSize") updateDisplay(true);
-        if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") {
-          gutterChanged();
-          updateDisplay(true);
-        }
-      },
-      getOption: function(option) {return options[option];},
-      undo: operation(undo),
-      redo: operation(redo),
-      indentLine: operation(function(n, dir) {
-        if (typeof dir != "string") {
-          if (dir == null) dir = options.smartIndent ? "smart" : "prev";
-          else dir = dir ? "add" : "subtract";
-        }
-        if (isLine(n)) indentLine(n, dir);
-      }),
-      indentSelection: operation(indentSelected),
-      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
-      clearHistory: function() {history = new History();},
-      matchBrackets: operation(function(){matchBrackets(true);}),
-      getTokenAt: operation(function(pos) {
-        pos = clipPos(pos);
-        return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);
-      }),
-      getStateAfter: function(line) {
-        line = clipLine(line == null ? doc.size - 1: line);
-        return getStateBefore(line + 1);
-      },
-      cursorCoords: function(start, mode) {
-        if (start == null) start = sel.inverted;
-        return this.charCoords(start ? sel.from : sel.to, mode);
-      },
-      charCoords: function(pos, mode) {
-        pos = clipPos(pos);
-        if (mode == "local") return localCoords(pos, false);
-        if (mode == "div") return localCoords(pos, true);
-        return pageCoords(pos);
-      },
-      coordsChar: function(coords) {
-        var off = eltOffset(lineSpace);
-        return coordsChar(coords.x - off.left, coords.y - off.top);
-      },
-      markText: operation(markText),
-      setBookmark: setBookmark,
-      findMarksAt: findMarksAt,
-      setMarker: operation(addGutterMarker),
-      clearMarker: operation(removeGutterMarker),
-      setLineClass: operation(setLineClass),
-      hideLine: operation(function(h) {return setLineHidden(h, true);}),
-      showLine: operation(function(h) {return setLineHidden(h, false);}),
-      onDeleteLine: function(line, f) {
-        if (typeof line == "number") {
-          if (!isLine(line)) return null;
-          line = getLine(line);
-        }
-        (line.handlers || (line.handlers = [])).push(f);
-        return line;
-      },
-      lineInfo: lineInfo,
-      addWidget: function(pos, node, scroll, vert, horiz) {
-        pos = localCoords(clipPos(pos));
-        var top = pos.yBot, left = pos.x;
-        node.style.position = "absolute";
-        code.appendChild(node);
-        if (vert == "over") top = pos.y;
-        else if (vert == "near") {
-          var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),
-              hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
-          if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
-            top = pos.y - node.offsetHeight;
-          if (left + node.offsetWidth > hspace)
-            left = hspace - node.offsetWidth;
-        }
-        node.style.top = (top + paddingTop()) + "px";
-        node.style.left = node.style.right = "";
-        if (horiz == "right") {
-          left = code.clientWidth - node.offsetWidth;
-          node.style.right = "0px";
-        } else {
-          if (horiz == "left") left = 0;
-          else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
-          node.style.left = (left + paddingLeft()) + "px";
-        }
-        if (scroll)
-          scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
-      },
-
-      lineCount: function() {return doc.size;},
-      clipPos: clipPos,
-      getCursor: function(start) {
-        if (start == null) start = sel.inverted;
-        return copyPos(start ? sel.from : sel.to);
-      },
-      somethingSelected: function() {return !posEq(sel.from, sel.to);},
-      setCursor: operation(function(line, ch, user) {
-        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user);
-        else setCursor(line, ch, user);
-      }),
-      setSelection: operation(function(from, to, user) {
-        (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));
-      }),
-      getLine: function(line) {if (isLine(line)) return getLine(line).text;},
-      getLineHandle: function(line) {if (isLine(line)) return getLine(line);},
-      setLine: operation(function(line, text) {
-        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
-      }),
-      removeLine: operation(function(line) {
-        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
-      }),
-      replaceRange: operation(replaceRange),
-      getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
-
-      triggerOnKeyDown: operation(onKeyDown),
-      execCommand: function(cmd) {return commands[cmd](instance);},
-      // Stuff used by commands, probably not much use to outside code.
-      moveH: operation(moveH),
-      deleteH: operation(deleteH),
-      moveV: operation(moveV),
-      toggleOverwrite: function() {
-        if(overwrite){
-          overwrite = false;
-          cursor.className = cursor.className.replace(" CodeMirror-overwrite", "");
-        } else {
-          overwrite = true;
-          cursor.className += " CodeMirror-overwrite";
-        }
-      },
-
-      posFromIndex: function(off) {
-        var lineNo = 0, ch;
-        doc.iter(0, doc.size, function(line) {
-          var sz = line.text.length + 1;
-          if (sz > off) { ch = off; return true; }
-          off -= sz;
-          ++lineNo;
-        });
-        return clipPos({line: lineNo, ch: ch});
-      },
-      indexFromPos: function (coords) {
-        if (coords.line < 0 || coords.ch < 0) return 0;
-        var index = coords.ch;
-        doc.iter(0, coords.line, function (line) {
-          index += line.text.length + 1;
-        });
-        return index;
-      },
-      scrollTo: function(x, y) {
-        if (x != null) scroller.scrollLeft = x;
-        if (y != null) scroller.scrollTop = y;
-        updateDisplay([]);
-      },
-
-      operation: function(f){return operation(f)();},
-      compoundChange: function(f){return compoundChange(f);},
-      refresh: function(){
-        updateDisplay(true);
-        if (scroller.scrollHeight > lastScrollPos)
-          scroller.scrollTop = lastScrollPos;
-      },
-      getInputField: function(){return input;},
-      getWrapperElement: function(){return wrapper;},
-      getScrollerElement: function(){return scroller;},
-      getGutterElement: function(){return gutter;}
-    };
-
-    function getLine(n) { return getLineAt(doc, n); }
-    function updateLineHeight(line, height) {
-      gutterDirty = true;
-      var diff = height - line.height;
-      for (var n = line; n; n = n.parent) n.height += diff;
-    }
-
-    function setValue(code) {
-      var top = {line: 0, ch: 0};
-      updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},
-                  splitLines(code), top, top);
-      updateInput = true;
-    }
-    function getValue() {
-      var text = [];
-      doc.iter(0, doc.size, function(line) { text.push(line.text); });
-      return text.join("\n");
-    }
-
-    function onMouseDown(e) {
-      setShift(e_prop(e, "shiftKey"));
-      // Check whether this is a click in a widget
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == code && n != mover) return;
-
-      // See if this is a click in the gutter
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == gutterText) {
-          if (options.onGutterClick)
-            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
-          return e_preventDefault(e);
-        }
-
-      var start = posFromMouse(e);
-
-      switch (e_button(e)) {
-      case 3:
-        if (gecko && !mac) onContextMenu(e);
-        return;
-      case 2:
-        if (start) setCursor(start.line, start.ch, true);
-        return;
-      }
-      // For button 1, if it was clicked inside the editor
-      // (posFromMouse returning non-null), we have to adjust the
-      // selection.
-      if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
-
-      if (!focused) onFocus();
-
-      var now = +new Date;
-      if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
-        e_preventDefault(e);
-        setTimeout(focusInput, 20);
-        return selectLine(start.line);
-      } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
-        lastDoubleClick = {time: now, pos: start};
-        e_preventDefault(e);
-        return selectWordAt(start);
-      } else { lastClick = {time: now, pos: start}; }
-
-      var last = start, going;
-      if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&
-          !posLess(start, sel.from) && !posLess(sel.to, start)) {
-        // Let the drag handler handle this.
-        if (webkit) lineSpace.draggable = true;
-        function dragEnd(e2) {
-          if (webkit) lineSpace.draggable = false;
-          draggingText = false;
-          up(); drop();
-          if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
-            e_preventDefault(e2);
-            setCursor(start.line, start.ch, true);
-            focusInput();
-          }
-        }
-        var up = connect(document, "mouseup", operation(dragEnd), true);
-        var drop = connect(scroller, "drop", operation(dragEnd), true);
-        draggingText = true;
-        // IE's approach to draggable
-        if (lineSpace.dragDrop) lineSpace.dragDrop();
-        return;
-      }
-      e_preventDefault(e);
-      setCursor(start.line, start.ch, true);
-
-      function extend(e) {
-        var cur = posFromMouse(e, true);
-        if (cur && !posEq(cur, last)) {
-          if (!focused) onFocus();
-          last = cur;
-          setSelectionUser(start, cur);
-          updateInput = false;
-          var visible = visibleLines();
-          if (cur.line >= visible.to || cur.line < visible.from)
-            going = setTimeout(operation(function(){extend(e);}), 150);
-        }
-      }
-
-      function done(e) {
-        clearTimeout(going);
-        var cur = posFromMouse(e);
-        if (cur) setSelectionUser(start, cur);
-        e_preventDefault(e);
-        focusInput();
-        updateInput = true;
-        move(); up();
-      }
-      var move = connect(document, "mousemove", operation(function(e) {
-        clearTimeout(going);
-        e_preventDefault(e);
-        if (!ie && !e_button(e)) done(e);
-        else extend(e);
-      }), true);
-      var up = connect(document, "mouseup", operation(done), true);
-    }
-    function onDoubleClick(e) {
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == gutterText) return e_preventDefault(e);
-      var start = posFromMouse(e);
-      if (!start) return;
-      lastDoubleClick = {time: +new Date, pos: start};
-      e_preventDefault(e);
-      selectWordAt(start);
-    }
-    function onDrop(e) {
-      if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
-      e.preventDefault();
-      var pos = posFromMouse(e, true), files = e.dataTransfer.files;
-      if (!pos || options.readOnly) return;
-      if (files && files.length && window.FileReader && window.File) {
-        function loadFile(file, i) {
-          var reader = new FileReader;
-          reader.onload = function() {
-            text[i] = reader.result;
-            if (++read == n) {
-              pos = clipPos(pos);
-              operation(function() {
-                var end = replaceRange(text.join(""), pos, pos);
-                setSelectionUser(pos, end);
-              })();
-            }
-          };
-          reader.readAsText(file);
-        }
-        var n = files.length, text = Array(n), read = 0;
-        for (var i = 0; i < n; ++i) loadFile(files[i], i);
-      }
-      else {
-        try {
-          var text = e.dataTransfer.getData("Text");
-          if (text) {
-            compoundChange(function() {
-              var curFrom = sel.from, curTo = sel.to;
-              setSelectionUser(pos, pos);
-              if (draggingText) replaceRange("", curFrom, curTo);
-              replaceSelection(text);
-              focusInput();
-            });
-          }
-        }
-        catch(e){}
-      }
-    }
-    function onDragStart(e) {
-      var txt = getSelection();
-      e.dataTransfer.setData("Text", txt);
-      
-      // Use dummy image instead of default browsers image.
-      if (gecko || chrome) {
-        var img = document.createElement('img');
-        img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image
-        e.dataTransfer.setDragImage(img, 0, 0);
-      }
-    }
-
-    function doHandleBinding(bound, dropShift) {
-      if (typeof bound == "string") {
-        bound = commands[bound];
-        if (!bound) return false;
-      }
-      var prevShift = shiftSelecting;
-      try {
-        if (options.readOnly) suppressEdits = true;
-        if (dropShift) shiftSelecting = null;
-        bound(instance);
-      } catch(e) {
-        if (e != Pass) throw e;
-        return false;
-      } finally {
-        shiftSelecting = prevShift;
-        suppressEdits = false;
-      }
-      return true;
-    }
-    function handleKeyBinding(e) {
-      // Handle auto keymap transitions
-      var startMap = getKeyMap(options.keyMap), next = startMap.auto;
-      clearTimeout(maybeTransition);
-      if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
-        if (getKeyMap(options.keyMap) == startMap) {
-          options.keyMap = (next.call ? next.call(null, instance) : next);
-        }
-      }, 50);
-
-      var name = keyNames[e_prop(e, "keyCode")], handled = false;
-      if (name == null || e.altGraphKey) return false;
-      if (e_prop(e, "altKey")) name = "Alt-" + name;
-      if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
-      if (e_prop(e, "metaKey")) name = "Cmd-" + name;
-
-      var stopped = false;
-      function stop() { stopped = true; }
-
-      if (e_prop(e, "shiftKey")) {
-        handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
-                            function(b) {return doHandleBinding(b, true);}, stop)
-               || lookupKey(name, options.extraKeys, options.keyMap, function(b) {
-                 if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
-               }, stop);
-      } else {
-        handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);
-      }
-      if (stopped) handled = false;
-      if (handled) {
-        e_preventDefault(e);
-        if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
-      }
-      return handled;
-    }
-    function handleCharBinding(e, ch) {
-      var handled = lookupKey("'" + ch + "'", options.extraKeys,
-                              options.keyMap, function(b) { return doHandleBinding(b, true); });
-      if (handled) e_preventDefault(e);
-      return handled;
-    }
-
-    var lastStoppedKey = null, maybeTransition;
-    function onKeyDown(e) {
-      if (!focused) onFocus();
-      if (ie && e.keyCode == 27) { e.returnValue = false; }
-      if (pollingFast) { if (readInput()) pollingFast = false; }
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      var code = e_prop(e, "keyCode");
-      // IE does strange things with escape.
-      setShift(code == 16 || e_prop(e, "shiftKey"));
-      // First give onKeyEvent option a chance to handle this.
-      var handled = handleKeyBinding(e);
-      if (window.opera) {
-        lastStoppedKey = handled ? code : null;
-        // Opera has no cut event... we try to at least catch the key combo
-        if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
-          replaceSelection("");
-      }
-    }
-    function onKeyPress(e) {
-      if (pollingFast) readInput();
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
-      if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
-      if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return;
-      var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
-      if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
-        if (mode.electricChars.indexOf(ch) > -1)
-          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);
-      }
-      if (handleCharBinding(e, ch)) return;
-      fastPoll();
-    }
-    function onKeyUp(e) {
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      if (e_prop(e, "keyCode") == 16) shiftSelecting = null;
-    }
-
-    function onFocus() {
-      if (options.readOnly == "nocursor") return;
-      if (!focused) {
-        if (options.onFocus) options.onFocus(instance);
-        focused = true;
-        if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
-          wrapper.className += " CodeMirror-focused";
-        if (!leaveInputAlone) resetInput(true);
-      }
-      slowPoll();
-      restartBlink();
-    }
-    function onBlur() {
-      if (focused) {
-        if (options.onBlur) options.onBlur(instance);
-        focused = false;
-        if (bracketHighlighted)
-          operation(function(){
-            if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }
-          })();
-        wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
-      }
-      clearInterval(blinker);
-      setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
-    }
-
-    // Replace the range from from to to by the strings in newText.
-    // Afterwards, set the selection to selFrom, selTo.
-    function updateLines(from, to, newText, selFrom, selTo) {
-      if (suppressEdits) return;
-      if (history) {
-        var old = [];
-        doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });
-        history.addChange(from.line, newText.length, old);
-        while (history.done.length > options.undoDepth) history.done.shift();
-      }
-      updateLinesNoUndo(from, to, newText, selFrom, selTo);
-    }
-    function unredoHelper(from, to) {
-      if (!from.length) return;
-      var set = from.pop(), out = [];
-      for (var i = set.length - 1; i >= 0; i -= 1) {
-        var change = set[i];
-        var replaced = [], end = change.start + change.added;
-        doc.iter(change.start, end, function(line) { replaced.push(line.text); });
-        out.push({start: change.start, added: change.old.length, old: replaced});
-        var pos = clipPos({line: change.start + change.old.length - 1,
-                           ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
-        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
-      }
-      updateInput = true;
-      to.push(out);
-    }
-    function undo() {unredoHelper(history.done, history.undone);}
-    function redo() {unredoHelper(history.undone, history.done);}
-
-    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
-      if (suppressEdits) return;
-      var recomputeMaxLength = false, maxLineLength = maxLine.length;
-      if (!options.lineWrapping)
-        doc.iter(from.line, to.line + 1, function(line) {
-          if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
-        });
-      if (from.line != to.line || newText.length > 1) gutterDirty = true;
-
-      var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
-      // First adjust the line structure, taking some care to leave highlighting intact.
-      if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {
-        // This is a whole-line replace. Treated specially to make
-        // sure line objects move the way they are supposed to.
-        var added = [], prevLine = null;
-        if (from.line) {
-          prevLine = getLine(from.line - 1);
-          prevLine.fixMarkEnds(lastLine);
-        } else lastLine.fixMarkStarts();
-        for (var i = 0, e = newText.length - 1; i < e; ++i)
-          added.push(Line.inheritMarks(newText[i], prevLine));
-        if (nlines) doc.remove(from.line, nlines, callbacks);
-        if (added.length) doc.insert(from.line, added);
-      } else if (firstLine == lastLine) {
-        if (newText.length == 1)
-          firstLine.replace(from.ch, to.ch, newText[0]);
-        else {
-          lastLine = firstLine.split(to.ch, newText[newText.length-1]);
-          firstLine.replace(from.ch, null, newText[0]);
-          firstLine.fixMarkEnds(lastLine);
-          var added = [];
-          for (var i = 1, e = newText.length - 1; i < e; ++i)
-            added.push(Line.inheritMarks(newText[i], firstLine));
-          added.push(lastLine);
-          doc.insert(from.line + 1, added);
-        }
-      } else if (newText.length == 1) {
-        firstLine.replace(from.ch, null, newText[0]);
-        lastLine.replace(null, to.ch, "");
-        firstLine.append(lastLine);
-        doc.remove(from.line + 1, nlines, callbacks);
-      } else {
-        var added = [];
-        firstLine.replace(from.ch, null, newText[0]);
-        lastLine.replace(null, to.ch, newText[newText.length-1]);
-        firstLine.fixMarkEnds(lastLine);
-        for (var i = 1, e = newText.length - 1; i < e; ++i)
-          added.push(Line.inheritMarks(newText[i], firstLine));
-        if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);
-        doc.insert(from.line + 1, added);
-      }
-      if (options.lineWrapping) {
-        var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);
-        doc.iter(from.line, from.line + newText.length, function(line) {
-          if (line.hidden) return;
-          var guess = Math.ceil(line.text.length / perLine) || 1;
-          if (guess != line.height) updateLineHeight(line, guess);
-        });
-      } else {
-        doc.iter(from.line, from.line + newText.length, function(line) {
-          var l = line.text;
-          if (l.length > maxLineLength) {
-            maxLine = l; maxLineLength = l.length; maxWidth = null;
-            recomputeMaxLength = false;
-          }
-        });
-        if (recomputeMaxLength) {
-          maxLineLength = 0; maxLine = ""; maxWidth = null;
-          doc.iter(0, doc.size, function(line) {
-            var l = line.text;
-            if (l.length > maxLineLength) {
-              maxLineLength = l.length; maxLine = l;
-            }
-          });
-        }
-      }
-
-      // Add these lines to the work array, so that they will be
-      // highlighted. Adjust work lines if lines were added/removed.
-      var newWork = [], lendiff = newText.length - nlines - 1;
-      for (var i = 0, l = work.length; i < l; ++i) {
-        var task = work[i];
-        if (task < from.line) newWork.push(task);
-        else if (task > to.line) newWork.push(task + lendiff);
-      }
-      var hlEnd = from.line + Math.min(newText.length, 500);
-      highlightLines(from.line, hlEnd);
-      newWork.push(hlEnd);
-      work = newWork;
-      startWorker(100);
-      // Remember that these lines changed, for updating the display
-      changes.push({from: from.line, to: to.line + 1, diff: lendiff});
-      var changeObj = {from: from, to: to, text: newText};
-      if (textChanged) {
-        for (var cur = textChanged; cur.next; cur = cur.next) {}
-        cur.next = changeObj;
-      } else textChanged = changeObj;
-
-      // Update the selection
-      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
-      setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
-
-      // Make sure the scroll-size div has the correct height.
-      if (scroller.clientHeight)
-        code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px";
-    }
-
-    function replaceRange(code, from, to) {
-      from = clipPos(from);
-      if (!to) to = from; else to = clipPos(to);
-      code = splitLines(code);
-      function adjustPos(pos) {
-        if (posLess(pos, from)) return pos;
-        if (!posLess(to, pos)) return end;
-        var line = pos.line + code.length - (to.line - from.line) - 1;
-        var ch = pos.ch;
-        if (pos.line == to.line)
-          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
-        return {line: line, ch: ch};
-      }
-      var end;
-      replaceRange1(code, from, to, function(end1) {
-        end = end1;
-        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
-      });
-      return end;
-    }
-    function replaceSelection(code, collapse) {
-      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
-        if (collapse == "end") return {from: end, to: end};
-        else if (collapse == "start") return {from: sel.from, to: sel.from};
-        else return {from: sel.from, to: end};
-      });
-    }
-    function replaceRange1(code, from, to, computeSel) {
-      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
-      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
-      updateLines(from, to, code, newSel.from, newSel.to);
-    }
-
-    function getRange(from, to) {
-      var l1 = from.line, l2 = to.line;
-      if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
-      var code = [getLine(l1).text.slice(from.ch)];
-      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
-      code.push(getLine(l2).text.slice(0, to.ch));
-      return code.join("\n");
-    }
-    function getSelection() {
-      return getRange(sel.from, sel.to);
-    }
-
-    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
-    function slowPoll() {
-      if (pollingFast) return;
-      poll.set(options.pollInterval, function() {
-        startOperation();
-        readInput();
-        if (focused) slowPoll();
-        endOperation();
-      });
-    }
-    function fastPoll() {
-      var missed = false;
-      pollingFast = true;
-      function p() {
-        startOperation();
-        var changed = readInput();
-        if (!changed && !missed) {missed = true; poll.set(60, p);}
-        else {pollingFast = false; slowPoll();}
-        endOperation();
-      }
-      poll.set(20, p);
-    }
-
-    // Previnput is a hack to work with IME. If we reset the textarea
-    // on every change, that breaks IME. So we look for changes
-    // compared to the previous content instead. (Modern browsers have
-    // events that indicate IME taking place, but these are not widely
-    // supported or compatible enough yet to rely on.)
-    var prevInput = "";
-    function readInput() {
-      if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;
-      var text = input.value;
-      if (text == prevInput) return false;
-      shiftSelecting = null;
-      var same = 0, l = Math.min(prevInput.length, text.length);
-      while (same < l && prevInput[same] == text[same]) ++same;
-      if (same < prevInput.length)
-        sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
-      else if (overwrite && posEq(sel.from, sel.to))
-        sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
-      replaceSelection(text.slice(same), "end");
-      prevInput = text;
-      return true;
-    }
-    function resetInput(user) {
-      if (!posEq(sel.from, sel.to)) {
-        prevInput = "";
-        input.value = getSelection();
-        selectInput(input);
-      } else if (user) prevInput = input.value = "";
-    }
-
-    function focusInput() {
-      if (options.readOnly != "nocursor") input.focus();
-    }
-
-    function scrollEditorIntoView() {
-      if (!cursor.getBoundingClientRect) return;
-      var rect = cursor.getBoundingClientRect();
-      // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden
-      if (ie && rect.top == rect.bottom) return;
-      var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
-      if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
-    }
-    function scrollCursorIntoView() {
-      var cursor = localCoords(sel.inverted ? sel.from : sel.to);
-      var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
-      return scrollIntoView(x, cursor.y, x, cursor.yBot);
-    }
-    function scrollIntoView(x1, y1, x2, y2) {
-      var pl = paddingLeft(), pt = paddingTop();
-      y1 += pt; y2 += pt; x1 += pl; x2 += pl;
-      var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
-      if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;}
-      else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;}
-
-      var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
-      var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
-      var atLeft = x1 < gutterw + pl + 10;
-      if (x1 < screenleft + gutterw || atLeft) {
-        if (atLeft) x1 = 0;
-        scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
-        scrolled = true;
-      }
-      else if (x2 > screenw + screenleft - 3) {
-        scroller.scrollLeft = x2 + 10 - screenw;
-        scrolled = true;
-        if (x2 > code.clientWidth) result = false;
-      }
-      if (scrolled && options.onScroll) options.onScroll(instance);
-      return result;
-    }
-
-    function visibleLines() {
-      var lh = textHeight(), top = scroller.scrollTop - paddingTop();
-      var fromHeight = Math.max(0, Math.floor(top / lh));
-      var toHeight = Math.ceil((top + scroller.clientHeight) / lh);
-      return {from: lineAtHeight(doc, fromHeight),
-              to: lineAtHeight(doc, toHeight)};
-    }
-    // Uses a set of changes plus the current scroll position to
-    // determine which DOM updates have to be made, and makes the
-    // updates.
-    function updateDisplay(changes, suppressCallback) {
-      if (!scroller.clientWidth) {
-        showingFrom = showingTo = displayOffset = 0;
-        return;
-      }
-      // Compute the new visible window
-      var visible = visibleLines();
-      // Bail out if the visible area is already rendered and nothing changed.
-      if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;
-      var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
-      if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
-      if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);
-
-      // Create a range of theoretically intact lines, and punch holes
-      // in that using the change info.
-      var intact = changes === true ? [] :
-        computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
-      // Clip off the parts that won't be visible
-      var intactLines = 0;
-      for (var i = 0; i < intact.length; ++i) {
-        var range = intact[i];
-        if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
-        if (range.to > to) range.to = to;
-        if (range.from >= range.to) intact.splice(i--, 1);
-        else intactLines += range.to - range.from;
-      }
-      if (intactLines == to - from && from == showingFrom && to == showingTo) return;
-      intact.sort(function(a, b) {return a.domStart - b.domStart;});
-
-      var th = textHeight(), gutterDisplay = gutter.style.display;
-      lineDiv.style.display = "none";
-      patchDisplay(from, to, intact);
-      lineDiv.style.display = gutter.style.display = "";
-
-      // Position the mover div to align with the lines it's supposed
-      // to be showing (which will cover the visible display)
-      var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;
-      // This is just a bogus formula that detects when the editor is
-      // resized or the font size changes.
-      if (different) lastSizeC = scroller.clientHeight + th;
-      showingFrom = from; showingTo = to;
-      displayOffset = heightAtLine(doc, from);
-      mover.style.top = (displayOffset * th) + "px";
-      if (scroller.clientHeight)
-        code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
-
-      // Since this is all rather error prone, it is honoured with the
-      // only assertion in the whole file.
-      if (lineDiv.childNodes.length != showingTo - showingFrom)
-        throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
-                        " nodes=" + lineDiv.childNodes.length);
-
-      function checkHeights() {
-        maxWidth = scroller.clientWidth;
-        var curNode = lineDiv.firstChild, heightChanged = false;
-        doc.iter(showingFrom, showingTo, function(line) {
-          if (!line.hidden) {
-            var height = Math.round(curNode.offsetHeight / th) || 1;
-            if (line.height != height) {
-              updateLineHeight(line, height);
-              gutterDirty = heightChanged = true;
-            }
-          }
-          curNode = curNode.nextSibling;
-        });
-        if (heightChanged)
-          code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
-        return heightChanged;
-      }
-
-      if (options.lineWrapping) {
-        checkHeights();
-      } else {
-        if (maxWidth == null) maxWidth = stringWidth(maxLine);
-        if (maxWidth > scroller.clientWidth) {
-          lineSpace.style.width = maxWidth + "px";
-          // Needed to prevent odd wrapping/hiding of widgets placed in here.
-          code.style.width = "";
-          code.style.width = scroller.scrollWidth + "px";
-        } else {
-          lineSpace.style.width = code.style.width = "";
-        }
-      }
-
-      gutter.style.display = gutterDisplay;
-      if (different || gutterDirty) {
-        // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
-        updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
-      }
-      updateSelection();
-      if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
-      return true;
-    }
-
-    function computeIntact(intact, changes) {
-      for (var i = 0, l = changes.length || 0; i < l; ++i) {
-        var change = changes[i], intact2 = [], diff = change.diff || 0;
-        for (var j = 0, l2 = intact.length; j < l2; ++j) {
-          var range = intact[j];
-          if (change.to <= range.from && change.diff)
-            intact2.push({from: range.from + diff, to: range.to + diff,
-                          domStart: range.domStart});
-          else if (change.to <= range.from || change.from >= range.to)
-            intact2.push(range);
-          else {
-            if (change.from > range.from)
-              intact2.push({from: range.from, to: change.from, domStart: range.domStart});
-            if (change.to < range.to)
-              intact2.push({from: change.to + diff, to: range.to + diff,
-                            domStart: range.domStart + (change.to - range.from)});
-          }
-        }
-        intact = intact2;
-      }
-      return intact;
-    }
-
-    function patchDisplay(from, to, intact) {
-      // The first pass removes the DOM nodes that aren't intact.
-      if (!intact.length) lineDiv.innerHTML = "";
-      else {
-        function killNode(node) {
-          var tmp = node.nextSibling;
-          node.parentNode.removeChild(node);
-          return tmp;
-        }
-        var domPos = 0, curNode = lineDiv.firstChild, n;
-        for (var i = 0; i < intact.length; ++i) {
-          var cur = intact[i];
-          while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}
-          for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}
-        }
-        while (curNode) curNode = killNode(curNode);
-      }
-      // This pass fills in the lines that actually changed.
-      var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
-      var scratch = document.createElement("div");
-      doc.iter(from, to, function(line) {
-        if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
-        if (!nextIntact || nextIntact.from > j) {
-          if (line.hidden) var html = scratch.innerHTML = "<pre></pre>";
-          else {
-            var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>'
-              + line.getHTML(makeTab) + '</pre>';
-            // Kludge to make sure the styled element lies behind the selection (by z-index)
-            if (line.bgClassName)
-              html = '<div style="position: relative"><pre class="' + line.bgClassName +
-              '" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2">&#160;</pre>' + html + "</div>";
-          }
-          scratch.innerHTML = html;
-          lineDiv.insertBefore(scratch.firstChild, curNode);
-        } else {
-          curNode = curNode.nextSibling;
-        }
-        ++j;
-      });
-    }
-
-    function updateGutter() {
-      if (!options.gutter && !options.lineNumbers) return;
-      var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
-      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
-      var html = [], i = showingFrom, normalNode;
-      doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
-        if (line.hidden) {
-          html.push("<pre></pre>");
-        } else {
-          var marker = line.gutterMarker;
-          var text = options.lineNumbers ? i + options.firstLineNumber : null;
-          if (marker && marker.text)
-            text = marker.text.replace("%N%", text != null ? text : "");
-          else if (text == null)
-            text = "\u00a0";
-          html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);
-          for (var j = 1; j < line.height; ++j) html.push("<br/>&#160;");
-          html.push("</pre>");
-          if (!marker) normalNode = i;
-        }
-        ++i;
-      });
-      gutter.style.display = "none";
-      gutterText.innerHTML = html.join("");
-      // Make sure scrolling doesn't cause number gutter size to pop
-      if (normalNode != null) {
-        var node = gutterText.childNodes[normalNode - showingFrom];
-        var minwidth = String(doc.size).length, val = eltText(node), pad = "";
-        while (val.length + pad.length < minwidth) pad += "\u00a0";
-        if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);
-      }
-      gutter.style.display = "";
-      var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;
-      lineSpace.style.marginLeft = gutter.offsetWidth + "px";
-      gutterDirty = false;
-      return resized;
-    }
-    function updateSelection() {
-      var collapsed = posEq(sel.from, sel.to);
-      var fromPos = localCoords(sel.from, true);
-      var toPos = collapsed ? fromPos : localCoords(sel.to, true);
-      var headPos = sel.inverted ? fromPos : toPos, th = textHeight();
-      var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);
-      inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";
-      inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";
-      if (collapsed) {
-        cursor.style.top = headPos.y + "px";
-        cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";
-        cursor.style.display = "";
-        selectionDiv.style.display = "none";
-      } else {
-        var sameLine = fromPos.y == toPos.y, html = "";
-        var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
-        var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
-        function add(left, top, right, height) {
-          var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"
-                                  : "right: " + right + "px";
-          html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left +
-            'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px"></div>';
-        }
-        if (sel.from.ch && fromPos.y >= 0) {
-          var right = sameLine ? clientWidth - toPos.x : 0;
-          add(fromPos.x, fromPos.y, right, th);
-        }
-        var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));
-        var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;
-        if (middleHeight > 0.2 * th)
-          add(0, middleStart, 0, middleHeight);
-        if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
-          add(0, toPos.y, clientWidth - toPos.x, th);
-        selectionDiv.innerHTML = html;
-        cursor.style.display = "none";
-        selectionDiv.style.display = "";
-      }
-    }
-
-    function setShift(val) {
-      if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
-      else shiftSelecting = null;
-    }
-    function setSelectionUser(from, to) {
-      var sh = shiftSelecting && clipPos(shiftSelecting);
-      if (sh) {
-        if (posLess(sh, from)) from = sh;
-        else if (posLess(to, sh)) to = sh;
-      }
-      setSelection(from, to);
-      userSelChange = true;
-    }
-    // Update the selection. Last two args are only used by
-    // updateLines, since they have to be expressed in the line
-    // numbers before the update.
-    function setSelection(from, to, oldFrom, oldTo) {
-      goalColumn = null;
-      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
-      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
-      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
-
-      // Skip over hidden lines.
-      if (from.line != oldFrom) {
-        var from1 = skipHidden(from, oldFrom, sel.from.ch);
-        // If there is no non-hidden line left, force visibility on current line
-        if (!from1) setLineHidden(from.line, false);
-        else from = from1;
-      }
-      if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
-
-      if (posEq(from, to)) sel.inverted = false;
-      else if (posEq(from, sel.to)) sel.inverted = false;
-      else if (posEq(to, sel.from)) sel.inverted = true;
-
-      if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
-        var head = sel.inverted ? from : to;
-        if (head.line != sel.from.line && sel.from.line < doc.size) {
-          var oldLine = getLine(sel.from.line);
-          if (/^\s+$/.test(oldLine.text))
-            setTimeout(operation(function() {
-              if (oldLine.parent && /^\s+$/.test(oldLine.text)) {
-                var no = lineNo(oldLine);
-                replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});
-              }
-            }, 10));
-        }
-      }
-
-      sel.from = from; sel.to = to;
-      selectionChanged = true;
-    }
-    function skipHidden(pos, oldLine, oldCh) {
-      function getNonHidden(dir) {
-        var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;
-        while (lNo != end) {
-          var line = getLine(lNo);
-          if (!line.hidden) {
-            var ch = pos.ch;
-            if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;
-            return {line: lNo, ch: ch};
-          }
-          lNo += dir;
-        }
-      }
-      var line = getLine(pos.line);
-      var toEnd = pos.ch == line.text.length && pos.ch != oldCh;
-      if (!line.hidden) return pos;
-      if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);
-      else return getNonHidden(-1) || getNonHidden(1);
-    }
-    function setCursor(line, ch, user) {
-      var pos = clipPos({line: line, ch: ch || 0});
-      (user ? setSelectionUser : setSelection)(pos, pos);
-    }
-
-    function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}
-    function clipPos(pos) {
-      if (pos.line < 0) return {line: 0, ch: 0};
-      if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};
-      var ch = pos.ch, linelen = getLine(pos.line).text.length;
-      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
-      else if (ch < 0) return {line: pos.line, ch: 0};
-      else return pos;
-    }
-
-    function findPosH(dir, unit) {
-      var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;
-      var lineObj = getLine(line);
-      function findNextLine() {
-        for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {
-          var lo = getLine(l);
-          if (!lo.hidden) { line = l; lineObj = lo; return true; }
-        }
-      }
-      function moveOnce(boundToLine) {
-        if (ch == (dir < 0 ? 0 : lineObj.text.length)) {
-          if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;
-          else return false;
-        } else ch += dir;
-        return true;
-      }
-      if (unit == "char") moveOnce();
-      else if (unit == "column") moveOnce(true);
-      else if (unit == "word") {
-        var sawWord = false;
-        for (;;) {
-          if (dir < 0) if (!moveOnce()) break;
-          if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
-          else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
-          if (dir > 0) if (!moveOnce()) break;
-        }
-      }
-      return {line: line, ch: ch};
-    }
-    function moveH(dir, unit) {
-      var pos = dir < 0 ? sel.from : sel.to;
-      if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);
-      setCursor(pos.line, pos.ch, true);
-    }
-    function deleteH(dir, unit) {
-      if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to);
-      else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to);
-      else replaceRange("", sel.from, findPosH(dir, unit));
-      userSelChange = true;
-    }
-    var goalColumn = null;
-    function moveV(dir, unit) {
-      var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);
-      if (goalColumn != null) pos.x = goalColumn;
-      if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);
-      else if (unit == "line") dist = textHeight();
-      var target = coordsChar(pos.x, pos.y + dist * dir + 2);
-      if (unit == "page") scroller.scrollTop += localCoords(target, true).y - pos.y;
-      setCursor(target.line, target.ch, true);
-      goalColumn = pos.x;
-    }
-
-    function selectWordAt(pos) {
-      var line = getLine(pos.line).text;
-      var start = pos.ch, end = pos.ch;
-      while (start > 0 && isWordChar(line.charAt(start - 1))) --start;
-      while (end < line.length && isWordChar(line.charAt(end))) ++end;
-      setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
-    }
-    function selectLine(line) {
-      setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));
-    }
-    function indentSelected(mode) {
-      if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
-      var e = sel.to.line - (sel.to.ch ? 0 : 1);
-      for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
-    }
-
-    function indentLine(n, how) {
-      if (!how) how = "add";
-      if (how == "smart") {
-        if (!mode.indent) how = "prev";
-        else var state = getStateBefore(n);
-      }
-
-      var line = getLine(n), curSpace = line.indentation(options.tabSize),
-          curSpaceString = line.text.match(/^\s*/)[0], indentation;
-      if (how == "prev") {
-        if (n) indentation = getLine(n-1).indentation(options.tabSize);
-        else indentation = 0;
-      }
-      else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
-      else if (how == "add") indentation = curSpace + options.indentUnit;
-      else if (how == "subtract") indentation = curSpace - options.indentUnit;
-      indentation = Math.max(0, indentation);
-      var diff = indentation - curSpace;
-
-      if (!diff) {
-        if (sel.from.line != n && sel.to.line != n) return;
-        var indentString = curSpaceString;
-      }
-      else {
-        var indentString = "", pos = 0;
-        if (options.indentWithTabs)
-          for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";}
-        while (pos < indentation) {++pos; indentString += " ";}
-      }
-
-      replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
-    }
-
-    function loadMode() {
-      mode = CodeMirror.getMode(options, options.mode);
-      doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
-      work = [0];
-      startWorker();
-    }
-    function gutterChanged() {
-      var visible = options.gutter || options.lineNumbers;
-      gutter.style.display = visible ? "" : "none";
-      if (visible) gutterDirty = true;
-      else lineDiv.parentNode.style.marginLeft = 0;
-    }
-    function wrappingChanged(from, to) {
-      if (options.lineWrapping) {
-        wrapper.className += " CodeMirror-wrap";
-        var perLine = scroller.clientWidth / charWidth() - 3;
-        doc.iter(0, doc.size, function(line) {
-          if (line.hidden) return;
-          var guess = Math.ceil(line.text.length / perLine) || 1;
-          if (guess != 1) updateLineHeight(line, guess);
-        });
-        lineSpace.style.width = code.style.width = "";
-      } else {
-        wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
-        maxWidth = null; maxLine = "";
-        doc.iter(0, doc.size, function(line) {
-          if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
-          if (line.text.length > maxLine.length) maxLine = line.text;
-        });
-      }
-      changes.push({from: 0, to: doc.size});
-    }
-    function makeTab(col) {
-      var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
-      if (cached) return cached;
-      for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " ";
-      return (tabCache[w] = {html: str + "</span>", width: w});
-    }
-    function themeChanged() {
-      scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") +
-        options.theme.replace(/(^|\s)\s*/g, " cm-s-");
-    }
-
-    function TextMarker() { this.set = []; }
-    TextMarker.prototype.clear = operation(function() {
-      var min = Infinity, max = -Infinity;
-      for (var i = 0, e = this.set.length; i < e; ++i) {
-        var line = this.set[i], mk = line.marked;
-        if (!mk || !line.parent) continue;
-        var lineN = lineNo(line);
-        min = Math.min(min, lineN); max = Math.max(max, lineN);
-        for (var j = 0; j < mk.length; ++j)
-          if (mk[j].marker == this) mk.splice(j--, 1);
-      }
-      if (min != Infinity)
-        changes.push({from: min, to: max + 1});
-    });
-    TextMarker.prototype.find = function() {
-      var from, to;
-      for (var i = 0, e = this.set.length; i < e; ++i) {
-        var line = this.set[i], mk = line.marked;
-        for (var j = 0; j < mk.length; ++j) {
-          var mark = mk[j];
-          if (mark.marker == this) {
-            if (mark.from != null || mark.to != null) {
-              var found = lineNo(line);
-              if (found != null) {
-                if (mark.from != null) from = {line: found, ch: mark.from};
-                if (mark.to != null) to = {line: found, ch: mark.to};
-              }
-            }
-          }
-        }
-      }
-      return {from: from, to: to};
-    };
-
-    function markText(from, to, className) {
-      from = clipPos(from); to = clipPos(to);
-      var tm = new TextMarker();
-      if (!posLess(from, to)) return tm;
-      function add(line, from, to, className) {
-        getLine(line).addMark(new MarkedText(from, to, className, tm));
-      }
-      if (from.line == to.line) add(from.line, from.ch, to.ch, className);
-      else {
-        add(from.line, from.ch, null, className);
-        for (var i = from.line + 1, e = to.line; i < e; ++i)
-          add(i, null, null, className);
-        add(to.line, null, to.ch, className);
-      }
-      changes.push({from: from.line, to: to.line + 1});
-      return tm;
-    }
-
-    function setBookmark(pos) {
-      pos = clipPos(pos);
-      var bm = new Bookmark(pos.ch);
-      getLine(pos.line).addMark(bm);
-      return bm;
-    }
-
-    function findMarksAt(pos) {
-      pos = clipPos(pos);
-      var markers = [], marked = getLine(pos.line).marked;
-      if (!marked) return markers;
-      for (var i = 0, e = marked.length; i < e; ++i) {
-        var m = marked[i];
-        if ((m.from == null || m.from <= pos.ch) &&
-            (m.to == null || m.to >= pos.ch))
-          markers.push(m.marker || m);
-      }
-      return markers;
-    }
-
-    function addGutterMarker(line, text, className) {
-      if (typeof line == "number") line = getLine(clipLine(line));
-      line.gutterMarker = {text: text, style: className};
-      gutterDirty = true;
-      return line;
-    }
-    function removeGutterMarker(line) {
-      if (typeof line == "number") line = getLine(clipLine(line));
-      line.gutterMarker = null;
-      gutterDirty = true;
-    }
-
-    function changeLine(handle, op) {
-      var no = handle, line = handle;
-      if (typeof handle == "number") line = getLine(clipLine(handle));
-      else no = lineNo(handle);
-      if (no == null) return null;
-      if (op(line, no)) changes.push({from: no, to: no + 1});
-      else return null;
-      return line;
-    }
-    function setLineClass(handle, className, bgClassName) {
-      return changeLine(handle, function(line) {
-        if (line.className != className || line.bgClassName != bgClassName) {
-          line.className = className;
-          line.bgClassName = bgClassName;
-          return true;
-        }
-      });
-    }
-    function setLineHidden(handle, hidden) {
-      return changeLine(handle, function(line, no) {
-        if (line.hidden != hidden) {
-          line.hidden = hidden;
-          updateLineHeight(line, hidden ? 0 : 1);
-          var fline = sel.from.line, tline = sel.to.line;
-          if (hidden && (fline == no || tline == no)) {
-            var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;
-            var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;
-            // Can't hide the last visible line, we'd have no place to put the cursor
-            if (!to) return;
-            setSelection(from, to);
-          }
-          return (gutterDirty = true);
-        }
-      });
-    }
-
-    function lineInfo(line) {
-      if (typeof line == "number") {
-        if (!isLine(line)) return null;
-        var n = line;
-        line = getLine(line);
-        if (!line) return null;
-      }
-      else {
-        var n = lineNo(line);
-        if (n == null) return null;
-      }
-      var marker = line.gutterMarker;
-      return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
-              markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};
-    }
-
-    function stringWidth(str) {
-      measure.innerHTML = "<pre><span>x</span></pre>";
-      measure.firstChild.firstChild.firstChild.nodeValue = str;
-      return measure.firstChild.firstChild.offsetWidth || 10;
-    }
-    // These are used to go from pixel positions to character
-    // positions, taking varying character widths into account.
-    function charFromX(line, x) {
-      if (x <= 0) return 0;
-      var lineObj = getLine(line), text = lineObj.text;
-      function getX(len) {
-        return measureLine(lineObj, len).left;
-      }
-      var from = 0, fromX = 0, to = text.length, toX;
-      // Guess a suitable upper bound for our search.
-      var estimated = Math.min(to, Math.ceil(x / charWidth()));
-      for (;;) {
-        var estX = getX(estimated);
-        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
-        else {toX = estX; to = estimated; break;}
-      }
-      if (x > toX) return to;
-      // Try to guess a suitable lower bound as well.
-      estimated = Math.floor(to * 0.8); estX = getX(estimated);
-      if (estX < x) {from = estimated; fromX = estX;}
-      // Do a binary search between these bounds.
-      for (;;) {
-        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
-        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
-        if (middleX > x) {to = middle; toX = middleX;}
-        else {from = middle; fromX = middleX;}
-      }
-    }
-
-    var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16);
-    function measureLine(line, ch) {
-      if (ch == 0) return {top: 0, left: 0};
-      var wbr = options.lineWrapping && ch < line.text.length &&
-                spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
-      measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch, tempId, wbr) + "</pre>";
-      var elt = document.getElementById(tempId);
-      var top = elt.offsetTop, left = elt.offsetLeft;
-      // Older IEs report zero offsets for spans directly after a wrap
-      if (ie && top == 0 && left == 0) {
-        var backup = document.createElement("span");
-        backup.innerHTML = "x";
-        elt.parentNode.insertBefore(backup, elt.nextSibling);
-        top = backup.offsetTop;
-      }
-      return {top: top, left: left};
-    }
-    function localCoords(pos, inLineWrap) {
-      var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
-      if (pos.ch == 0) x = 0;
-      else {
-        var sp = measureLine(getLine(pos.line), pos.ch);
-        x = sp.left;
-        if (options.lineWrapping) y += Math.max(0, sp.top);
-      }
-      return {x: x, y: y, yBot: y + lh};
-    }
-    // Coords must be lineSpace-local
-    function coordsChar(x, y) {
-      if (y < 0) y = 0;
-      var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
-      var lineNo = lineAtHeight(doc, heightPos);
-      if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
-      var lineObj = getLine(lineNo), text = lineObj.text;
-      var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;
-      if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};
-      function getX(len) {
-        var sp = measureLine(lineObj, len);
-        if (tw) {
-          var off = Math.round(sp.top / th);
-          return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);
-        }
-        return sp.left;
-      }
-      var from = 0, fromX = 0, to = text.length, toX;
-      // Guess a suitable upper bound for our search.
-      var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));
-      for (;;) {
-        var estX = getX(estimated);
-        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
-        else {toX = estX; to = estimated; break;}
-      }
-      if (x > toX) return {line: lineNo, ch: to};
-      // Try to guess a suitable lower bound as well.
-      estimated = Math.floor(to * 0.8); estX = getX(estimated);
-      if (estX < x) {from = estimated; fromX = estX;}
-      // Do a binary search between these bounds.
-      for (;;) {
-        if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};
-        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
-        if (middleX > x) {to = middle; toX = middleX;}
-        else {from = middle; fromX = middleX;}
-      }
-    }
-    function pageCoords(pos) {
-      var local = localCoords(pos, true), off = eltOffset(lineSpace);
-      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
-    }
-
-    var cachedHeight, cachedHeightFor, measureText;
-    function textHeight() {
-      if (measureText == null) {
-        measureText = "<pre>";
-        for (var i = 0; i < 49; ++i) measureText += "x<br/>";
-        measureText += "x</pre>";
-      }
-      var offsetHeight = lineDiv.clientHeight;
-      if (offsetHeight == cachedHeightFor) return cachedHeight;
-      cachedHeightFor = offsetHeight;
-      measure.innerHTML = measureText;
-      cachedHeight = measure.firstChild.offsetHeight / 50 || 1;
-      measure.innerHTML = "";
-      return cachedHeight;
-    }
-    var cachedWidth, cachedWidthFor = 0;
-    function charWidth() {
-      if (scroller.clientWidth == cachedWidthFor) return cachedWidth;
-      cachedWidthFor = scroller.clientWidth;
-      return (cachedWidth = stringWidth("x"));
-    }
-    function paddingTop() {return lineSpace.offsetTop;}
-    function paddingLeft() {return lineSpace.offsetLeft;}
-
-    function posFromMouse(e, liberal) {
-      var offW = eltOffset(scroller, true), x, y;
-      // Fails unpredictably on IE[67] when mouse is dragged around quickly.
-      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
-      // This is a mess of a heuristic to try and determine whether a
-      // scroll-bar was clicked or not, and to return null if one was
-      // (and !liberal).
-      if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
-        return null;
-      var offL = eltOffset(lineSpace, true);
-      return coordsChar(x - offL.left, y - offL.top);
-    }
-    function onContextMenu(e) {
-      var pos = posFromMouse(e), scrollPos = scroller.scrollTop;
-      if (!pos || window.opera) return; // Opera is difficult.
-      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
-        operation(setCursor)(pos.line, pos.ch);
-
-      var oldCSS = input.style.cssText;
-      inputDiv.style.position = "absolute";
-      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
-        "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
-        "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
-      leaveInputAlone = true;
-      var val = input.value = getSelection();
-      focusInput();
-      selectInput(input);
-      function rehide() {
-        var newVal = splitLines(input.value).join("\n");
-        if (newVal != val) operation(replaceSelection)(newVal, "end");
-        inputDiv.style.position = "relative";
-        input.style.cssText = oldCSS;
-        if (ie_lt9) scroller.scrollTop = scrollPos;
-        leaveInputAlone = false;
-        resetInput(true);
-        slowPoll();
-      }
-
-      if (gecko) {
-        e_stop(e);
-        var mouseup = connect(window, "mouseup", function() {
-          mouseup();
-          setTimeout(rehide, 20);
-        }, true);
-      } else {
-        setTimeout(rehide, 50);
-      }
-    }
-
-    // Cursor-blinking
-    function restartBlink() {
-      clearInterval(blinker);
-      var on = true;
-      cursor.style.visibility = "";
-      blinker = setInterval(function() {
-        cursor.style.visibility = (on = !on) ? "" : "hidden";
-      }, 650);
-    }
-
-    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
-    function matchBrackets(autoclear) {
-      var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
-      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
-      if (!match) return;
-      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
-      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
-        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
-
-      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
-      function scan(line, from, to) {
-        if (!line.text) return;
-        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
-        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
-          var text = st[i];
-          if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
-          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
-            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
-              var match = matching[cur];
-              if (match.charAt(1) == ">" == forward) stack.push(cur);
-              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
-              else if (!stack.length) return {pos: pos, match: true};
-            }
-          }
-        }
-      }
-      for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {
-        var line = getLine(i), first = i == head.line;
-        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
-        if (found) break;
-      }
-      if (!found) found = {pos: null, match: false};
-      var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
-      var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
-          two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
-      var clear = operation(function(){one.clear(); two && two.clear();});
-      if (autoclear) setTimeout(clear, 800);
-      else bracketHighlighted = clear;
-    }
-
-    // Finds the line to start with when starting a parse. Tries to
-    // find a line with a stateAfter, so that it can start with a
-    // valid state. If that fails, it returns the line with the
-    // smallest indentation, which tends to need the least context to
-    // parse correctly.
-    function findStartLine(n) {
-      var minindent, minline;
-      for (var search = n, lim = n - 40; search > lim; --search) {
-        if (search == 0) return 0;
-        var line = getLine(search-1);
-        if (line.stateAfter) return search;
-        var indented = line.indentation(options.tabSize);
-        if (minline == null || minindent > indented) {
-          minline = search - 1;
-          minindent = indented;
-        }
-      }
-      return minline;
-    }
-    function getStateBefore(n) {
-      var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
-      if (!state) state = startState(mode);
-      else state = copyState(mode, state);
-      doc.iter(start, n, function(line) {
-        line.highlight(mode, state, options.tabSize);
-        line.stateAfter = copyState(mode, state);
-      });
-      if (start < n) changes.push({from: start, to: n});
-      if (n < doc.size && !getLine(n).stateAfter) work.push(n);
-      return state;
-    }
-    function highlightLines(start, end) {
-      var state = getStateBefore(start);
-      doc.iter(start, end, function(line) {
-        line.highlight(mode, state, options.tabSize);
-        line.stateAfter = copyState(mode, state);
-      });
-    }
-    function highlightWorker() {
-      var end = +new Date + options.workTime;
-      var foundWork = work.length;
-      while (work.length) {
-        if (!getLine(showingFrom).stateAfter) var task = showingFrom;
-        else var task = work.pop();
-        if (task >= doc.size) continue;
-        var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
-        if (state) state = copyState(mode, state);
-        else state = startState(mode);
-
-        var unchanged = 0, compare = mode.compareStates, realChange = false,
-            i = start, bail = false;
-        doc.iter(i, doc.size, function(line) {
-          var hadState = line.stateAfter;
-          if (+new Date > end) {
-            work.push(i);
-            startWorker(options.workDelay);
-            if (realChange) changes.push({from: task, to: i + 1});
-            return (bail = true);
-          }
-          var changed = line.highlight(mode, state, options.tabSize);
-          if (changed) realChange = true;
-          line.stateAfter = copyState(mode, state);
-          var done = null;
-          if (compare) {
-            var same = hadState && compare(hadState, state);
-            if (same != Pass) done = !!same;
-          }
-          if (done == null) {
-            if (changed !== false || !hadState) unchanged = 0;
-            else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))
-              done = true;
-          }
-          if (done) return true;
-          ++i;
-        });
-        if (bail) return;
-        if (realChange) changes.push({from: task, to: i + 1});
-      }
-      if (foundWork && options.onHighlightComplete)
-        options.onHighlightComplete(instance);
-    }
-    function startWorker(time) {
-      if (!work.length) return;
-      highlight.set(time, operation(highlightWorker));
-    }
-
-    // Operations are used to wrap changes in such a way that each
-    // change won't have to update the cursor and display (which would
-    // be awkward, slow, and error-prone), but instead updates are
-    // batched and then all combined and executed at once.
-    function startOperation() {
-      updateInput = userSelChange = textChanged = null;
-      changes = []; selectionChanged = false; callbacks = [];
-    }
-    function endOperation() {
-      var reScroll = false, updated;
-      if (selectionChanged) reScroll = !scrollCursorIntoView();
-      if (changes.length) updated = updateDisplay(changes, true);
-      else {
-        if (selectionChanged) updateSelection();
-        if (gutterDirty) updateGutter();
-      }
-      if (reScroll) scrollCursorIntoView();
-      if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
-
-      if (focused && !leaveInputAlone &&
-          (updateInput === true || (updateInput !== false && selectionChanged)))
-        resetInput(userSelChange);
-
-      if (selectionChanged && options.matchBrackets)
-        setTimeout(operation(function() {
-          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
-          if (posEq(sel.from, sel.to)) matchBrackets(false);
-        }), 20);
-      var tc = textChanged, cbs = callbacks; // these can be reset by callbacks
-      if (selectionChanged && options.onCursorActivity)
-        options.onCursorActivity(instance);
-      if (tc && options.onChange && instance)
-        options.onChange(instance, tc);
-      for (var i = 0; i < cbs.length; ++i) cbs[i](instance);
-      if (updated && options.onUpdate) options.onUpdate(instance);
-    }
-    var nestedOperation = 0;
-    function operation(f) {
-      return function() {
-        if (!nestedOperation++) startOperation();
-        try {var result = f.apply(this, arguments);}
-        finally {if (!--nestedOperation) endOperation();}
-        return result;
-      };
-    }
-
-    function compoundChange(f) {
-      history.startCompound();
-      try { return f(); } finally { history.endCompound(); }
-    }
-
-    for (var ext in extensions)
-      if (extensions.propertyIsEnumerable(ext) &&
-          !instance.propertyIsEnumerable(ext))
-        instance[ext] = extensions[ext];
-    return instance;
-  } // (end of function CodeMirror)
-
-  // The default configuration options.
-  CodeMirror.defaults = {
-    value: "",
-    mode: null,
-    theme: "default",
-    indentUnit: 2,
-    indentWithTabs: false,
-    smartIndent: true,
-    tabSize: 4,
-    keyMap: "default",
-    extraKeys: null,
-    electricChars: true,
-    autoClearEmptyLines: false,
-    onKeyEvent: null,
-    onDragEvent: null,
-    lineWrapping: false,
-    lineNumbers: false,
-    gutter: false,
-    fixedGutter: false,
-    firstLineNumber: 1,
-    readOnly: false,
-    dragDrop: true,
-    onChange: null,
-    onCursorActivity: null,
-    onGutterClick: null,
-    onHighlightComplete: null,
-    onUpdate: null,
-    onFocus: null, onBlur: null, onScroll: null,
-    matchBrackets: false,
-    workTime: 100,
-    workDelay: 200,
-    pollInterval: 100,
-    undoDepth: 40,
-    tabindex: null,
-    autofocus: null
-  };
-
-  var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
-  var mac = ios || /Mac/.test(navigator.platform);
-  var win = /Win/.test(navigator.platform);
-
-  // Known modes, by name and by MIME
-  var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
-  CodeMirror.defineMode = function(name, mode) {
-    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
-    if (arguments.length > 2) {
-      mode.dependencies = [];
-      for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
-    }
-    modes[name] = mode;
-  };
-  CodeMirror.defineMIME = function(mime, spec) {
-    mimeModes[mime] = spec;
-  };
-  CodeMirror.resolveMode = function(spec) {
-    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
-      spec = mimeModes[spec];
-    else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
-      return CodeMirror.resolveMode("application/xml");
-    if (typeof spec == "string") return {name: spec};
-    else return spec || {name: "null"};
-  };
-  CodeMirror.getMode = function(options, spec) {
-    var spec = CodeMirror.resolveMode(spec);
-    var mfactory = modes[spec.name];
-    if (!mfactory) return CodeMirror.getMode(options, "text/plain");
-    return mfactory(options, spec);
-  };
-  CodeMirror.listModes = function() {
-    var list = [];
-    for (var m in modes)
-      if (modes.propertyIsEnumerable(m)) list.push(m);
-    return list;
-  };
-  CodeMirror.listMIMEs = function() {
-    var list = [];
-    for (var m in mimeModes)
-      if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
-    return list;
-  };
-
-  var extensions = CodeMirror.extensions = {};
-  CodeMirror.defineExtension = function(name, func) {
-    extensions[name] = func;
-  };
-
-  var commands = CodeMirror.commands = {
-    selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
-    killLine: function(cm) {
-      var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
-      if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0});
-      else cm.replaceRange("", from, sel ? to : {line: from.line});
-    },
-    deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});},
-    undo: function(cm) {cm.undo();},
-    redo: function(cm) {cm.redo();},
-    goDocStart: function(cm) {cm.setCursor(0, 0, true);},
-    goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);},
-    goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);},
-    goLineStartSmart: function(cm) {
-      var cur = cm.getCursor();
-      var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/));
-      cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true);
-    },
-    goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);},
-    goLineUp: function(cm) {cm.moveV(-1, "line");},
-    goLineDown: function(cm) {cm.moveV(1, "line");},
-    goPageUp: function(cm) {cm.moveV(-1, "page");},
-    goPageDown: function(cm) {cm.moveV(1, "page");},
-    goCharLeft: function(cm) {cm.moveH(-1, "char");},
-    goCharRight: function(cm) {cm.moveH(1, "char");},
-    goColumnLeft: function(cm) {cm.moveH(-1, "column");},
-    goColumnRight: function(cm) {cm.moveH(1, "column");},
-    goWordLeft: function(cm) {cm.moveH(-1, "word");},
-    goWordRight: function(cm) {cm.moveH(1, "word");},
-    delCharLeft: function(cm) {cm.deleteH(-1, "char");},
-    delCharRight: function(cm) {cm.deleteH(1, "char");},
-    delWordLeft: function(cm) {cm.deleteH(-1, "word");},
-    delWordRight: function(cm) {cm.deleteH(1, "word");},
-    indentAuto: function(cm) {cm.indentSelection("smart");},
-    indentMore: function(cm) {cm.indentSelection("add");},
-    indentLess: function(cm) {cm.indentSelection("subtract");},
-    insertTab: function(cm) {cm.replaceSelection("\t", "end");},
-    transposeChars: function(cm) {
-      var cur = cm.getCursor(), line = cm.getLine(cur.line);
-      if (cur.ch > 0 && cur.ch < line.length - 1)
-        cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
-                        {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
-    },
-    newlineAndIndent: function(cm) {
-      cm.replaceSelection("\n", "end");
-      cm.indentLine(cm.getCursor().line);
-    },
-    toggleOverwrite: function(cm) {cm.toggleOverwrite();}
-  };
-
-  var keyMap = CodeMirror.keyMap = {};
-  keyMap.basic = {
-    "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
-    "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
-    "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "insertTab", "Shift-Tab": "indentAuto",
-    "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
-  };
-  // Note that the save and find-related commands aren't defined by
-  // default. Unknown commands are simply ignored.
-  keyMap.pcDefault = {
-    "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
-    "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
-    "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd

<TRUNCATED>

[13/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.js
deleted file mode 100644
index 49a0195..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.js
+++ /dev/null
@@ -1,2038 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// This is copied from CodeMirror 2.01, but is not the
-// official version, as it has been hacked slightly.
-
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-
-// CodeMirror is the only global var we claim
-var CodeMirror = (function() {
-  // This is the function that produces an editor instance. It's
-  // closure is used to store the editor state.
-  function CodeMirror(place, givenOptions) {
-    // Determine effective options based on given values and defaults.
-    var options = {}, defaults = CodeMirror.defaults;
-    for (var opt in defaults)
-      if (defaults.hasOwnProperty(opt))
-        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
-
-    var targetDocument = options["document"];
-    // The element in which the editor lives. Takes care of scrolling
-    // (if enabled).
-    var wrapper = targetDocument.createElement("div");
-    wrapper.className = "CodeMirror";
-    // Work around http://www.quirksmode.org/bugreports/archives/2006/09/Overflow_Hidden_not_hiding.html
-    if (window.ActiveXObject && /MSIE [1-7]\b/.test(navigator.userAgent))
-      wrapper.style.position = "relative";
-    // This mess creates the base DOM structure for the editor.
-    wrapper.innerHTML =
-      '<div style="position: relative">' + // Set to the height of the text, causes scrolling
-        '<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>' +
-        '<div style="position: relative">' + // Moved around its parent to cover visible view
-          '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
-          '<div style="overflow: hidden; position: absolute; width: 1px; height: 0; left: 0">' + // Wraps and hides input textarea
-            '<textarea style="position: absolute; width: 100000px;" wrap="off"></textarea></div>' +
-          // Provides positioning relative to (visible) text origin
-          '<div class="CodeMirror-lines"><div style="position: relative">' +
-            '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
-            '<div></div></div></div></div></div>'; // This DIV contains the actual code
-    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
-    // I've never seen more elegant code in my life.
-    var code = wrapper.firstChild, measure = code.firstChild, mover = measure.nextSibling,
-        gutter = mover.firstChild, gutterText = gutter.firstChild,
-        inputDiv = gutter.nextSibling, input = inputDiv.firstChild,
-        lineSpace = inputDiv.nextSibling.firstChild, cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;
-    if (options.tabindex != null) input.tabindex = options.tabindex;
-    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
-
-    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
-    var poll = new Delayed(), highlight = new Delayed(), blinker;
-
-    // mode holds a mode API object. lines an array of Line objects
-    // (see Line constructor), work an array of lines that should be
-    // parsed, and history the undo history (instance of History
-    // constructor).
-    var mode, lines = [new Line("")], work, history = new History(), focused;
-    loadMode();
-    // The selection. These are always maintained to point at valid
-    // positions. Inverted is used to remember that the user is
-    // selecting bottom-to-top.
-    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
-    // Selection-related flags. shiftSelecting obviously tracks
-    // whether the user is holding shift. reducedSelection is a hack
-    // to get around the fact that we can't create inverted
-    // selections. See below.
-    var shiftSelecting, reducedSelection, lastDoubleClick;
-    // Variables used by startOperation/endOperation to track what
-    // happened during the operation.
-    var updateInput, changes, textChanged, selectionChanged, leaveInputAlone;
-    // Current visible range (may be bigger than the view window).
-    var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;
-    // editing will hold an object describing the things we put in the
-    // textarea, to help figure out whether something changed.
-    // bracketHighlighted is used to remember that a backet has been
-    // marked.
-    var editing, bracketHighlighted;
-    // Tracks the maximum line length so that the horizontal scrollbar
-    // can be kept static when scrolling.
-    var maxLine = "";
-
-    // Initialize the content. Somewhat hacky (delayed prepareInput)
-    // to work around browser issues.
-    operation(function(){setValue(options.value || ""); updateInput = false;})();
-    setTimeout(prepareInput, 20);
-
-    // Register our event handlers.
-    connect(wrapper, "mousedown", operation(onMouseDown));
-    // Gecko browsers fire contextmenu *after* opening the menu, at
-    // which point we can't mess with it anymore. Context menu is
-    // handled in onMouseDown for Gecko.
-    if (!gecko) connect(wrapper, "contextmenu", operation(onContextMenu));
-    connect(code, "dblclick", operation(onDblClick));
-    connect(wrapper, "scroll", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});
-    connect(window, "resize", function() {updateDisplay(true);});
-    connect(input, "keyup", operation(onKeyUp));
-    connect(input, "keydown", operation(onKeyDown));
-    connect(input, "keypress", operation(onKeyPress));
-    connect(input, "focus", onFocus);
-    connect(input, "blur", onBlur);
-
-    connect(wrapper, "dragenter", function(e){e.stop();});
-    connect(wrapper, "dragover", function(e){e.stop();});
-    connect(wrapper, "drop", operation(onDrop));
-    connect(wrapper, "paste", function(){focusInput(); fastPoll();});
-    connect(input, "paste", function(){fastPoll();});
-    connect(input, "cut", function(){fastPoll();});
-
-    if (targetDocument.activeElement == input) onFocus();
-    else onBlur();
-
-    function isLine(l) {return l >= 0 && l < lines.length;}
-    // The instance object that we'll return. Mostly calls out to
-    // local functions in the CodeMirror function. Some do some extra
-    // range checking and/or clipping. operation is used to wrap the
-    // call so that changes it makes are tracked, and the display is
-    // updated afterwards.
-    var instance = {
-      getValue: getValue,
-      setValue: operation(setValue),
-      getSelection: getSelection,
-      replaceSelection: operation(replaceSelection),
-      focus: function(){focusInput(); onFocus(); fastPoll();},
-      setOption: function(option, value) {
-        options[option] = value;
-        if (option == "lineNumbers" || option == "gutter") gutterChanged();
-        else if (option == "mode" || option == "indentUnit") loadMode();
-        else if (option == "readOnly" && value == "nocursor") input.blur();
-      },
-      getOption: function(option) {return options[option];},
-      undo: operation(undo),
-      redo: operation(redo),
-      indentLine: operation(function(n) {if (isLine(n)) indentLine(n, "smart");}),
-      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
-      matchBrackets: operation(function(){matchBrackets(true);}),
-      getTokenAt: function(pos) {
-        pos = clipPos(pos);
-        return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);
-      },
-      cursorCoords: function(start){
-        if (start == null) start = sel.inverted;
-        return pageCoords(start ? sel.from : sel.to);
-      },
-      charCoords: function(pos){return pageCoords(clipPos(pos));},
-      coordsChar: function(coords) {
-        var off = eltOffset(lineSpace);
-        var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));
-        return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});
-      },
-      getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},
-      markText: operation(function(a, b, c){return operation(markText(a, b, c));}),
-      setMarker: addGutterMarker,
-      clearMarker: removeGutterMarker,
-      setLineClass: operation(setLineClass),
-      lineInfo: lineInfo,
-      addWidget: function(pos, node, scroll) {
-        var pos = localCoords(clipPos(pos), true);
-        node.style.top = (showingFrom * lineHeight() + pos.yBot + paddingTop()) + "px";
-        node.style.left = (pos.x + paddingLeft()) + "px";
-        code.appendChild(node);
-        if (scroll)
-          scrollIntoView(pos.x, pos.yBot, pos.x + node.offsetWidth, pos.yBot + node.offsetHeight);
-      },
-
-      lineCount: function() {return lines.length;},
-      getCursor: function(start) {
-        if (start == null) start = sel.inverted;
-        return copyPos(start ? sel.from : sel.to);
-      },
-      somethingSelected: function() {return !posEq(sel.from, sel.to);},
-      setCursor: operation(function(line, ch) {
-        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch);
-        else setCursor(line, ch);
-      }),
-      setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),
-      getLine: function(line) {if (isLine(line)) return lines[line].text;},
-      setLine: operation(function(line, text) {
-        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});
-      }),
-      removeLine: operation(function(line) {
-        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
-      }),
-      replaceRange: operation(replaceRange),
-      getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
-
-      operation: function(f){return operation(f)();},
-      refresh: function(){updateDisplay(true);},
-      getInputField: function(){return input;},
-      getWrapperElement: function(){return wrapper;}
-    };
-
-    function setValue(code) {
-      history = null;
-      var top = {line: 0, ch: 0};
-      updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},
-                  splitLines(code), top, top);
-      history = new History();
-    }
-    function getValue(code) {
-      var text = [];
-      for (var i = 0, l = lines.length; i < l; ++i)
-        text.push(lines[i].text);
-      return text.join("\n");
-    }
-
-    function onMouseDown(e) {
-      var ld = lastDoubleClick; lastDoubleClick = null;
-      // First, see if this is a click in the gutter
-      for (var n = e.target(); n != wrapper; n = n.parentNode)
-        if (n.parentNode == gutterText) {
-          if (options.onGutterClick)
-            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom);
-          return e.stop();
-        }
-
-      if (gecko && e.button() == 3) onContextMenu(e);
-      if (e.button() != 1) return;
-      // For button 1, if it was clicked inside the editor
-      // (posFromMouse returning non-null), we have to adjust the
-      // selection.
-      var start = posFromMouse(e), last = start, going;
-      if (!start) {if (e.target() == wrapper) e.stop(); return;}
-
-      if (!focused) onFocus();
-      e.stop();
-      if (ld && +new Date - ld < 400) return selectLine(start.line);
-
-      setCursor(start.line, start.ch, true);
-      // And then we have to see if it's a drag event, in which case
-      // the dragged-over text must be selected.
-      function end() {
-        focusInput();
-        updateInput = true;
-        move(); up();
-      }
-      function extend(e) {
-        var cur = posFromMouse(e, true);
-        if (cur && !posEq(cur, last)) {
-          if (!focused) onFocus();
-          last = cur;
-          setSelectionUser(start, cur);
-          updateInput = false;
-          var visible = visibleLines();
-          if (cur.line >= visible.to || cur.line < visible.from)
-            going = setTimeout(operation(function(){extend(e);}), 150);
-        }
-      }
-
-      var move = connect(targetDocument, "mousemove", operation(function(e) {
-        clearTimeout(going);
-        e.stop();
-        extend(e);
-      }), true);
-      var up = connect(targetDocument, "mouseup", operation(function(e) {
-        clearTimeout(going);
-        var cur = posFromMouse(e);
-        if (cur) setSelectionUser(start, cur);
-        e.stop();
-        end();
-      }), true);
-    }
-    function onDblClick(e) {
-      var pos = posFromMouse(e);
-      if (!pos) return;
-      selectWordAt(pos);
-      e.stop();
-      lastDoubleClick = +new Date;
-    }
-    function onDrop(e) {
-      var pos = posFromMouse(e, true), files = e.e.dataTransfer.files;
-      if (!pos || options.readOnly) return;
-      if (files && files.length && window.FileReader && window.File) {
-        var n = files.length, text = Array(n), read = 0;
-        for (var i = 0; i < n; ++i) loadFile(files[i], i);
-        function loadFile(file, i) {
-          var reader = new FileReader;
-          reader.onload = function() {
-            text[i] = reader.result;
-            if (++read == n) replaceRange(text.join(""), clipPos(pos), clipPos(pos));
-          };
-          reader.readAsText(file);
-        }
-      }
-      else {
-        try {
-          var text = e.e.dataTransfer.getData("Text");
-          if (text) replaceRange(text, pos, pos);
-        }
-        catch(e){}
-      }
-    }
-    function onKeyDown(e) {
-      if (!focused) onFocus();
-
-      var code = e.e.keyCode;
-      // Tries to detect ctrl on non-mac, cmd on mac.
-      var mod = (mac ? e.e.metaKey : e.e.ctrlKey) && !e.e.altKey, anyMod = e.e.ctrlKey || e.e.altKey || e.e.metaKey;
-      if (code == 16 || e.e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
-      else shiftSelecting = null;
-      // First give onKeyEvent option a chance to handle this.
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e.e))) return;
-
-      if (code == 33 || code == 34) {scrollPage(code == 34); return e.stop();} // page up/down
-      if (mod && ((code == 36 || code == 35) || // ctrl-home/end
-                  mac && (code == 38 || code == 40))) { // cmd-up/down
-        scrollEnd(code == 36 || code == 38); return e.stop();
-      }
-      if (mod && code == 65) {selectAll(); return e.stop();} // ctrl-a
-      if (!options.readOnly) {
-        if (!anyMod && code == 13) {return;} // enter
-        if (!anyMod && code == 9 && handleTab(e.e.shiftKey)) return e.stop(); // tab
-        if (mod && code == 90) {undo(); return e.stop();} // ctrl-z
-        if (mod && ((e.e.shiftKey && code == 90) || code == 89)) {redo(); return e.stop();} // ctrl-shift-z, ctrl-y
-      }
-
-      // Key id to use in the movementKeys map. We also pass it to
-      // fastPoll in order to 'self learn'. We need this because
-      // reducedSelection, the hack where we collapse the selection to
-      // its start when it is inverted and a movement key is pressed
-      // (and later restore it again), shouldn't be used for
-      // non-movement keys.
-      curKeyId = (mod ? "c" : "") + code;
-      if (sel.inverted && movementKeys.hasOwnProperty(curKeyId)) {
-        var range = selRange(input);
-        if (range) {
-          reducedSelection = {anchor: range.start};
-          setSelRange(input, range.start, range.start);
-        }
-      }
-      fastPoll(curKeyId);
-    }
-    function onKeyUp(e) {
-      //if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e.e))) return;
-      if (reducedSelection) {
-        reducedSelection = null;
-        updateInput = true;
-      }
-      if (e.e.keyCode == 16) shiftSelecting = null;
-    }
-    function onKeyPress(e) {
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e.e))) return;
-      if (options.electricChars && mode.electricChars) {
-        var ch = String.fromCharCode(e.e.charCode == null ? e.e.keyCode : e.e.charCode);
-        if (mode.electricChars.indexOf(ch) > -1)
-          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50);
-      }
-      var code = e.e.keyCode;
-      // Re-stop tab and enter. Necessary on some browsers.
-      if (code == 13) {if (!options.readOnly) handleEnter(); e.stop();}
-      else if (!e.e.ctrlKey && !e.e.altKey && !e.e.metaKey && code == 9 && options.tabMode != "default") e.stop();
-      else fastPoll(curKeyId);
-    }
-
-    function onFocus() {
-      if (options.readOnly == "nocursor") return;
-      if (!focused && options.onFocus) options.onFocus(instance);
-      focused = true;
-      slowPoll();
-      if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
-        wrapper.className += " CodeMirror-focused";
-      restartBlink();
-    }
-    function onBlur() {
-      if (focused && options.onBlur) options.onBlur(instance);
-      clearInterval(blinker);
-      shiftSelecting = null;
-      focused = false;
-      wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
-    }
-
-    // Replace the range from from to to by the strings in newText.
-    // Afterwards, set the selection to selFrom, selTo.
-    function updateLines(from, to, newText, selFrom, selTo) {
-      if (history) {
-        var old = [];
-        for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);
-        history.addChange(from.line, newText.length, old);
-        while (history.done.length > options.undoDepth) history.done.shift();
-      }
-      updateLinesNoUndo(from, to, newText, selFrom, selTo);
-    }
-    function unredoHelper(from, to) {
-      var change = from.pop();
-      if (change) {
-        var replaced = [], end = change.start + change.added;
-        for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);
-        to.push({start: change.start, added: change.old.length, old: replaced});
-        var pos = clipPos({line: change.start + change.old.length - 1,
-                           ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
-        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);
-      }
-    }
-    function undo() {unredoHelper(history.done, history.undone);}
-    function redo() {unredoHelper(history.undone, history.done);}
-
-    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
-      var recomputeMaxLength = false, maxLineLength = maxLine.length;
-      for (var i = from.line; i < to.line; ++i) {
-        if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}
-      }
-
-      var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];
-      // First adjust the line structure, taking some care to leave highlighting intact.
-      if (firstLine == lastLine) {
-        if (newText.length == 1)
-          firstLine.replace(from.ch, to.ch, newText[0]);
-        else {
-          lastLine = firstLine.split(to.ch, newText[newText.length-1]);
-          var spliceargs = [from.line + 1, nlines];
-          firstLine.replace(from.ch, firstLine.text.length, newText[0]);
-          for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
-          spliceargs.push(lastLine);
-          lines.splice.apply(lines, spliceargs);
-        }
-      }
-      else if (newText.length == 1) {
-        firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));
-        lines.splice(from.line + 1, nlines);
-      }
-      else {
-        var spliceargs = [from.line + 1, nlines - 1];
-        firstLine.replace(from.ch, firstLine.text.length, newText[0]);
-        lastLine.replace(0, to.ch, newText[newText.length-1]);
-        for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
-        lines.splice.apply(lines, spliceargs);
-      }
-
-
-      for (var i = from.line, e = i + newText.length; i < e; ++i) {
-        var l = lines[i].text;
-        if (l.length > maxLineLength) {
-          maxLine = l; maxLineLength = l.length;
-          recomputeMaxLength = false;
-        }
-      }
-      if (recomputeMaxLength) {
-        maxLineLength = 0;
-        for (var i = 0, e = lines.length; i < e; ++i) {
-          var l = lines[i].text;
-          if (l.length > maxLineLength) {
-            maxLineLength = l.length; maxLine = l;
-          }
-        }
-      }
-
-      // Add these lines to the work array, so that they will be
-      // highlighted. Adjust work lines if lines were added/removed.
-      var newWork = [], lendiff = newText.length - nlines - 1;
-      for (var i = 0, l = work.length; i < l; ++i) {
-        var task = work[i];
-        if (task < from.line) newWork.push(task);
-        else if (task > to.line) newWork.push(task + lendiff);
-      }
-      if (newText.length) newWork.push(from.line);
-      work = newWork;
-      startWorker(100);
-      // Remember that these lines changed, for updating the display
-      changes.push({from: from.line, to: to.line + 1, diff: lendiff});
-      textChanged = {from: from, to: to, text: newText};
-
-      // Update the selection
-      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
-      setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
-
-      // Make sure the scroll-size div has the correct height.
-      code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
-    }
-
-    function replaceRange(code, from, to) {
-      from = clipPos(from);
-      if (!to) to = from; else to = clipPos(to);
-      code = splitLines(code);
-      function adjustPos(pos) {
-        if (posLess(pos, from)) return pos;
-        if (!posLess(to, pos)) return end;
-        var line = pos.line + code.length - (to.line - from.line) - 1;
-        var ch = pos.ch;
-        if (pos.line == to.line)
-          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
-        return {line: line, ch: ch};
-      }
-      var end;
-      replaceRange1(code, from, to, function(end1) {
-        end = end1;
-        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
-      });
-      return end;
-    }
-    function replaceSelection(code, collapse) {
-      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
-        if (collapse == "end") return {from: end, to: end};
-        else if (collapse == "start") return {from: sel.from, to: sel.from};
-        else return {from: sel.from, to: end};
-      });
-    }
-    function replaceRange1(code, from, to, computeSel) {
-      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
-      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
-      updateLines(from, to, code, newSel.from, newSel.to);
-    }
-
-    function getRange(from, to) {
-      var l1 = from.line, l2 = to.line;
-      if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);
-      var code = [lines[l1].text.slice(from.ch)];
-      for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);
-      code.push(lines[l2].text.slice(0, to.ch));
-      return code.join("\n");
-    }
-    function getSelection() {
-      return getRange(sel.from, sel.to);
-    }
-
-    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
-    function slowPoll() {
-      if (pollingFast) return;
-      poll.set(2000, function() {
-        startOperation();
-        readInput();
-        if (focused) slowPoll();
-        endOperation();
-      });
-    }
-    function fastPoll(keyId) {
-      var missed = false;
-      pollingFast = true;
-      function p() {
-        startOperation();
-        var changed = readInput();
-        if (changed == "moved" && keyId) movementKeys[keyId] = true;
-        if (!changed && !missed) {missed = true; poll.set(80, p);}
-        else {pollingFast = false; slowPoll();}
-        endOperation();
-      }
-      poll.set(20, p);
-    }
-
-    // Inspects the textarea, compares its state (content, selection)
-    // to the data in the editing variable, and updates the editor
-    // content or cursor if something changed.
-    function readInput() {
-      if (leaveInputAlone) return;
-      var changed = false, text = input.value, sr = selRange(input);
-      if (!sr) return false;
-      var changed = editing.text != text, rs = reducedSelection;
-      var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);
-      if (!moved && !rs) return false;
-      if (changed) {
-        shiftSelecting = reducedSelection = null;
-        if (options.readOnly) {updateInput = true; return "changed";}
-      }
-
-      // Compute selection start and end based on start/end offsets in textarea
-      function computeOffset(n, startLine) {
-        var pos = 0;
-        for (;;) {
-          var found = text.indexOf("\n", pos);
-          if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n)
-            return {line: startLine, ch: n - pos};
-          ++startLine;
-          pos = found + 1;
-        }
-      }
-      var from = computeOffset(sr.start, editing.from),
-          to = computeOffset(sr.end, editing.from);
-      // Here we have to take the reducedSelection hack into account,
-      // so that you can, for example, press shift-up at the start of
-      // your selection and have the right thing happen.
-      if (rs) {
-        from = sr.start == rs.anchor ? to : from;
-        to = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
-        if (!posLess(from, to)) {
-          reducedSelection = null;
-          sel.inverted = false;
-          var tmp = from; from = to; to = tmp;
-        }
-      }
-
-      // In some cases (cursor on same line as before), we don't have
-      // to update the textarea content at all.
-      if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)
-        updateInput = false;
-
-      // Magic mess to extract precise edited range from the changed
-      // string.
-      if (changed) {
-        var start = 0, end = text.length, len = Math.min(end, editing.text.length);
-        var c, line = editing.from, nl = -1;
-        while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {
-          ++start;
-          if (c == "\n") {line++; nl = start;}
-        }
-        var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;
-        for (;;) {
-          c = editing.text.charAt(edend);
-          if (c == "\n") endline--;
-          if (text.charAt(end) != c) {++end; ++edend; break;}
-          if (edend <= start || end <= start) break;
-          --end; --edend;
-        }
-        var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;
-        updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);
-        if (line != endline || from.line != line) updateInput = true;
-      }
-      else setSelection(from, to);
-
-      editing.text = text; editing.start = sr.start; editing.end = sr.end;
-      return changed ? "changed" : moved ? "moved" : false;
-    }
-
-    // Set the textarea content and selection range to match the
-    // editor state.
-    function prepareInput() {
-      var text = [];
-      var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);
-      for (var i = from; i < to; ++i) text.push(lines[i].text);
-      text = input.value = text.join(lineSep);
-      var startch = sel.from.ch, endch = sel.to.ch;
-      for (var i = from; i < sel.from.line; ++i)
-        startch += lineSep.length + lines[i].text.length;
-      for (var i = from; i < sel.to.line; ++i)
-        endch += lineSep.length + lines[i].text.length;
-      editing = {text: text, from: from, to: to, start: startch, end: endch};
-      setSelRange(input, startch, reducedSelection ? startch : endch);
-    }
-    function focusInput() {
-      if (options.readOnly != "nocursor") input.focus();
-    }
-
-    function scrollCursorIntoView() {
-      var cursor = localCoords(sel.inverted ? sel.from : sel.to);
-      return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);
-    }
-    function scrollIntoView(x1, y1, x2, y2) {
-      var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();
-      y1 += pt; y2 += pt; x1 += pl; x2 += pl;
-      var screen = wrapper.clientHeight, screentop = wrapper.scrollTop, scrolled = false, result = true;
-      if (y1 < screentop) {wrapper.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
-      else if (y2 > screentop + screen) {wrapper.scrollTop = y2 + lh - screen; scrolled = true;}
-
-      var screenw = wrapper.clientWidth, screenleft = wrapper.scrollLeft;
-      if (x1 < screenleft) {wrapper.scrollLeft = Math.max(0, x1 - 10); scrolled = true;}
-      else if (x2 > screenw + screenleft) {
-        wrapper.scrollLeft = x2 + 10 - screenw;
-        scrolled = true;
-        if (x2 > code.clientWidth) result = false;
-      }
-      if (scrolled && options.onScroll) options.onScroll(instance);
-      return result;
-    }
-
-    function visibleLines() {
-      var lh = lineHeight(), top = wrapper.scrollTop - paddingTop();
-      return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),
-              to: Math.min(lines.length, Math.ceil((top + wrapper.clientHeight) / lh))};
-    }
-    // Uses a set of changes plus the current scroll position to
-    // determine which DOM updates have to be made, and makes the
-    // updates.
-    function updateDisplay(changes) {
-      if (!wrapper.clientWidth) {
-        showingFrom = showingTo = 0;
-        return;
-      }
-      // First create a range of theoretically intact lines, and punch
-      // holes in that using the change info.
-      var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];
-      for (var i = 0, l = changes.length || 0; i < l; ++i) {
-        var change = changes[i], intact2 = [], diff = change.diff || 0;
-        for (var j = 0, l2 = intact.length; j < l2; ++j) {
-          var range = intact[j];
-          if (change.to <= range.from)
-            intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});
-          else if (range.to <= change.from)
-            intact2.push(range);
-          else {
-            if (change.from > range.from)
-              intact2.push({from: range.from, to: change.from, domStart: range.domStart})
-            if (change.to < range.to)
-              intact2.push({from: change.to + diff, to: range.to + diff,
-                            domStart: range.domStart + (change.to - range.from)});
-          }
-        }
-        intact = intact2;
-      }
-
-      // Then, determine which lines we'd want to see, and which
-      // updates have to be made to get there.
-      var visible = visibleLines();
-      var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),
-          to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),
-          updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;
-
-      for (var i = 0, l = intact.length; i < l; ++i) {
-        var range = intact[i];
-        if (range.to <= from) continue;
-        if (range.from >= to) break;
-        if (range.domStart > domPos || range.from > pos) {
-          updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});
-          changedLines += range.from - pos;
-        }
-        pos = range.to;
-        domPos = range.domStart + (range.to - range.from);
-      }
-      if (domPos != domEnd || pos != to) {
-        changedLines += Math.abs(to - pos);
-        updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});
-      }
-
-      if (!updates.length) return;
-      lineDiv.style.display = "none";
-      // If more than 30% of the screen needs update, just do a full
-      // redraw (which is quicker than patching)
-      if (changedLines > (visible.to - visible.from) * .3)
-        refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));
-      // Otherwise, only update the stuff that needs updating.
-      else
-        patchDisplay(updates);
-      lineDiv.style.display = "";
-
-      // Position the mover div to align with the lines it's supposed
-      // to be showing (which will cover the visible display)
-      var different = from != showingFrom || to != showingTo || lastHeight != wrapper.clientHeight;
-      showingFrom = from; showingTo = to;
-      mover.style.top = (from * lineHeight()) + "px";
-      if (different) {
-        lastHeight = wrapper.clientHeight;
-        code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
-        updateGutter();
-      }
-
-      var textWidth = stringWidth(maxLine);
-      lineSpace.style.width = textWidth > wrapper.clientWidth ? textWidth + "px" : "";
-
-      // Since this is all rather error prone, it is honoured with the
-      // only assertion in the whole file.
-      if (lineDiv.childNodes.length != showingTo - showingFrom)
-        throw new Error("BAD PATCH! " + JSON.stringify(updates) + " size=" + (showingTo - showingFrom) +
-                        " nodes=" + lineDiv.childNodes.length);
-      updateCursor();
-    }
-
-    function refreshDisplay(from, to) {
-      var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);
-      for (var i = from; i < to; ++i) {
-        var ch1 = null, ch2 = null;
-        if (inSel) {
-          ch1 = 0;
-          if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}
-        }
-        else if (sel.from.line == i) {
-          if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
-          else {inSel = true; ch1 = sel.from.ch;}
-        }
-        html.push(lines[i].getHTML(ch1, ch2, true));
-      }
-      lineDiv.innerHTML = html.join("");
-    }
-    function patchDisplay(updates) {
-      // Slightly different algorithm for IE (badInnerHTML), since
-      // there .innerHTML on PRE nodes is dumb, and discards
-      // whitespace.
-      var sfrom = sel.from.line, sto = sel.to.line, off = 0,
-          scratch = badInnerHTML && targetDocument.createElement("div");
-      for (var i = 0, e = updates.length; i < e; ++i) {
-        var rec = updates[i];
-        var extra = (rec.to - rec.from) - rec.domSize;
-        var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;
-        if (badInnerHTML)
-          for (var j = Math.max(-extra, rec.domSize); j > 0; --j)
-            lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
-        else if (extra) {
-          for (var j = Math.max(0, extra); j > 0; --j)
-            lineDiv.insertBefore(targetDocument.createElement("pre"), nodeAfter);
-          for (var j = Math.max(0, -extra); j > 0; --j)
-            lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
-        }
-        var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;
-        for (var j = rec.from; j < rec.to; ++j) {
-          var ch1 = null, ch2 = null;
-          if (inSel) {
-            ch1 = 0;
-            if (sto == j) {inSel = false; ch2 = sel.to.ch;}
-          }
-          else if (sfrom == j) {
-            if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
-            else {inSel = true; ch1 = sel.from.ch;}
-          }
-          if (badInnerHTML) {
-            scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);
-            lineDiv.insertBefore(scratch.firstChild, nodeAfter);
-          }
-          else {
-            node.innerHTML = lines[j].getHTML(ch1, ch2, false);
-            node.className = lines[j].className || "";
-            node = node.nextSibling;
-          }
-        }
-        off += extra;
-      }
-    }
-
-    function updateGutter() {
-      if (!options.gutter && !options.lineNumbers) return;
-      var hText = mover.offsetHeight, hEditor = wrapper.clientHeight;
-      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
-      var html = [];
-      for (var i = showingFrom; i < showingTo; ++i) {
-        var marker = lines[i].gutterMarker;
-        var text = options.lineNumbers ? i + options.firstLineNumber : null;
-        if (marker && marker.text)
-          text = marker.text.replace("%N%", text != null ? text : "");
-        else if (text == null)
-          text = "\u00a0";
-        html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text, "</pre>");
-      }
-      gutter.style.display = "none";
-      gutterText.innerHTML = html.join("");
-      var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
-      while (val.length + pad.length < minwidth) pad += "\u00a0";
-      if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
-      gutter.style.display = "";
-      lineSpace.style.marginLeft = gutter.offsetWidth + "px";
-    }
-    function updateCursor() {
-      var head = sel.inverted ? sel.from : sel.to;
-      var x = charX(head.line, head.ch) + "px", y = (head.line - showingFrom) * lineHeight() + "px";
-      inputDiv.style.top = y;
-      if (posEq(sel.from, sel.to)) {
-        cursor.style.top = y; cursor.style.left = x;
-        cursor.style.display = "";
-      }
-      else cursor.style.display = "none";
-    }
-
-    function setSelectionUser(from, to) {
-      var sh = shiftSelecting && clipPos(shiftSelecting);
-      if (sh) {
-        if (posLess(sh, from)) from = sh;
-        else if (posLess(to, sh)) to = sh;
-      }
-      setSelection(from, to);
-    }
-    // Update the selection. Last two args are only used by
-    // updateLines, since they have to be expressed in the line
-    // numbers before the update.
-    function setSelection(from, to, oldFrom, oldTo) {
-      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
-      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
-
-      var startEq = posEq(sel.to, to), endEq = posEq(sel.from, from);
-      if (posEq(from, to)) sel.inverted = false;
-      else if (startEq && !endEq) sel.inverted = true;
-      else if (endEq && !startEq) sel.inverted = false;
-
-      // Some ugly logic used to only mark the lines that actually did
-      // see a change in selection as changed, rather than the whole
-      // selected range.
-      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
-      if (posEq(from, to)) {
-        if (!posEq(sel.from, sel.to))
-          changes.push({from: oldFrom, to: oldTo + 1});
-      }
-      else if (posEq(sel.from, sel.to)) {
-        changes.push({from: from.line, to: to.line + 1});
-      }
-      else {
-        if (!posEq(from, sel.from)) {
-          if (from.line < oldFrom)
-            changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
-          else
-            changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
-        }
-        if (!posEq(to, sel.to)) {
-          if (to.line < oldTo)
-            changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});
-          else
-            changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});
-        }
-      }
-      sel.from = from; sel.to = to;
-      selectionChanged = true;
-    }
-    function setCursor(line, ch, user) {
-      var pos = clipPos({line: line, ch: ch || 0});
-      (user ? setSelectionUser : setSelection)(pos, pos);
-    }
-
-    function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}
-    function clipPos(pos) {
-      if (pos.line < 0) return {line: 0, ch: 0};
-      if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};
-      var ch = pos.ch, linelen = lines[pos.line].text.length;
-      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
-      else if (ch < 0) return {line: pos.line, ch: 0};
-      else return pos;
-    }
-
-    function scrollPage(down) {
-      var linesPerPage = Math.floor(wrapper.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;
-      setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);
-    }
-    function scrollEnd(top) {
-      setCursor(top ? 0 : lines.length - 1, true);
-    }
-    function selectAll() {
-      var endLine = lines.length - 1;
-      setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});
-    }
-    function selectWordAt(pos) {
-      var line = lines[pos.line].text;
-      var start = pos.ch, end = pos.ch;
-      while (start > 0 && /\w/.test(line.charAt(start - 1))) --start;
-      while (end < line.length && /\w/.test(line.charAt(end))) ++end;
-      setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
-    }
-    function selectLine(line) {
-      setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});
-    }
-    function handleEnter() {
-      replaceSelection("\n", "end");
-      if (options.enterMode != "flat")
-        indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart");
-    }
-    function handleTab(shift) {
-      shiftSelecting = null;
-      switch (options.tabMode) {
-      case "default":
-        return false;
-      case "indent":
-        for (var i = sel.from.line, e = sel.to.line; i <= e; ++i) indentLine(i, "smart");
-        break;
-      case "classic":
-        if (posEq(sel.from, sel.to)) {
-          if (shift) indentLine(sel.from.line, "smart");
-          else replaceSelection("\t", "end");
-          break;
-        }
-      case "shift":
-        for (var i = sel.from.line, e = sel.to.line; i <= e; ++i) indentLine(i, shift ? "subtract" : "add");
-        break;
-      }
-      return true;
-    }
-
-    function indentLine(n, how) {
-      if (how == "smart") {
-        if (!mode.indent) how = "prev";
-        else var state = getStateBefore(n);
-      }
-
-      var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation;
-      if (how == "prev") {
-        if (n) indentation = lines[n-1].indentation();
-        else indentation = 0;
-      }
-      else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
-      else if (how == "add") indentation = curSpace + options.indentUnit;
-      else if (how == "subtract") indentation = curSpace - options.indentUnit;
-      indentation = Math.max(0, indentation);
-      var diff = indentation - curSpace;
-
-      if (!diff) {
-        if (sel.from.line != n && sel.to.line != n) return;
-        var indentString = curSpaceString;
-      }
-      else {
-        var indentString = "", pos = 0;
-        if (options.indentWithTabs)
-          for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
-        while (pos < indentation) {++pos; indentString += " ";}
-      }
-
-      replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
-    }
-
-    function loadMode() {
-      mode = CodeMirror.getMode(options, options.mode);
-      for (var i = 0, l = lines.length; i < l; ++i)
-        lines[i].stateAfter = null;
-      work = [0];
-      startWorker();
-    }
-    function gutterChanged() {
-      var visible = options.gutter || options.lineNumbers;
-      gutter.style.display = visible ? "" : "none";
-      if (visible) updateGutter();
-      else lineDiv.parentNode.style.marginLeft = 0;
-    }
-
-    function markText(from, to, className) {
-      from = clipPos(from); to = clipPos(to);
-      var accum = [];
-      function add(line, from, to, className) {
-        var line = lines[line], mark = line.addMark(from, to, className);
-        mark.line = line;
-        accum.push(mark);
-      }
-      if (from.line == to.line) add(from.line, from.ch, to.ch, className);
-      else {
-        add(from.line, from.ch, null, className);
-        for (var i = from.line + 1, e = to.line; i < e; ++i)
-          add(i, 0, null, className);
-        add(to.line, 0, to.ch, className);
-      }
-      changes.push({from: from.line, to: to.line + 1});
-      return function() {
-        var start, end;
-        for (var i = 0; i < accum.length; ++i) {
-          var mark = accum[i], found = indexOf(lines, mark.line);
-          mark.line.removeMark(mark);
-          if (found > -1) {
-            if (start == null) start = found;
-            end = found;
-          }
-        }
-        if (start != null) changes.push({from: start, to: end + 1});
-      };
-    }
-
-    function addGutterMarker(line, text, className) {
-      if (typeof line == "number") line = lines[clipLine(line)];
-      line.gutterMarker = {text: text, style: className};
-      updateGutter();
-      return line;
-    }
-    function removeGutterMarker(line) {
-      if (typeof line == "number") line = lines[clipLine(line)];
-      line.gutterMarker = null;
-      updateGutter();
-    }
-    function setLineClass(line, className) {
-      if (typeof line == "number") {
-        var no = line;
-        line = lines[clipLine(line)];
-      }
-      else {
-        var no = indexOf(lines, line);
-        if (no == -1) return null;
-      }
-      if (line.className != className) {
-        line.className = className;
-        changes.push({from: no, to: no + 1});
-      }
-      return line;
-    }
-
-    function lineInfo(line) {
-      if (typeof line == "number") {
-        var n = line;
-        line = lines[line];
-        if (!line) return null;
-      }
-      else {
-        var n = indexOf(lines, line);
-        if (n == -1) return null;
-      }
-      var marker = line.gutterMarker;
-      return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};
-    }
-
-    function stringWidth(str) {
-      measure.innerHTML = "<pre><span>x</span></pre>";
-      measure.firstChild.firstChild.firstChild.nodeValue = str;
-      return measure.firstChild.firstChild.offsetWidth || 10;
-    }
-    // These are used to go from pixel positions to character
-    // positions, taking varying character widths into account.
-    function charX(line, pos) {
-      if (pos == 0) return 0;
-      measure.innerHTML = "<pre><span>" + lines[line].getHTML(null, null, false, pos) + "</span></pre>";
-      return measure.firstChild.firstChild.offsetWidth;
-    }
-    function charFromX(line, x) {
-      if (x <= 0) return 0;
-      var lineObj = lines[line], text = lineObj.text;
-      function getX(len) {
-        measure.innerHTML = "<pre><span>" + lineObj.getHTML(null, null, false, len) + "</span></pre>";
-        return measure.firstChild.firstChild.offsetWidth;
-      }
-      var from = 0, fromX = 0, to = text.length, toX;
-      // Guess a suitable upper bound for our search.
-      var estimated = Math.min(to, Math.ceil(x / stringWidth("x")));
-      for (;;) {
-        var estX = getX(estimated);
-        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
-        else {toX = estX; to = estimated; break;}
-      }
-      if (x > toX) return to;
-      // Try to guess a suitable lower bound as well.
-      estimated = Math.floor(to * 0.8); estX = getX(estimated);
-      if (estX < x) {from = estimated; fromX = estX;}
-      // Do a binary search between these bounds.
-      for (;;) {
-        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
-        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
-        if (middleX > x) {to = middle; toX = middleX;}
-        else {from = middle; fromX = middleX;}
-      }
-    }
-
-    function localCoords(pos, inLineWrap) {
-      var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);
-      return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};
-    }
-    function pageCoords(pos) {
-      var local = localCoords(pos, true), off = eltOffset(lineSpace);
-      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
-    }
-
-    function lineHeight() {
-      var nlines = lineDiv.childNodes.length;
-      if (nlines) return (lineDiv.offsetHeight / nlines) || 1;
-      measure.innerHTML = "<pre>x</pre>";
-      return measure.firstChild.offsetHeight || 1;
-    }
-    function paddingTop() {return lineSpace.offsetTop;}
-    function paddingLeft() {return lineSpace.offsetLeft;}
-
-    function posFromMouse(e, liberal) {
-      var offW = eltOffset(wrapper, true), x = e.e.clientX, y = e.e.clientY;
-      // This is a mess of a heuristic to try and determine whether a
-      // scroll-bar was clicked or not, and to return null if one was
-      // (and !liberal).
-      if (!liberal && (x - offW.left > wrapper.clientWidth || y - offW.top > wrapper.clientHeight))
-        return null;
-      var offL = eltOffset(lineSpace, true);
-      var line = showingFrom + Math.floor((y - offL.top) / lineHeight());
-      return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});
-    }
-    function onContextMenu(e) {
-      var pos = posFromMouse(e);
-      if (!pos || window.opera) return; // Opera is difficult.
-      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
-        setCursor(pos.line, pos.ch);
-
-      var oldCSS = input.style.cssText;
-      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.pageY() - 1) +
-        "px; left: " + (e.pageX() - 1) + "px; z-index: 1000; background: white; " +
-        "border-width: 0; outline: none; overflow: hidden;";
-      var val = input.value = getSelection();
-      focusInput();
-      setSelRange(input, 0, input.value.length);
-      leaveInputAlone = true;
-      function rehide() {
-        if (input.value != val) operation(replaceSelection)(input.value, "end");
-        input.style.cssText = oldCSS;
-        leaveInputAlone = false;
-        prepareInput();
-        slowPoll();
-      }
-      
-      if (gecko) {
-        e.stop()
-        var mouseup = connect(window, "mouseup", function() {
-          mouseup();
-          setTimeout(rehide, 20);
-        }, true);
-      }
-      else {
-        setTimeout(rehide, 50);
-      }
-    }
-
-    // Cursor-blinking
-    function restartBlink() {
-      clearInterval(blinker);
-      var on = true;
-      cursor.style.visibility = "";
-      blinker = setInterval(function() {
-        cursor.style.visibility = (on = !on) ? "" : "hidden";
-      }, 650);
-    }
-
-    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
-    function matchBrackets(autoclear) {
-      var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;
-      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
-      if (!match) return;
-      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
-      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
-        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
-
-      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
-      function scan(line, from, to) {
-        if (!line.text) return;
-        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
-        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
-          var text = st[i];
-          if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
-          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
-            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
-              var match = matching[cur];
-              if (match.charAt(1) == ">" == forward) stack.push(cur);
-              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
-              else if (!stack.length) return {pos: pos, match: true};
-            }
-          }
-        }
-      }
-      for (var i = head.line, e = forward ? Math.min(i + 50, lines.length) : Math.max(-1, i - 50); i != e; i+=d) {
-        var line = lines[i], first = i == head.line;
-        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
-        if (found) {
-          var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
-          var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
-              two = markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
-          var clear = operation(function(){one(); two();});
-          if (autoclear) setTimeout(clear, 800);
-          else bracketHighlighted = clear;
-          break;
-        }
-      }
-    }
-
-    // Finds the line to start with when starting a parse. Tries to
-    // find a line with a stateAfter, so that it can start with a
-    // valid state. If that fails, it returns the line with the
-    // smallest indentation, which tends to need the least context to
-    // parse correctly.
-    function findStartLine(n) {
-      var minindent, minline;
-      for (var search = n, lim = n - 40; search > lim; --search) {
-        if (search == 0) return 0;
-        var line = lines[search-1];
-        if (line.stateAfter) return search;
-        var indented = line.indentation();
-        if (minline == null || minindent > indented) {
-          minline = search;
-          minindent = indented;
-        }
-      }
-      return minline;
-    }
-    function getStateBefore(n) {
-      var start = findStartLine(n), state = start && lines[start-1].stateAfter;
-      if (!state) state = startState(mode);
-      else state = copyState(mode, state);
-      for (var i = start; i < n; ++i) {
-        var line = lines[i];
-        line.highlight(mode, state);
-        line.stateAfter = copyState(mode, state);
-      }
-      if (!lines[n].stateAfter) work.push(n);
-      return state;
-    }
-    function highlightWorker() {
-      var end = +new Date + options.workTime;
-      var didSomething = false;
-      while (work.length) {
-        if (!lines[showingFrom].stateAfter) var task = showingFrom;
-        else var task = work.pop();
-        if (task >= lines.length) continue;
-        didSomething = true;
-        var start = findStartLine(task), state = start && lines[start-1].stateAfter;
-        if (state) state = copyState(mode, state);
-        else state = startState(mode);
-
-        for (var i = start, l = lines.length; i < l; ++i) {
-          var line = lines[i], hadState = line.stateAfter;
-          if (+new Date > end) {
-            work.push(i);
-            startWorker(options.workDelay);
-            changes.push({from: task, to: i});
-            return;
-          }
-          var changed = line.highlight(mode, state);
-          line.stateAfter = copyState(mode, state);
-          //if (hadState && !changed && line.text) break;
-        }
-        changes.push({from: task, to: i});
-      }
-      if (didSomething && options.onHighlightComplete)
-        options.onHighlightComplete(instance);
-    }
-    function startWorker(time) {
-      if (!work.length) return;
-      highlight.set(time, operation(highlightWorker));
-    }
-
-    // Operations are used to wrap changes in such a way that each
-    // change won't have to update the cursor and display (which would
-    // be awkward, slow, and error-prone), but instead updates are
-    // batched and then all combined and executed at once.
-    function startOperation() {
-      updateInput = null; changes = []; textChanged = selectionChanged = false;
-    }
-    function endOperation() {
-      var reScroll = false;
-      if (selectionChanged) reScroll = !scrollCursorIntoView();
-      if (changes.length) updateDisplay(changes);
-      else if (selectionChanged) updateCursor();
-      if (reScroll) scrollCursorIntoView();
-      if (selectionChanged) restartBlink();
-
-      // updateInput can be set to a boolean value to force/prevent an
-      // update.
-      if (!leaveInputAlone && (updateInput === true || (updateInput !== false && selectionChanged)))
-        prepareInput();
-
-      if (selectionChanged && options.matchBrackets)
-        setTimeout(operation(function() {
-          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
-          matchBrackets(false);
-        }), 20);
-      var tc = textChanged; // textChanged can be reset by cursoractivity callback
-      if (selectionChanged && options.onCursorActivity)
-        options.onCursorActivity(instance);
-      if (tc && options.onChange && instance)
-        options.onChange(instance, tc);
-    }
-    var nestedOperation = 0;
-    function operation(f) {
-      return function() {
-        if (!nestedOperation++) startOperation();
-        try {var result = f.apply(this, arguments);}
-        finally {if (!--nestedOperation) endOperation();}
-        return result;
-      };
-    }
-
-    function SearchCursor(query, pos, caseFold) {
-      this.atOccurrence = false;
-      if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
-
-      if (pos && typeof pos == "object") pos = clipPos(pos);
-      else pos = {line: 0, ch: 0};
-      this.pos = {from: pos, to: pos};
-
-      // The matches method is filled in based on the type of query.
-      // It takes a position and a direction, and returns an object
-      // describing the next occurrence of the query, or null if no
-      // more matches were found.
-      if (typeof query != "string") // Regexp match
-        this.matches = function(reverse, pos) {
-          if (reverse) {
-            var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;
-            while (match) {
-              var ind = line.indexOf(match[0]);
-              start += ind;
-              line = line.slice(ind + 1);
-              var newmatch = line.match(query);
-              if (newmatch) match = newmatch;
-              else break;
-            }
-          }
-          else {
-            var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),
-                start = match && pos.ch + line.indexOf(match[0]);
-          }
-          if (match)
-            return {from: {line: pos.line, ch: start},
-                    to: {line: pos.line, ch: start + match[0].length},
-                    match: match};
-        };
-      else { // String query
-        if (caseFold) query = query.toLowerCase();
-        var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
-        var target = query.split("\n");
-        // Different methods for single-line and multi-line queries
-        if (target.length == 1)
-          this.matches = function(reverse, pos) {
-            var line = fold(lines[pos.line].text), len = query.length, match;
-            if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
-                        : (match = line.indexOf(query, pos.ch)) != -1)
-              return {from: {line: pos.line, ch: match},
-                      to: {line: pos.line, ch: match + len}};
-          };
-        else
-          this.matches = function(reverse, pos) {
-            var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);
-            var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
-            if (reverse ? offsetA >= pos.ch || offsetA != match.length
-                        : offsetA <= pos.ch || offsetA != line.length - match.length)
-              return;
-            for (;;) {
-              if (reverse ? !ln : ln == lines.length - 1) return;
-              line = fold(lines[ln += reverse ? -1 : 1].text);
-              match = target[reverse ? --idx : ++idx];
-              if (idx > 0 && idx < target.length - 1) {
-                if (line != match) return;
-                else continue;
-              }
-              var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
-              if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
-                return;
-              var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
-              return {from: reverse ? end : start, to: reverse ? start : end};
-            }
-          };
-      }
-    }
-
-    SearchCursor.prototype = {
-      findNext: function() {return this.find(false);},
-      findPrevious: function() {return this.find(true);},
-
-      find: function(reverse) {
-        var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);
-        function savePosAndFail(line) {
-          var pos = {line: line, ch: 0};
-          self.pos = {from: pos, to: pos};
-          self.atOccurrence = false;
-          return false;
-        }
-
-        for (;;) {
-          if (this.pos = this.matches(reverse, pos)) {
-            this.atOccurrence = true;
-            return this.pos.match || true;
-          }
-          if (reverse) {
-            if (!pos.line) return savePosAndFail(0);
-            pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};
-          }
-          else {
-            if (pos.line == lines.length - 1) return savePosAndFail(lines.length);
-            pos = {line: pos.line+1, ch: 0};
-          }
-        }
-      },
-
-      from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},
-      to: function() {if (this.atOccurrence) return copyPos(this.pos.to);}
-    };
-
-    return instance;
-  } // (end of function CodeMirror)
-
-  // The default configuration options.
-  CodeMirror.defaults = {
-    value: "",
-    mode: null,
-    indentUnit: 2,
-    indentWithTabs: false,
-    tabMode: "classic",
-    enterMode: "indent",
-    electricChars: true,
-    onKeyEvent: null,
-    lineNumbers: false,
-    gutter: false,
-    firstLineNumber: 1,
-    readOnly: false,
-    onChange: null,
-    onCursorActivity: null,
-    onGutterClick: null,
-    onHighlightComplete: null,
-    onFocus: null, onBlur: null, onScroll: null,
-    matchBrackets: false,
-    workTime: 100,
-    workDelay: 200,
-    undoDepth: 40,
-    tabindex: null,
-    document: window.document
-  };
-
-  // Known modes, by name and by MIME
-  var modes = {}, mimeModes = {};
-  CodeMirror.defineMode = function(name, mode) {
-    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
-    modes[name] = mode;
-  };
-  CodeMirror.defineMIME = function(mime, spec) {
-    mimeModes[mime] = spec;
-  };
-  CodeMirror.getMode = function(options, spec) {
-    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
-      spec = mimeModes[spec];
-    if (typeof spec == "string")
-      var mname = spec, config = {};
-    else if (spec != null)
-      var mname = spec.name, config = spec;
-    var mfactory = modes[mname];
-    if (!mfactory) {
-      if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
-      return CodeMirror.getMode(options, "text/plain");
-    }
-    return mfactory(options, config || {});
-  }
-  CodeMirror.listModes = function() {
-    var list = [];
-    for (var m in modes)
-      if (modes.propertyIsEnumerable(m)) list.push(m);
-    return list;
-  };
-  CodeMirror.listMIMEs = function() {
-    var list = [];
-    for (var m in mimeModes)
-      if (mimeModes.propertyIsEnumerable(m)) list.push(m);
-    return list;
-  };
-
-  CodeMirror.fromTextArea = function(textarea, options) {
-    if (!options) options = {};
-    options.value = textarea.value;
-    if (!options.tabindex && textarea.tabindex)
-      options.tabindex = textarea.tabindex;
-
-    function save() {textarea.value = instance.getValue();}
-    if (textarea.form) {
-      // Deplorable hack to make the submit method do the right thing.
-      var rmSubmit = connect(textarea.form, "submit", save, true);
-      if (typeof textarea.form.submit == "function") {
-        var realSubmit = textarea.form.submit;
-        function wrappedSubmit() {
-          save();
-          textarea.form.submit = realSubmit;
-          textarea.form.submit();
-          textarea.form.submit = wrappedSubmit;
-        }
-        textarea.form.submit = wrappedSubmit;
-      }
-    }
-
-    textarea.style.display = "none";
-    var instance = CodeMirror(function(node) {
-      textarea.parentNode.insertBefore(node, textarea.nextSibling);
-    }, options);
-    instance.save = save;
-    instance.toTextArea = function() {
-      save();
-      textarea.parentNode.removeChild(instance.getWrapperElement());
-      textarea.style.display = "";
-      if (textarea.form) {
-        rmSubmit();
-        if (typeof textarea.form.submit == "function")
-          textarea.form.submit = realSubmit;
-      }
-    };
-    return instance;
-  };
-
-  // Utility functions for working with state. Exported because modes
-  // sometimes need to do this.
-  function copyState(mode, state) {
-    if (state === true) return state;
-    if (mode.copyState) return mode.copyState(state);
-    var nstate = {};
-    for (var n in state) {
-      var val = state[n];
-      if (val instanceof Array) val = val.concat([]);
-      nstate[n] = val;
-    }
-    return nstate;
-  }
-  CodeMirror.startState = startState;
-  function startState(mode, a1, a2) {
-    return mode.startState ? mode.startState(a1, a2) : true;
-  }
-  CodeMirror.copyState = copyState;
-
-  // The character stream used by a mode's parser.
-  function StringStream(string) {
-    this.pos = this.start = 0;
-    this.string = string;
-  }
-  StringStream.prototype = {
-    eol: function() {return this.pos >= this.string.length;},
-    sol: function() {return this.pos == 0;},
-    peek: function() {return this.string.charAt(this.pos);},
-    next: function() {
-      if (this.pos < this.string.length)
-        return this.string.charAt(this.pos++);
-    },
-    eat: function(match) {
-      var ch = this.string.charAt(this.pos);
-      if (typeof match == "string") var ok = ch == match;
-      else var ok = ch && (match.test ? match.test(ch) : match(ch));
-      if (ok) {++this.pos; return ch;}
-    },
-    eatWhile: function(match) {
-      var start = this.start;
-      while (this.eat(match)){}
-      return this.pos > start;
-    },
-    eatSpace: function() {
-      var start = this.pos;
-      while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
-      return this.pos > start;
-    },
-    skipToEnd: function() {this.pos = this.string.length;},
-    skipTo: function(ch) {
-      var found = this.string.indexOf(ch, this.pos);
-      if (found > -1) {this.pos = found; return true;}
-    },
-    backUp: function(n) {this.pos -= n;},
-    column: function() {return countColumn(this.string, this.start);},
-    indentation: function() {return countColumn(this.string);},
-    match: function(pattern, consume, caseInsensitive) {
-      if (typeof pattern == "string") {
-        function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
-        if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
-          if (consume !== false) this.pos += pattern.length;
-          return true;
-        }
-      }
-      else {
-        var match = this.string.slice(this.pos).match(pattern);
-        if (match && consume !== false) this.pos += match[0].length;
-        return match;
-      }
-    },
-    current: function(){return this.string.slice(this.start, this.pos);}
-  };
-
-  // Line objects. These hold state related to a line, including
-  // highlighting info (the styles array).
-  function Line(text, styles) {
-    this.styles = styles || [text, null];
-    this.stateAfter = null;
-    this.text = text;
-    this.marked = this.gutterMarker = this.className = null;
-  }
-  Line.prototype = {
-    // Replace a piece of a line, keeping the styles around it intact.
-    replace: function(from, to, text) {
-      var st = [], mk = this.marked;
-      copyStyles(0, from, this.styles, st);
-      if (text) st.push(text, null);
-      copyStyles(to, this.text.length, this.styles, st);
-      this.styles = st;
-      this.text = this.text.slice(0, from) + text + this.text.slice(to);
-      this.stateAfter = null;
-      if (mk) {
-        var diff = text.length - (to - from), end = this.text.length;
-        function fix(n) {return n <= Math.min(to, to + diff) ? n : n + diff;}
-        for (var i = 0; i < mk.length; ++i) {
-          var mark = mk[i], del = false;
-          if (mark.from >= end) del = true;
-          else {mark.from = fix(mark.from); if (mark.to != null) mark.to = fix(mark.to);}
-          if (del || mark.from >= mark.to) {mk.splice(i, 1); i--;}
-        }
-      }
-    },
-    // Split a line in two, again keeping styles intact.
-    split: function(pos, textBefore) {
-      var st = [textBefore, null];
-      copyStyles(pos, this.text.length, this.styles, st);
-      return new Line(textBefore + this.text.slice(pos), st);
-    },
-    addMark: function(from, to, style) {
-      var mk = this.marked, mark = {from: from, to: to, style: style};
-      if (this.marked == null) this.marked = [];
-      this.marked.push(mark);
-      this.marked.sort(function(a, b){return a.from - b.from;});
-      return mark;
-    },
-    removeMark: function(mark) {
-      var mk = this.marked;
-      if (!mk) return;
-      for (var i = 0; i < mk.length; ++i)
-        if (mk[i] == mark) {mk.splice(i, 1); break;}
-    },
-    // Run the given mode's parser over a line, update the styles
-    // array, which contains alternating fragments of text and CSS
-    // classes.
-    highlight: function(mode, state) {
-      var stream = new StringStream(this.text), st = this.styles, pos = 0;
-      var changed = false, curWord = st[0], prevWord;
-      if (this.text == "" && mode.blankLine) mode.blankLine(state);
-      while (!stream.eol()) {
-        var style = mode.token(stream, state);
-        var substr = this.text.slice(stream.start, stream.pos);
-        stream.start = stream.pos;
-        if (pos && st[pos-1] == style)
-          st[pos-2] += substr;
-        else if (substr) {
-          if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
-          st[pos++] = substr; st[pos++] = style;
-          prevWord = curWord; curWord = st[pos];
-        }
-        // Give up when line is ridiculously long
-        if (stream.pos > 5000) {
-          st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
-          break;
-        }
-      }
-      if (st.length != pos) {st.length = pos; changed = true;}
-      if (pos && st[pos-2] != prevWord) changed = true;
-      return changed;
-    },
-    // Fetch the parser token for a given character. Useful for hacks
-    // that want to inspect the mode state (say, for completion).
-    getTokenAt: function(mode, state, ch) {
-      var txt = this.text, stream = new StringStream(txt);
-      while (stream.pos < ch && !stream.eol()) {
-        stream.start = stream.pos;
-        var style = mode.token(stream, state);
-      }
-      return {start: stream.start,
-              end: stream.pos,
-              string: stream.current(),
-              className: style || null,
-              state: state};
-    },
-    indentation: function() {return countColumn(this.text);},
-    // Produces an HTML fragment for the line, taking selection,
-    // marking, and highlighting into account.
-    getHTML: function(sfrom, sto, includePre, endAt) {
-      var html = [];
-      if (includePre)
-        html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
-      function span(text, style) {
-        if (!text) return;
-        if (style) html.push('<span class="', style, '">', htmlEscape(text), "</span>");
-        else html.push(htmlEscape(text));
-      }
-      var st = this.styles, allText = this.text, marked = this.marked;
-      if (sfrom == sto) sfrom = null;
-      var len = allText.length;
-      if (endAt != null) len = Math.min(endAt, len);
-
-      if (!allText && endAt == null)
-        span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
-      else if (!marked && sfrom == null)
-        for (var i = 0, ch = 0; ch < len; i+=2) {
-          var str = st[i], l = str.length;
-          if (ch + l > len) str = str.slice(0, len - ch);
-          ch += l;
-          span(str, st[i+1]);
-        }
-      else {
-        var pos = 0, i = 0, text = "", style, sg = 0;
-        var markpos = -1, mark = null;
-        function nextMark() {
-          if (marked) {
-            markpos += 1;
-            mark = (markpos < marked.length) ? marked[markpos] : null;
-          }
-        }
-        nextMark();
-        while (pos < len) {
-          var upto = len;
-          var extraStyle = "";
-          if (sfrom != null) {
-            if (sfrom > pos) upto = sfrom;
-            else if (sto == null || sto > pos) {
-              extraStyle = " CodeMirror-selected";
-              if (sto != null) upto = Math.min(upto, sto);
-            }
-          }
-          while (mark && mark.to != null && mark.to <= pos) nextMark();
-          if (mark) {
-            if (mark.from > pos) upto = Math.min(upto, mark.from);
-            else {
-              extraStyle += " " + mark.style;
-              if (mark.to != null) upto = Math.min(upto, mark.to);
-            }
-          }
-          for (;;) {
-            var end = pos + text.length;
-            var apliedStyle = style;
-            if (extraStyle) apliedStyle = style ? style + extraStyle : extraStyle;
-            span(end > upto ? text.slice(0, upto - pos) : text, apliedStyle);
-            if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
-            pos = end;
-            text = st[i++]; style = st[i++];
-          }
-        }
-        if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
-      }
-      if (includePre) html.push("</pre>");
-      return html.join("");
-    }
-  };
-  // Utility used by replace and split above
-  function copyStyles(from, to, source, dest) {
-    for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
-      var part = source[i], end = pos + part.length;
-      if (state == 0) {
-        if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
-        if (end >= from) state = 1;
-      }
-      else if (state == 1) {
-        if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
-        else dest.push(part, source[i+1]);
-      }
-      pos = end;
-    }
-  }
-
-  // The history object 'chunks' changes that are made close together
-  // and at almost the same time into bigger undoable units.
-  function History() {
-    this.time = 0;
-    this.done = []; this.undone = [];
-  }
-  History.prototype = {
-    addChange: function(start, added, old) {
-      this.undone.length = 0;
-      var time = +new Date, last = this.done[this.done.length - 1];
-      if (time - this.time > 400 || !last ||
-          last.start > start + added || last.start + last.added < start - last.added + last.old.length)
-        this.done.push({start: start, added: added, old: old});
-      else {
-        var oldoff = 0;
-        if (start < last.start) {
-          for (var i = last.start - start - 1; i >= 0; --i)
-            last.old.unshift(old[i]);
-          last.added += last.start - start;
-          last.start = start;
-        }
-        else if (last.start < start) {
-          oldoff = start - last.start;
-          added += oldoff;
-        }
-        for (var i = last.added - oldoff, e = old.length; i < e; ++i)
-          last.old.push(old[i]);
-        if (last.added < added) last.added = added;
-      }
-      this.time = time;
-    }
-  };
-
-  // Event stopping compatibility wrapper.
-  function stopEvent() {
-    if (this.preventDefault) {this.preventDefault(); this.stopPropagation();}
-    else {this.returnValue = false; this.cancelBubble = true;}
-  }
-  // Ensure an event has a stop method.
-  function addStop(event) {
-    if (!event.stop) event.stop = stopEvent;
-    return event;
-  }
-
-  // Event wrapper, exposing the few operations we need.
-  function Event(orig) {this.e = orig;}
-  Event.prototype = {
-    stop: function() {stopEvent.call(this.e);},
-    target: function() {return this.e.target || this.e.srcElement;},
-    button: function() {
-      if (this.e.which) return this.e.which;
-      else if (this.e.button & 1) return 1;
-      else if (this.e.button & 2) return 3;
-      else if (this.e.button & 4) return 2;
-    },
-    pageX: function() {
-      if (this.e.pageX != null) return this.e.pageX;
-      var doc = this.target().ownerDocument;
-      return this.e.clientX + doc.body.scrollLeft + doc.documentElement.scrollLeft;
-    },
-    pageY: function() {
-      if (this.e.pageY != null) return this.e.pageY;
-      var doc = this.target().ownerDocument;
-      return this.e.clientY + doc.body.scrollTop + doc.documentElement.scrollTop;
-    }
-  };
-
-  // Event handler registration. If disconnect is true, it'll return a
-  // function that unregisters the handler.
-  function connect(node, type, handler, disconnect) {
-    function wrapHandler(event) {handler(new Event(event || window.event));}
-    if (typeof node.addEventListener == "function") {
-      node.addEventListener(type, wrapHandler, false);
-      if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);};
-    }
-    else {
-      node.attachEvent("on" + type, wrapHandler);
-      if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
-    }
-  }
-
-  function Delayed() {this.id = null;}
-  Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
-
-  // Some IE versions don't preserve whitespace when setting the
-  // innerHTML of a PRE tag.
-  var badInnerHTML = (function() {
-    var pre = document.createElement("pre");
-    pre.innerHTML = " "; return !pre.innerHTML;
-  })();
-
-  var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
-
-  var lineSep = "\n";
-  // Feature-detect whether newlines in textareas are converted to \r\n
-  (function () {
-    var te = document.createElement("textarea");
-    te.value = "foo\nbar";
-    if (te.value.indexOf("\r") > -1) lineSep = "\r\n";
-  }());
-
-  var tabSize = 8;
-  var mac = /Mac/.test(navigator.platform);
-  var movementKeys = {};
-  for (var i = 35; i <= 40; ++i)
-    movementKeys[i] = movementKeys["c" + i] = true;
-
-  // Counts the column offset in a string, taking tabs into account.
-  // Used mostly to find indentation.
-  function countColumn(string, end) {
-    if (end == null) {
-      end = string.search(/[^\s\u00a0]/);
-      if (end == -1) end = string.length;
-    }
-    for (var i = 0, n = 0; i < end; ++i) {
-      if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
-      else ++n;
-    }
-    return n;
-  }
-
-  // Find the position of an element by following the offsetParent chain.
-  // If screen==true, it returns screen (rather than page) coordinates.
-  function eltOffset(node, screen) {
-    var doc = node.ownerDocument.body;
-    var x = 0, y = 0, hitDoc = false;
-    for (var n = node; n; n = n.offsetParent) {
-      x += n.offsetLeft; y += n.offsetTop;
-      // Fixed-position elements don't have the document in their offset chain
-      if (n == doc) hitDoc = true;
-    }
-    var e = screen && hitDoc ? null : doc;
-    for (var n = node.parentNode; n != e; n = n.parentNode)
-      if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;}
-    return {left: x, top: y};
-  }
-  // Get a node's text content.
-  function eltText(node) {
-    return node.textContent || node.innerText || node.nodeValue || "";
-  }
-
-  // Operations on {line, ch} objects.
-  function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
-  function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
-  function copyPos(x) {return {line: x.line, ch: x.ch};}
-
-  function htmlEscape(str) {
-    return str.replace(/[<>&]/g, function(str) {
-      return str == "&" ? "&amp;" : str == "<" ? "&lt;" : "&gt;";
-    });
-  }
-
-  // Used to position the cursor after an undo/redo by finding the
-  // last edited character.
-  function editEnd(from, to) {
-    if (!to) return from ? from.length : 0;
-    if (!from) return to.length;
-    for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
-      if (from.charAt(i) != to.charAt(j)) break;
-    return j + 1;
-  }
-
-  function indexOf(collection, elt) {
-    if (collection.indexOf) return collection.indexOf(elt);
-    for (var i = 0, e = collection.length; i < e; ++i)
-      if (collection[i] == elt) return i;
-    return -1;
-  }
-
-  // See if "".split is the broken IE version, if so, provide an
-  // alternative way to split lines.
-  if ("\n\nb".split(/\n/).length != 3)
-    var splitLines = function(string) {
-      var pos = 0, nl, result = [];
-      while ((nl = string.indexOf("\n", pos)) > -1) {
-        result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl));
-        pos = nl + 1;
-      }
-      result.push(string.slice(pos));
-      return result;
-    };
-  else
-    var splitLines = function(string){return string.split(/\r?\n/);};
-
-  // Sane model of finding and setting the selection in a textarea
-  if (window.getSelection) {
-    var selRange = function(te) {
-      try {return {start: te.selectionStart, end: te.selectionEnd};}
-      catch(e) {return null;}
-    };
-    var setSelRange = function(te, start, end) {
-      try {te.setSelectionRange(start, end);}
-      catch(e) {} // Fails on Firefox when textarea isn't part of the document
-    };
-  }
-  // IE model. Don't ask.
-  else {
-    var selRange = function(te) {
-      try {var range = te.ownerDocument.selection.createRange();}
-      catch(e) {return null;}
-      if (!range || range.parentElement() != te) return null;
-      var val = te.value, len = val.length, localRange = te.createTextRange();
-      localRange.moveToBookmark(range.getBookmark());
-      var endRange = te.createTextRange();
-      endRange.collapse(false);
-
-      if (localRange.compareEndPoints("StartToEnd", endRange) > -1)
-        return {start: len, end: len};
-
-      var start = -localRange.moveStart("character", -len);
-      for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {}
-
-      if (localRange.compareEndPoints("EndToEnd", endRange) > -1)
-        return {start: start, end: len};
-
-      var end = -localRange.moveEnd("character", -len);
-      for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {}
-      return {start: start, end: end};
-    };
-    var setSelRange = function(te, start, end) {
-      var range = te.createTextRange();
-      range.collapse(true);
-      var endrange = range.duplicate();
-      var newlines = 0, txt = te.value;
-      for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1))
-        ++newlines;
-      range.move("character", start - newlines);
-      for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1))
-        ++newlines;
-      endrange.move("character", end - newlines);
-      range.setEndPoint("EndToEnd", endrange);
-      range.select();
-    };
-  }
-
-  CodeMirror.defineMode("null", function() {
-    return {token: function(stream) {stream.skipToEnd();}};
-  });
-  CodeMirror.defineMIME("text/plain", "null");
-
-  return CodeMirror;
-})();

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/overlay.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/overlay.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/overlay.js
deleted file mode 100644
index 536c3f0..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/overlay.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// Utility function that allows modes to be combined. The mode given
-// as the base argument takes care of most of the normal mode
-// functionality, but a second (typically simple) mode is used, which
-// can override the style of text. Both modes get to parse all of the
-// text, but when both assign a non-null style to a piece of code, the
-// overlay wins, unless the combine argument was true, in which case
-// the styles are combined.
-
-CodeMirror.overlayParser = function(base, overlay, combine) {
-  return {
-    startState: function() {
-      return {
-        base: CodeMirror.startState(base),
-        overlay: CodeMirror.startState(overlay),
-        basePos: 0, baseCur: null,
-        overlayPos: 0, overlayCur: null
-      };
-    },
-    copyState: function(state) {
-      return {
-        base: CodeMirror.copyState(base, state.base),
-        overlay: CodeMirror.copyState(overlay, state.overlay),
-        basePos: state.basePos, baseCur: null,
-        overlayPos: state.overlayPos, overlayCur: null
-      };
-    },
-
-    token: function(stream, state) {
-      if (stream.start == state.basePos) {
-        state.baseCur = base.token(stream, state.base);
-        state.basePos = stream.pos;
-      }
-      if (stream.start == state.overlayPos) {
-        stream.pos = stream.start;
-        state.overlayCur = overlay.token(stream, state.overlay);
-        state.overlayPos = stream.pos;
-      }
-      stream.pos = Math.min(state.basePos, state.overlayPos);
-      if (stream.eol()) state.basePos = state.overlayPos = 0;
-
-      if (state.overlayCur == null) return state.baseCur;
-      if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
-      else return state.overlayCur;
-    },
-    
-    indent: function(state, textAfter) {
-      return base.indent(state.base, textAfter);
-    },
-    electricChars: base.electricChars
-  };
-};


[21/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.7.2.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.7.2.js b/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.7.2.js
deleted file mode 100644
index 16ad06c..0000000
--- a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-1.7.2.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! jQuery v1.7.2 jquery.com | jquery.org/license */
-(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;
 g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);e
 lse d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d
 =parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaul
 tSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typ
 eof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c
 =a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;r
 eturn this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==nu
 ll?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),t
 ypeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready
 );var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:functio
 n(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[
 ];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f
 .concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date 
 RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],
 e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);re
 turn this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f
 .isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.va
 lue==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecke
 d=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="no
 ne",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position=
 "relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[
 n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(
 j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f
 ._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=th
 is,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof
  a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeCla
 ss"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a
 .attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);r
 eturn}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowsp
 an:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b}
 ,set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["r
 adio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
-a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.gui
 d,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remov
 e.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=
 f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.na
 mespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attr
 Name relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.prop
 s?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.
 type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.
 type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("ch
 ange",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e=
 =null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:funct
 ion(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.tes
 t(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,
 l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[
 t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFi
 lter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]
 |\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode=
 ==b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG
 :function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.
 parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a)
 {var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nod
 eType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p
 =o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,
 e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElemen
 t("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]
 );if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}
 }(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.select
 ors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.c
 ontext).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({p
 arent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P
 .call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^
 \s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChi
 ld;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
-.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;
 if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(functi
 on(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h))
 ,e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.
 createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;
 i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",vi
 sibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f
 .cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f
 ===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.su
 pport.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:f
 unction(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.e
 ach("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},
 ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if
 (!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.
 toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d
 .async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.json
 p!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||
 /loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{i
 f(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.
 css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark
 (this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"
 ),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{
 opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=nul
 l&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,th

<TRUNCATED>

[35/41] git commit: - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
- moved SNORQL to WebJar
- moved CodeMirror to WebJar
- moved Sgvizler to WebJar
- cleaned up uses of non-webjar jquery and jquery-ui
- configured YUI compressor for the above packages in build


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/5fd590b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/5fd590b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/5fd590b4

Branch: refs/heads/develop
Commit: 5fd590b43ebd874240f931375c8bcb35e1d0673e
Parents: f3cd959
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Jul 8 18:11:53 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Jul 8 18:11:53 2013 +0200

----------------------------------------------------------------------
 extras/pom.xml                                  |     3 +
 extras/webjars/codemirror/pom.xml               |    62 +
 .../src/main/resources/codemirror.css           |   132 +
 .../codemirror/src/main/resources/codemirror.js |  3064 +++++
 .../codemirror/src/main/resources/index.html    |   242 +
 .../codemirror/src/main/resources/ldpath.js     |   445 +
 .../src/main/resources/simple-hint.css          |    33 +
 .../src/main/resources/simple-hint.js           |    89 +
 .../codemirror/src/main/resources/sparql.js     |   219 +
 extras/webjars/pom.xml                          |    23 +
 extras/webjars/sgvizler/pom.xml                 |    51 +
 .../webjars/sgvizler/src/main/resources/LICENSE |    16 +
 .../sgvizler/src/main/resources/REVISION        |     1 +
 .../src/main/resources/lib/d3.v2.min.js         |     4 +
 .../resources/lib/raphael-dracula.pack.min.js   |     7 +
 .../src/main/resources/sgvizler.chart.css       |    37 +
 .../sgvizler/src/main/resources/sgvizler.html   |   114 +
 .../sgvizler/src/main/resources/sgvizler.js     |  1277 ++
 extras/webjars/snorql/pom.xml                   |    76 +
 .../webjars/snorql/src/main/resources/LICENSE   |   202 +
 extras/webjars/snorql/src/main/resources/README |    11 +
 .../webjars/snorql/src/main/resources/link.png  |   Bin 0 -> 165 bytes
 .../snorql/src/main/resources/namespaces.js     |    26 +
 .../snorql/src/main/resources/prototype.js      |  4238 ++++++
 .../snorql/src/main/resources/rdf_flyer.24.gif  |   Bin 0 -> 330 bytes
 .../src/main/resources/scriptaculous/builder.js |   153 +
 .../main/resources/scriptaculous/controls.js    |   971 ++
 .../main/resources/scriptaculous/dragdrop.js    |   985 ++
 .../src/main/resources/scriptaculous/effects.js |  1130 ++
 .../resources/scriptaculous/scriptaculous.js    |    40 +
 .../src/main/resources/scriptaculous/slider.js  |   287 +
 .../src/main/resources/scriptaculous/sound.js   |    65 +
 .../main/resources/scriptaculous/unittest.js    |   578 +
 .../webjars/snorql/src/main/resources/snorql.js |   591 +
 .../webjars/snorql/src/main/resources/sparql.js |   507 +
 .../webjars/snorql/src/main/resources/style.css |    85 +
 .../snorql/src/main/resources/xml-to-html.xsl   |   183 +
 parent/pom.xml                                  |    20 +
 platform/marmotta-core/pom.xml                  |     4 +
 .../main/resources/web/admin/configuration.html |     2 +-
 .../src/main/resources/web/admin/dataview.html  |     8 +-
 .../src/main/resources/web/admin/export.html    |     2 +-
 .../resources/web/admin/js/lib/d3.v2.min.js     |     4 -
 .../admin/js/lib/raphael-dracula.pack.min.js    |     7 -
 .../resources/web/admin/js/lib/sgvizler.pack.js |  1294 --
 .../src/main/resources/web/admin/system.html    |     2 +-
 .../src/main/resources/web/admin/tasks.html     |     2 +-
 .../resources/web/public/html/reasoning.html    |     2 +-
 .../resources/web/public/js/lib/jquery-1.6.4.js |  9046 -------------
 .../resources/web/public/js/lib/jquery-1.7.2.js |     4 -
 .../web/public/js/lib/jquery-ui-1.8.21.js       |   125 -
 .../main/resources/web/admin/configuration.html |     2 +-
 platform/marmotta-ldpath/pom.xml                |     6 +
 .../src/main/resources/web/admin/functions.html |     2 +-
 .../src/main/resources/web/admin/ldpath.html    |     7 +-
 .../src/main/resources/web/cm/LICENSE.txt       |    23 -
 .../src/main/resources/web/cm/codemirror.css    |   191 -
 .../src/main/resources/web/cm/codemirror.js     |  3241 -----
 .../src/main/resources/web/cm/index.html        |   255 -
 .../src/main/resources/web/cm/ldpath.js         |   444 -
 .../src/main/resources/web/cm/simple-hint.css   |    33 -
 .../src/main/resources/web/cm/simple-hint.js    |    93 -
 .../src/main/resources/web/admin/configure.html |     2 +-
 .../main/resources/web/admin/configuration.html |     2 +-
 .../src/main/resources/web/admin/profiles.html  |     2 +-
 .../src/main/resources/web/admin/rules.html     |     2 +-
 platform/marmotta-sparql/jooq-config.xml        |    89 -
 platform/marmotta-sparql/pom.xml                |    16 +
 .../src/main/resources/kiwi-module.properties   |     2 +-
 .../main/resources/web/admin/configuration.html |     2 +-
 .../main/resources/web/admin/editor/.gitignore  |     2 -
 .../web/admin/editor/CodeMirror_license.txt     |    19 -
 .../web/admin/editor/Flint_license.txt          |    15 -
 .../main/resources/web/admin/editor/README.txt  |   134 -
 .../web/admin/editor/flint_sparql_editor.html   |    75 -
 .../admin/editor/sparql/css/Remove_16x16.png    |   Bin 829 -> 0 bytes
 .../web/admin/editor/sparql/css/docs.css        |   704 -
 .../web/admin/editor/sparql/css/font.js         |    32 -
 .../admin/editor/sparql/css/sparqlcolors.css    |    76 -
 .../web/admin/editor/sparql/flint-editor.js     |  1923 ---
 .../admin/editor/sparql/images/Cancel_16x16.png |   Bin 807 -> 0 bytes
 .../editor/sparql/images/Copy v2_16x16.png      |   Bin 433 -> 0 bytes
 .../admin/editor/sparql/images/Copy_16x16.png   |   Bin 309 -> 0 bytes
 .../admin/editor/sparql/images/Cut_16x16.png    |   Bin 511 -> 0 bytes
 .../admin/editor/sparql/images/Cut_24x24.png    |   Bin 937 -> 0 bytes
 .../admin/editor/sparql/images/Delete_16x16.png |   Bin 733 -> 0 bytes
 .../admin/editor/sparql/images/Edit_16x16.png   |   Bin 330 -> 0 bytes
 .../editor/sparql/images/Favorites_16x16.png    |   Bin 635 -> 0 bytes
 .../editor/sparql/images/Favorites_24x24.png    |   Bin 1091 -> 0 bytes
 .../admin/editor/sparql/images/Find_16x16.png   |   Bin 417 -> 0 bytes
 .../admin/editor/sparql/images/Globe_16x16.png  |   Bin 808 -> 0 bytes
 .../admin/editor/sparql/images/Globe_24x24.png  |   Bin 1534 -> 0 bytes
 .../editor/sparql/images/Information_16x16.png  |   Bin 736 -> 0 bytes
 .../admin/editor/sparql/images/Key_16x16.png    |   Bin 431 -> 0 bytes
 .../admin/editor/sparql/images/Key_24x24.png    |   Bin 702 -> 0 bytes
 .../admin/editor/sparql/images/New_16x16.png    |   Bin 240 -> 0 bytes
 .../admin/editor/sparql/images/New_24x24.png    |   Bin 315 -> 0 bytes
 .../admin/editor/sparql/images/Next_16x16.png   |   Bin 844 -> 0 bytes
 .../admin/editor/sparql/images/Next_24x24.png   |   Bin 1528 -> 0 bytes
 .../admin/editor/sparql/images/Open_16x16.png   |   Bin 710 -> 0 bytes
 .../admin/editor/sparql/images/Paste_16x16.png  |   Bin 469 -> 0 bytes
 .../admin/editor/sparql/images/Prev_16x16.png   |   Bin 852 -> 0 bytes
 .../admin/editor/sparql/images/Prev_24x24.png   |   Bin 2410 -> 0 bytes
 .../editor/sparql/images/Preview_16x16.png      |   Bin 564 -> 0 bytes
 .../editor/sparql/images/Previous_16x16.png     |   Bin 832 -> 0 bytes
 .../editor/sparql/images/Properties_16x16.png   |   Bin 592 -> 0 bytes
 .../editor/sparql/images/Properties_24x24.png   |   Bin 896 -> 0 bytes
 .../admin/editor/sparql/images/Redo_16x16.png   |   Bin 579 -> 0 bytes
 .../admin/editor/sparql/images/Redo_24x24.png   |   Bin 943 -> 0 bytes
 .../editor/sparql/images/Refresh_16x16.png      |   Bin 502 -> 0 bytes
 .../admin/editor/sparql/images/Remove_16x16.png |   Bin 829 -> 0 bytes
 .../sparql/images/Text Document_16x16.png       |   Bin 291 -> 0 bytes
 .../admin/editor/sparql/images/Undo_16x16.png   |   Bin 589 -> 0 bytes
 .../admin/editor/sparql/images/Undo_24x24.png   |   Bin 991 -> 0 bytes
 .../editor/sparql/images/ajax-loader-red.gif    |   Bin 3208 -> 0 bytes
 .../web/admin/editor/sparql/init-local.js       |    69 -
 .../web/admin/editor/sparql/init-openuplabs.js  |    84 -
 .../admin/editor/sparql/init-sparqlservice.js   |   101 -
 .../web/admin/editor/sparql/jquery-1.5.2.min.js |    16 -
 .../web/admin/editor/sparql/lib/codemirror.css  |    70 -
 .../web/admin/editor/sparql/lib/codemirror.js   |  2038 ---
 .../web/admin/editor/sparql/lib/overlay.js      |    68 -
 .../web/admin/editor/sparql/lib/runmode.js      |    44 -
 .../web/admin/editor/sparql/sparqlParser.js     | 11461 -----------------
 .../web/admin/editor/sparql/sparqlmode.js       |   185 -
 .../web/admin/editor/sparql/sparqlmode_ll1.js   |  1765 ---
 .../src/main/resources/web/admin/link.png       |   Bin 0 -> 165 bytes
 .../src/main/resources/web/admin/sgvizler.html  |   141 +
 .../resources/web/admin/sgvizler/0.5/LICENSE    |    16 -
 .../web/admin/sgvizler/0.5/sgvizler.chart.css   |    37 -
 .../web/admin/sgvizler/0.5/sgvizler.html        |   141 -
 .../web/admin/sgvizler/0.5/sgvizler.js          |     6 -
 .../src/main/resources/web/admin/snorql.html    |   142 +
 .../src/main/resources/web/admin/snorql/LICENSE |   202 -
 .../src/main/resources/web/admin/snorql/README  |    11 -
 .../main/resources/web/admin/snorql/link.png    |   Bin 165 -> 0 bytes
 .../resources/web/admin/snorql/namespaces.js    |    26 -
 .../resources/web/admin/snorql/prototype.js     |  4238 ------
 .../resources/web/admin/snorql/rdf_flyer.24.gif |   Bin 330 -> 0 bytes
 .../web/admin/snorql/scriptaculous/builder.js   |   153 -
 .../web/admin/snorql/scriptaculous/controls.js  |   971 --
 .../web/admin/snorql/scriptaculous/dragdrop.js  |   985 --
 .../web/admin/snorql/scriptaculous/effects.js   |  1130 --
 .../admin/snorql/scriptaculous/scriptaculous.js |    52 -
 .../web/admin/snorql/scriptaculous/slider.js    |   287 -
 .../web/admin/snorql/scriptaculous/sound.js     |    65 -
 .../web/admin/snorql/scriptaculous/unittest.js  |   578 -
 .../main/resources/web/admin/snorql/snorql.html |   149 -
 .../main/resources/web/admin/snorql/snorql.js   |   591 -
 .../main/resources/web/admin/snorql/sparql.js   |   507 -
 .../main/resources/web/admin/snorql/style.css   |    85 -
 .../resources/web/admin/snorql/xml-to-html.xsl  |   183 -
 .../src/main/resources/web/admin/update.html    |    13 +-
 .../src/main/resources/web/cm/codemirror.css    |   132 -
 .../src/main/resources/web/cm/codemirror.js     |  3064 -----
 .../src/main/resources/web/cm/index.html        |   242 -
 .../src/main/resources/web/cm/simple-hint.css   |    33 -
 .../src/main/resources/web/cm/simple-hint.js    |    89 -
 .../src/main/resources/web/cm/sparql.js         |   219 -
 .../user/webservices/UserWebService.java        |    34 +-
 160 files changed, 16319 insertions(+), 47967 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/pom.xml
----------------------------------------------------------------------
diff --git a/extras/pom.xml b/extras/pom.xml
index 4d9cf28..534adf9 100644
--- a/extras/pom.xml
+++ b/extras/pom.xml
@@ -50,4 +50,7 @@
         </plugins>
     </build>
 
+    <modules>
+        <module>webjars</module>
+    </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/pom.xml b/extras/webjars/codemirror/pom.xml
new file mode 100644
index 0000000..d459b71
--- /dev/null
+++ b/extras/webjars/codemirror/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>codemirror</artifactId>
+    <version>2.24</version>
+    <packaging>jar</packaging>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <id>assemble-javascript</id>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                        <configuration>
+                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                            <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/codemirror.js</output>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>assemble-css</id>
+                        <goals>
+                            <goal>aggregate-css</goal>
+                        </goals>
+                        <configuration>
+                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                            <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/codemirror.css</output>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>**/*.js</exclude>
+                    <exclude>**/*.css</exclude>
+                </excludes>
+                <filtering>false</filtering>
+                <targetPath>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</targetPath>
+            </resource>
+        </resources>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/codemirror.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/codemirror.css b/extras/webjars/codemirror/src/main/resources/codemirror.css
new file mode 100644
index 0000000..b5385d7
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/codemirror.css
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#center .CodeMirror, .CodeMirror {
+  line-height: 1em;
+  font-family: monospace;
+}
+
+#center .CodeMirror-scroll, .CodeMirror-scroll {
+  overflow: auto;
+  height: 300px;
+  /* This is needed to prevent an IE[67] bug where the scrolled content
+     is visible outside of the scrolling box. */
+  position: relative;
+  outline: none;
+}
+
+#center .CodeMirror-gutter, .CodeMirror-gutter {
+  position: absolute; left: 0; top: 0;
+  z-index: 10;
+  background-color: #f7f7f7;
+  border-right: 1px solid #eee;
+  min-width: 2em;
+  height: 100%;
+}
+#center .CodeMirror-gutter-text, .CodeMirror-gutter-text {
+  color: #aaa;
+  text-align: right;
+  padding: .4em .2em .4em .4em;
+  white-space: pre !important;
+}
+#center .CodeMirror-lines, .CodeMirror-lines {
+  padding: .4em;
+  white-space: pre;
+}
+
+#center .CodeMirror pre, .CodeMirror pre {
+  -moz-border-radius: 0;
+  -webkit-border-radius: 0;
+  -o-border-radius: 0;
+  border-radius: 0;
+  border-width: 0; margin: 0; padding: 0; background: transparent;
+  font-family: inherit;
+  font-size: inherit;
+  padding: 0; margin: 0;
+  white-space: pre;
+  word-wrap: normal;
+  line-height: inherit;
+  width: auto;
+}
+
+#center .CodeMirror-wrap pre, .CodeMirror-wrap pre {
+  word-wrap: break-word;
+  white-space: pre-wrap;
+  word-break: normal;
+}
+#center .CodeMirror-wrap .CodeMirror-scroll, .CodeMirror-wrap .CodeMirror-scroll {
+  overflow-x: hidden;
+}
+
+#center .CodeMirror textarea, .CodeMirror textarea {
+  outline: none !important;
+}
+
+#center .CodeMirror pre.CodeMirror-cursor, .CodeMirror pre.CodeMirror-cursor {
+  z-index: 10;
+  position: absolute;
+  visibility: hidden;
+  border-left: 1px solid black;
+  border-right:none;
+  width:0;
+}
+#center .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite, .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
+#center .CodeMirror-focused pre.CodeMirror-cursor, .CodeMirror-focused pre.CodeMirror-cursor {
+  visibility: visible;
+}
+
+#center div.CodeMirror-selected, div.CodeMirror-selected { background: #d9d9d9; }
+#center .CodeMirror-focused div.CodeMirror-selected, .CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
+
+#center .CodeMirror-searching, .CodeMirror-searching {
+  background: #ffa;
+  background: rgba(255, 255, 0, .4);
+}
+
+/* Default theme */
+
+.cm-s-default span.cm-keyword {color: #708;}
+.cm-s-default span.cm-atom {color: #219;}
+.cm-s-default span.cm-number {color: #164;}
+.cm-s-default span.cm-def {color: #00f;}
+.cm-s-default span.cm-variable {color: black;}
+.cm-s-default span.cm-variable-2 {color: #05a;}
+.cm-s-default span.cm-variable-3 {color: #085;}
+.cm-s-default span.cm-property {color: black;}
+.cm-s-default span.cm-operator {color: black;}
+.cm-s-default span.cm-comment {color: #a50;}
+.cm-s-default span.cm-string {color: #a11;}
+.cm-s-default span.cm-string-2 {color: #f50;}
+.cm-s-default span.cm-meta {color: #555;}
+.cm-s-default span.cm-error {color: #f00;}
+.cm-s-default span.cm-qualifier {color: #555;}
+.cm-s-default span.cm-builtin {color: #30a;}
+.cm-s-default span.cm-bracket {color: #cc7;}
+.cm-s-default span.cm-tag {color: #170;}
+.cm-s-default span.cm-attribute {color: #00c;}
+.cm-s-default span.cm-header {color: #a0a;}
+.cm-s-default span.cm-quote {color: #090;}
+.cm-s-default span.cm-hr {color: #999;}
+.cm-s-default span.cm-link {color: #00c;}
+
+span.cm-header, span.cm-strong {font-weight: bold;}
+span.cm-em {font-style: italic;}
+span.cm-emstrong {font-style: italic; font-weight: bold;}
+span.cm-link {text-decoration: underline;}
+
+#center div.CodeMirror span.CodeMirror-matchingbracket, div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
+#center div.CodeMirror span.CodeMirror-nonmatchingbracket, div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}


[19/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldcache/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/resources/web/admin/configuration.html b/platform/marmotta-ldcache/src/main/resources/web/admin/configuration.html
index 2c33f0a..9a53ed3 100644
--- a/platform/marmotta-ldcache/src/main/resources/web/admin/configuration.html
+++ b/platform/marmotta-ldcache/src/main/resources/web/admin/configuration.html
@@ -21,7 +21,7 @@
 <head>
 <!--###BEGIN_HEAD###-->
     <title>Core Module Configuration</title>
-    <script type="text/javascript" src="../../core/public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="../../core/public/js/widgets/property_config.js"></script>
     <script type="text/javascript" src="widgets/lmf_ldcache.js"></script>
     <script type="text/javascript" src="../../core/public/js/widgets/configurator/configurator.js"></script>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/pom.xml b/platform/marmotta-ldpath/pom.xml
index 599c0c3..19a16a0 100644
--- a/platform/marmotta-ldpath/pom.xml
+++ b/platform/marmotta-ldpath/pom.xml
@@ -154,6 +154,12 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>codemirror</artifactId>
+        </dependency>
+
+
+        <dependency>
            <groupId>org.apache.marmotta</groupId>
             <artifactId>ldpath-core</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/admin/functions.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/admin/functions.html b/platform/marmotta-ldpath/src/main/resources/web/admin/functions.html
index e142477..11ed9ed 100644
--- a/platform/marmotta-ldpath/src/main/resources/web/admin/functions.html
+++ b/platform/marmotta-ldpath/src/main/resources/web/admin/functions.html
@@ -21,7 +21,7 @@
 <head>
     <!--###BEGIN_HEAD###-->
     <title>LDPath Functions</title>
-    <script type="text/javascript" src="../../core/public/js/lib/jquery-1.7.2.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <!--###END_HEAD###-->
 </head>
 <body>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
index 6e72a44..4b215de 100644
--- a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
+++ b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
@@ -26,13 +26,10 @@
 <title>LDPath Test Suite</title>
 <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
 <script type="text/javascript" src="../../webjars/marmotta.js"></script>
-<script type="text/javascript" src="../cm/codemirror.js"></script>
-<script type="text/javascript" src="../cm/simple-hint.js"></script>
-<script type="text/javascript" src="../cm/ldpath.js"></script>
+<script type="text/javascript" src="../../webjars/codemirror/2.24/codemirror.js"></script>
 
 <link rel="stylesheet" href="style.css" />
-<link rel="stylesheet" href="../cm/codemirror.css" />
-<link rel="stylesheet" href="../cm/simple-hint.css" />
+<link rel="stylesheet" href="../../webjars/codemirror/2.24/codemirror.css" />
 <script type="text/javascript" src="ldpath.js"></script>
 <!--###END_HEAD###-->
 </head>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/LICENSE.txt b/platform/marmotta-ldpath/src/main/resources/web/cm/LICENSE.txt
deleted file mode 100644
index 482d55e..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/LICENSE.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (C) 2013 by Marijn Haverbeke <ma...@gmail.com>
-
-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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-Please note that some subdirectories of the CodeMirror distribution
-include their own LICENSE files, and are released under different
-licences.

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.css b/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.css
deleted file mode 100644
index 132b6f8..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.css
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#center .CodeMirror, .CodeMirror {
-  line-height: 1em;
-  font-family: monospace;
-
-  /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
-  position: relative;
-  /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
-  overflow: hidden;
-}
-
-#center .CodeMirror-scroll, .CodeMirror-scroll {
-  overflow: auto;
-  height: 300px;
-  /* This is needed to prevent an IE[67] bug where the scrolled content
-     is visible outside of the scrolling box. */
-  position: relative;
-  outline: none;
-}
-
-/* Vertical scrollbar */
-#center .CodeMirror-scrollbar, .CodeMirror-scrollbar {
-  position: absolute;
-  right: 0; top: 0;
-  overflow-x: hidden;
-  overflow-y: scroll;
-  z-index: 5;
-}
-#center .CodeMirror-scrollbar-inner, .CodeMirror-scrollbar-inner {
-  /* This needs to have a nonzero width in order for the scrollbar to appear
-     in Firefox and IE9. */
-  width: 1px;
-}
-#center .CodeMirror-scrollbar.cm-sb-overlap, .CodeMirror-scrollbar.cm-sb-overlap {
-  /* Ensure that the scrollbar appears in Lion, and that it overlaps the content
-     rather than sitting to the right of it. */
-  position: absolute;
-  z-index: 1;
-  float: none;
-  right: 0;
-  min-width: 12px;
-}
-#center .CodeMirror-scrollbar.cm-sb-nonoverlap, .CodeMirror-scrollbar.cm-sb-nonoverlap {
-  min-width: 12px;
-}
-#center .CodeMirror-scrollbar.cm-sb-ie7, .CodeMirror-scrollbar.cm-sb-ie7 {
-  min-width: 18px;
-}
-
-#center .CodeMirror-gutter, .CodeMirror-gutter {
-  position: absolute; left: 0; top: 0;
-  z-index: 10;
-  background-color: #f7f7f7;
-  border-right: 1px solid #eee;
-  min-width: 2em;
-  height: 100%;
-}
-#center .CodeMirror-gutter-text, .CodeMirror-gutter-text {
-  color: #aaa;
-  text-align: right;
-  padding: .4em .2em .4em .4em;
-  white-space: pre !important;
-  cursor: default;
-}
-#center .CodeMirror-lines, .CodeMirror-lines {
-  padding: .4em;
-  white-space: pre;
-  cursor: text;
-}
-
-#center .CodeMirror pre, .CodeMirror pre {
-  -moz-border-radius: 0;
-  -webkit-border-radius: 0;
-  -o-border-radius: 0;
-  border-radius: 0;
-  border-width: 0; margin: 0; padding: 0; background: transparent;
-  font-family: inherit;
-  font-size: inherit;
-  padding: 0; margin: 0;
-  white-space: pre;
-  word-wrap: normal;
-  line-height: inherit;
-  color: inherit;
-  width: auto;
-}
-
-#center .CodeMirror-wrap pre, .CodeMirror-wrap pre {
-  word-wrap: break-word;
-  white-space: pre-wrap;
-  word-break: normal;
-}
-#center .CodeMirror-wrap .CodeMirror-scroll, .CodeMirror-wrap .CodeMirror-scroll {
-  overflow-x: hidden;
-}
-
-#center .CodeMirror textarea, .CodeMirror textarea {
-  outline: none !important;
-}
-
-#center .CodeMirror pre.CodeMirror-cursor, .CodeMirror pre.CodeMirror-cursor {
-  z-index: 10;
-  position: absolute;
-  visibility: hidden;
-  border-left: 1px solid black;
-  border-right: none;
-  width: 0;
-}
-#center .cm-keymap-fat-cursor pre.CodeMirror-cursor, .cm-keymap-fat-cursor pre.CodeMirror-cursor {
-  width: auto;
-  border: 0;
-  background: transparent;
-  background: rgba(0, 200, 0, .4);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
-}
-/* Kludge to turn off filter in ie9+, which also accepts rgba */
-#center .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id), .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-#center .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite, .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
-#center .CodeMirror-focused pre.CodeMirror-cursor, .CodeMirror-focused pre.CodeMirror-cursor {
-  visibility: visible;
-}
-
-#center div.CodeMirror-selected, div.CodeMirror-selected { background: #d9d9d9; }
-#center .CodeMirror-focused div.CodeMirror-selected, .CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
-
-#center .CodeMirror-searching, .CodeMirror-searching {
-  background: #ffa;
-  background: rgba(255, 255, 0, .4);
-}
-
-/* Default theme */
-
-.cm-s-default span.cm-keyword {color: #708;}
-.cm-s-default span.cm-atom {color: #219;}
-.cm-s-default span.cm-number {color: #164;}
-.cm-s-default span.cm-def {color: #00f;}
-.cm-s-default span.cm-variable {color: black;}
-.cm-s-default span.cm-variable-2 {color: #05a;}
-.cm-s-default span.cm-variable-3 {color: #085;}
-.cm-s-default span.cm-property {color: black;}
-.cm-s-default span.cm-operator {color: black;}
-.cm-s-default span.cm-comment {color: #a50;}
-.cm-s-default span.cm-string {color: #a11;}
-.cm-s-default span.cm-string-2 {color: #f50;}
-.cm-s-default span.cm-meta {color: #555;}
-.cm-s-default span.cm-error {color: #f00;}
-.cm-s-default span.cm-qualifier {color: #555;}
-.cm-s-default span.cm-builtin {color: #30a;}
-.cm-s-default span.cm-bracket {color: #cc7;}
-.cm-s-default span.cm-tag {color: #170;}
-.cm-s-default span.cm-attribute {color: #00c;}
-.cm-s-default span.cm-header {color: blue;}
-.cm-s-default span.cm-quote {color: #090;}
-.cm-s-default span.cm-hr {color: #999;}
-.cm-s-default span.cm-link {color: #00c;}
-
-span.cm-header, span.cm-strong {font-weight: bold;}
-span.cm-em {font-style: italic;}
-span.cm-emstrong {font-style: italic; font-weight: bold;}
-span.cm-link {text-decoration: underline;}
-
-span.cm-invalidchar {color: #f00;}
-
-#center div.CodeMirror span.CodeMirror-matchingbracket, div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-#center div.CodeMirror span.CodeMirror-nonmatchingbracket, div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
-
-@media print {
-
-  /* Hide the cursor when printing */
-  #center .CodeMirror pre.CodeMirror-cursor, .CodeMirror pre.CodeMirror-cursor {
-    visibility: hidden;
-  }
-
-}
\ No newline at end of file


[02/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/index.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/index.html b/platform/marmotta-sparql/src/main/resources/web/cm/index.html
deleted file mode 100644
index 29a4279..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/index.html
+++ /dev/null
@@ -1,242 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!doctype html>
-<html>
-<head>
-<title>CodeMirror: LDPath Demo</title>
-<link rel="stylesheet" href="codemirror.css">
-<link rel="stylesheet" href="simple-hint.css">
-
-<script src="../../core/public/js/lib/jquery-1.7.2.js" type="text/javascript"></script>
-
-<script src="codemirror.js"></script>
-<script src="simple-hint.js"></script>
-<script src="ldpath.js"></script>
-
-<link rel="stylesheet" href="ldpath.css">
-
-<style type="text/css">
-.CodeMirror {
-    border: 1px solid #eee;
-}
-
-td {
-    padding-right: 20px;
-}
-body {
-  font-family: Droid Sans, Arial, sans-serif;
-  line-height: 1.5;
-  max-width: 64.3em;
-  margin: 3em auto;
-  padding: 0 1em;
-}
-
-h1 {
-  letter-spacing: -3px;
-  font-size: 3.23em;
-  font-weight: bold;
-  margin: 0;
-}
-
-h2 {
-  font-size: 1.23em;
-  font-weight: bold;
-  margin: .5em 0;
-  letter-spacing: -1px;
-}
-
-h3 {
-  font-size: 1em;
-  font-weight: bold;
-  margin: .4em 0;
-}
-
-pre {
-  background-color: #eee;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 1em;
-}
-
-pre.code {
-  margin: 0 1em;
-}
-
-.grey {
-  font-size: 2.2em;
-  padding: .5em 1em;
-  line-height: 1.2em;
-  margin-top: .5em;
-  position: relative;
-}
-
-img.logo {
-  position: absolute;
-  right: -25px;
-  bottom: 4px;
-}
-
-a:link, a:visited, .quasilink {
-  color: #df0019;
-  cursor: pointer;
-  text-decoration: none;
-}
-
-a:hover, .quasilink:hover {
-  color: #800004;
-}
-
-h1 a:link, h1 a:visited, h1 a:hover {
-  color: black;
-}
-
-ul {
-  margin: 0;
-  padding-left: 1.2em;
-}
-
-a.download {
-  color: white;
-  background-color: #df0019;
-  width: 100%;
-  display: block;
-  text-align: center;
-  font-size: 1.23em;
-  font-weight: bold;
-  text-decoration: none;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: .5em 0;
-  margin-bottom: 1em;
-}
-
-a.download:hover {
-  background-color: #bb0010;
-}
-
-.rel {
-  margin-bottom: 0;
-}
-
-.rel-note {
-  color: #777;
-  font-size: .9em;
-  margin-top: .1em;
-}
-
-.logo-braces {
-  color: #df0019;
-  position: relative;
-  top: -4px;
-}
-
-.blk {
-  float: left;
-}
-
-.left {
-  width: 37em;
-  padding-right: 6.53em;
-  padding-bottom: 1em;
-}
-
-.left1 {
-  width: 15.24em;
-  padding-right: 6.45em;
-}
-
-.left2 {
-  width: 15.24em;
-}
-
-.right {
-  width: 20.68em;
-}
-
-.leftbig {
-  width: 42.44em;
-  padding-right: 6.53em;
-}
-
-.rightsmall {
-  width: 15.24em;
-}
-
-.clear:after {
-  visibility: hidden;
-  display: block;
-  font-size: 0;
-  content: " ";
-  clear: both;
-  height: 0;
-}
-.clear { display: inline-block; }
-/* start commented backslash hack \*/
-* html .clear { height: 1%; }
-.clear { display: block; }
-/* close commented backslash hack */
-</style>
-</head>
-<body>
-  <h1>CodeMirror: LDPath demo</h1>
-  <div>
-    <button onclick="javascript:createEditor()">Editor</button>
-    <button onclick="javascript:removeEditor()">Plain</button>
-  </div>
-  <form>
-    <textarea id="code" name="code">
-@prefix iptc : <http://iptc.org/std/nar/2006-10-01/> ;
-@prefix foaf ;
-@prefix rss: ;
-@prefix sioc: ;
-@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
-  date = dc:date :: xsd:date(multiValued="false") ;
-  desc = dc:description[@de] :: lmf:text_en ;
-  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
-  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
-  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
-  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
-  user = dc:creator :: xsd:string(multiValue="false") ;
-</textarea>
-  </form>
-  <script>
-            var editor = null;
-            function createEditor() {
-                if (editor === null) {
-                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
-                        lineNumbers : true,
-                        matchBrackets : true,
-						extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
-                        mode : "ldpath"
-                    });
-                }
-            }
-            function removeEditor() {
-                if (editor) {
-                    editor.toTextArea();
-                    editor = null;
-                }
-            }
-            createEditor();
-        </script>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.css b/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.css
deleted file mode 100644
index c7a040c..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.css
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#center .CodeMirror-completions, .CodeMirror-completions {
-  position: absolute;
-  z-index: 10;
-  overflow: hidden;
-  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-}
-#center .CodeMirror-completions select, .CodeMirror-completions select {
-  background: #fafafa;
-  outline: none;
-  border: none;
-  padding: 0;
-  margin: 0;
-  font-family: monospace;
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.js b/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.js
deleted file mode 100644
index 27f8ead..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/simple-hint.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-(function() {
-  CodeMirror.simpleHint = function(editor, getHints) {
-    // We want a single cursor position.
-    if (editor.somethingSelected()) return;
-    var result = getHints(editor);
-    if (!result || !result.list.length) return;
-    var completions = result.list;
-    function insert(str) {
-      editor.replaceRange(str, result.from, result.to);
-    }
-    // When there is only one completion, use it directly.
-    if (completions.length == 1) {insert(completions[0]); return true;}
-
-    // Build the select widget
-    var complete = document.createElement("div");
-    complete.className = "CodeMirror-completions";
-    var sel = complete.appendChild(document.createElement("select"));
-    // Opera doesn't move the selection when pressing up/down in a
-    // multi-select, but it does properly support the size property on
-    // single-selects, so no multi-select is necessary.
-    if (!window.opera) sel.multiple = true;
-    for (var i = 0; i < completions.length; ++i) {
-      var opt = sel.appendChild(document.createElement("option"));
-      opt.appendChild(document.createTextNode(completions[i]));
-    }
-    sel.firstChild.selected = true;
-    sel.size = Math.min(10, completions.length);
-    var pos = editor.cursorCoords();
-    complete.style.left = pos.x + "px";
-    complete.style.top = pos.yBot + "px";
-    document.body.appendChild(complete);
-    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
-    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
-    if(winW - pos.x < sel.clientWidth)
-      complete.style.left = (pos.x - sel.clientWidth) + "px";
-    // Hack to hide the scrollbar.
-    if (completions.length <= 10)
-      complete.style.width = (sel.clientWidth - 1) + "px";
-
-    var done = false;
-    function close() {
-      if (done) return;
-      done = true;
-      complete.parentNode.removeChild(complete);
-    }
-    function pick() {
-      insert(completions[sel.selectedIndex]);
-      close();
-      setTimeout(function(){editor.focus();}, 50);
-    }
-    CodeMirror.connect(sel, "blur", close);
-    CodeMirror.connect(sel, "keydown", function(event) {
-      var code = event.keyCode;
-      // Enter
-      if (code == 13) {CodeMirror.e_stop(event); pick();}
-      // Escape
-      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
-      else if (code != 38 && code != 40) {
-        close(); editor.focus();
-        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
-        editor.triggerOnKeyDown(event);
-        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
-      }
-    });
-    CodeMirror.connect(sel, "dblclick", pick);
-
-    sel.focus();
-    // Opera sometimes ignores focusing a freshly created node
-    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
-    return true;
-  };
-})();

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/cm/sparql.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/cm/sparql.js b/platform/marmotta-sparql/src/main/resources/web/cm/sparql.js
deleted file mode 100644
index ff3ad70..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/cm/sparql.js
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-CodeMirror.defineMode("sparql", function(config) {
-  var indentUnit = config.indentUnit;
-  var curPunc;
-
-  function wordRegexp(words) {
-    return new RegExp("^(?:" + words.join("|") + ")$", "i");
-  }
-  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
-                        "isblank", "isliteral", "union", "a"]);
-  var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
-                             "ask", "from", "named", "where", "group", "order", "limit", "offset", "filter", 
-                             "optional", "graph", "by", "asc", "desc", "insert", "data", "delete"]);
-  var operatorChars = /[*+\-<>=&|]/;
-
-  function tokenBase(stream, state) {
-    var ch = stream.next();
-    curPunc = null;
-    if (ch == "$" || ch == "?") {
-      stream.match(/^[\w\d]*/);
-      return "variable-2";
-    }
-    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
-      stream.match(/^[^\s\u00a0>]*>?/);
-      return "atom";
-    }
-    else if (ch == "\"" || ch == "'") {
-      state.tokenize = tokenLiteral(ch);
-      return state.tokenize(stream, state);
-    }
-    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
-      curPunc = ch;
-      return null;
-    }
-    else if (ch == "#") {
-      stream.skipToEnd();
-      return "comment";
-    }
-    else if (operatorChars.test(ch)) {
-      stream.eatWhile(operatorChars);
-      return null;
-    }
-    else if (ch == ":") {
-      stream.eatWhile(/[\w\d\._\-]/);
-      return "atom";
-    }
-    else {
-      stream.eatWhile(/[_\w\d]/);
-      if (stream.eat(":")) {
-        stream.eatWhile(/[\w\d_\-]/);
-        return "atom";
-      }
-      var word = stream.current(), type;
-      if (ops.test(word))
-        return null;
-      else if (keywords.test(word))
-        return "keyword";
-      else
-        return "variable";
-    }
-  }
-
-  function tokenLiteral(quote) {
-    return function(stream, state) {
-      var escaped = false, ch;
-      while ((ch = stream.next()) != null) {
-        if (ch == quote && !escaped) {
-          state.tokenize = tokenBase;
-          break;
-        }
-        escaped = !escaped && ch == "\\";
-      }
-      return "string";
-    };
-  }
-
-  function pushContext(state, type, col) {
-    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
-  }
-  function popContext(state) {
-    state.indent = state.context.indent;
-    state.context = state.context.prev;
-  }
-
-  return {
-    startState: function(base) {
-      return {tokenize: tokenBase,
-              context: null,
-              indent: 0,
-              col: 0};
-    },
-
-    token: function(stream, state) {
-      if (stream.sol()) {
-        if (state.context && state.context.align == null) state.context.align = false;
-        state.indent = stream.indentation();
-      }
-      if (stream.eatSpace()) return null;
-      var style = state.tokenize(stream, state);
-
-      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
-        state.context.align = true;
-      }
-
-      if (curPunc == "(") pushContext(state, ")", stream.column());
-      else if (curPunc == "[") pushContext(state, "]", stream.column());
-      else if (curPunc == "{") pushContext(state, "}", stream.column());
-      else if (/[\]\}\)]/.test(curPunc)) {
-        while (state.context && state.context.type == "pattern") popContext(state);
-        if (state.context && curPunc == state.context.type) popContext(state);
-      }
-      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
-      else if (/atom|string|variable/.test(style) && state.context) {
-        if (/[\}\]]/.test(state.context.type))
-          pushContext(state, "pattern", stream.column());
-        else if (state.context.type == "pattern" && !state.context.align) {
-          state.context.align = true;
-          state.context.col = stream.column();
-        }
-      }
-      
-      return style;
-    },
-
-    indent: function(state, textAfter) {
-      var firstChar = textAfter && textAfter.charAt(0);
-      var context = state.context;
-      if (/[\]\}]/.test(firstChar))
-        while (context && context.type == "pattern") context = context.prev;
-
-      var closing = context && firstChar == context.type;
-      if (!context)
-        return 0;
-      else if (context.type == "pattern")
-        return context.col;
-      else if (context.align)
-        return context.col + (closing ? 0 : 1);
-      else
-        return context.indent + (closing ? 0 : indentUnit);
-    }
-  };
-});
-
-if (CodeMirror.simpleHint && jQuery) {
-    function completePrefix(editor, cur, token, prevToken) {
-        var line = editor.getLine(cur.line);
-        var match = line.match(/(^|;)\s*PREFIX\s+(\w+)\s*(:\s*<?)?(;|$)/);
-        if (match && match[2] && match[2] !== "") {
-            var prefix = match[2], result;
-            try {
-                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                    async: false,
-                    success: function(data) {
-                        result = data[prefix];
-                    },
-                    dataType: "json"
-                });
-            } catch (e) {}
-            if (result !== undefined) {
-                var pfx = line.substr(0,cur.ch);
-                var st = pfx.search(/\s*(:\s*<?)?$/);
-                return {
-                    list: [ ": <"+result+">" ],
-                    from: {line: cur.line, ch: st},
-                    to: cur
-                };
-            }
-        }
-        return false;
-    }
-    CodeMirror.commands.sparqlAutocomplete = function(cm) {
-        CodeMirror.simpleHint(cm, function(editor) {
-            var cur = editor.getCursor();
-            var line = editor.getLine(cur.line);
-
-            // search for the last prefix
-            for(i = cur.ch; i >= 0; i--) {
-                var token = editor.getTokenAt({line: cur.line, ch: i});
-                if(token.className == "keyword" && token.string == "PREFIX") {
-                    break;
-                }
-            }
-            console.dir(token);
-
-            // search for the next atom
-            for(i = token.end + 1; i <= cur.ch; i++) {
-                var atomToken = editor.getTokenAt({line: cur.line, ch: i});
-                if(atomToken.className == "atom") {
-                    break;
-                }
-            }
-            console.dir(atomToken);
-
-
-            if (atomToken.className == "atom") {
-                return completePrefix(editor, cur, atomToken, token);
-            }
-        });
-    }
-}
-
-
-CodeMirror.defineMIME("application/x-sparql-query", "sparql");

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
index 37fec15..1f4dcc3 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
@@ -237,25 +237,29 @@ public class UserWebService {
     @GET
     @Path("/{login:[^#?]+}")
     public Response getUser(@PathParam("login") String login, @HeaderParam("Accept") String types) {
-        try {
-            RepositoryConnection conn = sesameService.getConnection();
+        if(login.equals("me")) {
+            return get();
+        } else {
             try {
-                final URI user = userService.getUser(login);
-                if (user == null) return Response.status(Status.NOT_FOUND).entity(String.format("User %s not found", login)).build();
+                RepositoryConnection conn = sesameService.getConnection();
+                try {
+                    final URI user = userService.getUser(login);
+                    if (user == null) return Response.status(Status.NOT_FOUND).entity(String.format("User %s not found", login)).build();
 
-                java.net.URI u = new java.net.URI(configurationService.getServerUri() + "resource?uri=" + URLEncoder.encode(user.stringValue(), "utf-8"));
+                    java.net.URI u = new java.net.URI(configurationService.getServerUri() + "resource?uri=" + URLEncoder.encode(user.stringValue(), "utf-8"));
 
-                return Response.seeOther(u).header("Accept", types).build();
-            } finally {
-                conn.commit();
-                conn.commit();
+                    return Response.seeOther(u).header("Accept", types).build();
+                } finally {
+                    conn.commit();
+                    conn.commit();
+                }
+            } catch (URISyntaxException e) {
+                return Response.status(Status.BAD_REQUEST).entity(String.format("Invalid URI: %s", e.getMessage())).build();
+            } catch (UnsupportedEncodingException e) {
+                return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
+            } catch (RepositoryException e) {
+                return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
             }
-        } catch (URISyntaxException e) {
-            return Response.status(Status.BAD_REQUEST).entity(String.format("Invalid URI: %s", e.getMessage())).build();
-        } catch (UnsupportedEncodingException e) {
-            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
-        } catch (RepositoryException e) {
-            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
         }
     }
 


[24/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/js/lib/raphael-dracula.pack.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/js/lib/raphael-dracula.pack.min.js b/platform/marmotta-core/src/main/resources/web/admin/js/lib/raphael-dracula.pack.min.js
deleted file mode 100644
index 1bf619e..0000000
--- a/platform/marmotta-core/src/main/resources/web/admin/js/lib/raphael-dracula.pack.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Raphael 1.3.1 - JavaScript Vector Library
- *
- * Copyright (c) 2008 - 2009 Dmitry Baranovskiy (http://raphaeljs.com)
- * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
- */function log(a){console.log&&console.log(a)}Raphael=function(){function Q(a,b,c){function d(){var e=Array[r].slice.call(arguments,0),f=e[p]("►"),g=d.cache=d.cache||{},h=d.count=d.count||[];return g[o](f)?c?c(g[f]):g[f]:(h[q]>=1e3&&delete g[h.shift()],h[B](f),g[f]=a[i](b,e),c?c(g[f]):g[f])}return d}function bE(){return this.x+l+this.y}function bO(a){return function(b,c,d,e){var g={back:a};return f.is(d,"function")?e=d:g.rot=d,b&&b.constructor==br&&(b=b.attrs.path),b&&(g.along=b),this.animate(g,c,e)}}var a=/[, ]+/,b=/^(circle|rect|path|ellipse|text|image)$/,c=document,d=window,e={was:"Raphael"in d,is:d.Raphael},f=function(){if(f.is(arguments[0],"array")){var a=arguments[0],c=by[i](f,a.splice(0,3+f.is(a[0],w))),d=c.set();for(var e=0,g=a[q];e<g;e++){var h=a[e]||{};b.test(h.type)&&d[B](c[h.type]().attr(h))}return d}return by[i](f,arguments)},g=function(){},h="appendChild",i="apply",j="concat",k="",l=" ",m="split",n="click dblclick mousedown mousemove mouseout mouseover mouseup"[m](l
 ),o="hasOwnProperty",p="join",q="length",r="prototype",s=String[r].toLowerCase,t=Math,u=t.max,v=t.min,w="number",x="toString",y=Object[r][x],z={},A=t.pow,B="push",C=/^(?=[\da-f]$)/,D=/^url\(['"]?([^\)]+)['"]?\)$/i,E=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,F=t.round,G="setAttribute",H=parseFloat,I=parseInt,J=String[r].toUpperCase,K={"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,targe
 t:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},L={along:"along","clip-rect":"csv",cx:w,cy:w,fill:"colour","fill-opacity":w,"font-size":w,height:w,opacity:w,path:"path",r:w,rotation:"csv",rx:w,ry:w,scale:"csv",stroke:"colour","stroke-opacity":w,"stroke-width":w,translation:"csv",width:w,x:w,y:w},M="replace";f.version="1.3.1",f.type=d.SVGAngle||c.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(f.type=="VML"){var N=document.createElement("div");N.innerHTML="<!--[if vml]><br><br><![endif]-->";if(N.childNodes[q]!=2)return null}f.svg=!(f.vml=f.type=="VML"),g[r]=f[r],f._id=0,f._oid=0,f.fn={},f.is=function(a,b){return b=s.call(b),(b=="object"||b=="undefined")&&typeof a==b||a==null&&b=="null"||s.call(y.call(a).slice(8,-1))==b},f.setWindow=function(a){d=a,c=d.document};var O=function(a){if(f.vml){var b=/^\s+|\s+$/g;O=Q(function(a){var c;a=(a+k)[M](b,k);try{var d=new ActiveXObject("htmlfile");d.write("<bo
 dy>"),d.close(),c=d.body}catch(e){c=createPopup().document.body}var f=c.createTextRange();try{c.style.color=a;var g=f.queryCommandValue("ForeColor");return g=(g&255)<<16|g&65280|(g&16711680)>>>16,"#"+("000000"+g[x](16)).slice(-6)}catch(e){return"none"}})}else{var d=c.createElement("i");d.title="Raphaël Colour Picker",d.style.display="none",c.body[h](d),O=Q(function(a){return d.style.color=a,c.defaultView.getComputedStyle(d,k).getPropertyValue("color")})}return O(a)};f.hsb2rgb=Q(function(a,b,c){f.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h);var d,e,g;if(c==0)return{r:0,g:0,b:0,hex:"#000"};if(a>1||b>1||c>1)a/=255,b/=255,c/=255;var h=~~(a*6),i=a*6-h,j=c*(1-b),k=c*(1-b*i),l=c*(1-b*(1-i));d=[c,k,j,j,l,c,c][h],e=[l,c,c,k,j,j,l][h],g=[j,j,l,c,c,k,j][h],d*=255,e*=255,g*=255;var m={r:d,g:e,b:g},n=(~~d)[x](16),o=(~~e)[x](16),p=(~~g)[x](16);return n=n[M](C,"0"),o=o[M](C,"0"),p=p[M](C,"0"),m.hex="#"+n+o+p,m},f),f.rgb2hsb=Q(function(a,b,c){f.is(a,"object")&&"r"in a&&"g"in a&&"
 b"in a&&(c=a.b,b=a.g,a=a.r);if(f.is(a,"string")){var d=f.getRGB(a);a=d.r,b=d.g,c=d.b}if(a>1||b>1||c>1)a/=255,b/=255,c/=255;var e=u(a,b,c),g=v(a,b,c),h,i,j=e;if(g==e)return{h:0,s:0,b:e};var k=e-g;return i=k/e,a==e?h=(b-c)/k:b==e?h=2+(c-a)/k:h=4+(a-b)/k,h/=6,h<0&&h++,h>1&&h--,{h:h,s:i,b:j}},f);var P=/,?([achlmqrstvxz]),?/gi;f._path2string=function(){return this.join(",")[M](P,"$1")},f.getRGB=Q(function(a){if(!a||!!((a+=k).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!{hs:1,rg:1}[o](a.substring(0,2))&&a.charAt()!="#"&&(a=O(a));var b,c,d,e,g,h=a.match(E);if(h){h[2]&&(e=I(h[2].substring(5),16),d=I(h[2].substring(3,5),16),c=I(h[2].substring(1,3),16)),h[3]&&(e=I((g=h[3].charAt(3))+g,16),d=I((g=h[3].charAt(2))+g,16),c=I((g=h[3].charAt(1))+g,16)),h[4]&&(h=h[4][m](/\s*,\s*/),c=H(h[0]),d=H(h[1]),e=H(h[2])),h[5]&&(h=h[5][m](/\s*,\s*/),c=H(h[0])*2.55,d=H(h[1])*2.55,e=H(h[2])*2.55);if(h[6])return h=h[6][m](/\s*,\s*/),c=H(h[0]),d=H(h[1]),
 e=H(h[2]),f.hsb2rgb(c,d,e);if(h[7])return h=h[7][m](/\s*,\s*/),c=H(h[0])*2.55,d=H(h[1])*2.55,e=H(h[2])*2.55,f.hsb2rgb(c,d,e);h={r:c,g:d,b:e};var i=(~~c)[x](16),j=(~~d)[x](16),l=(~~e)[x](16);return i=i[M](C,"0"),j=j[M](C,"0"),l=l[M](C,"0"),h.hex="#"+i+j+l,h}return{r:-1,g:-1,b:-1,hex:"none",error:1}},f),f.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},f.getColor.reset=function(){delete this.start},f.parsePathString=Q(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];return f.is(a,"array")&&f.is(a[0],"array")&&(c=S(a)),c[q]||(a+k)[M](/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(a,d,e){var f=[],g=s.call(d);e[M](/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(a,b){b&&f[B](+b)});while(f[q]>=b[g]){c[B]([d][j](f.splice(0,b[g])));if(!b[g])break}}),c[x]=f._path2string,c}),f.
 findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,l=A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h,m=a+2*i*(c-a)+i*i*(e-2*c+a),n=b+2*i*(d-b)+i*i*(f-2*d+b),o=c+2*i*(e-c)+i*i*(g-2*e+c),p=d+2*i*(f-d)+i*i*(h-2*f+d),q=(1-i)*a+i*c,r=(1-i)*b+i*d,s=(1-i)*e+i*g,u=(1-i)*f+i*h,v=90-t.atan((m-o)/(n-p))*180/t.PI;return(m>o||n<p)&&(v+=180),{x:k,y:l,m:{x:m,y:n},n:{x:o,y:p},start:{x:q,y:r},end:{x:s,y:u},alpha:v}};var R=Q(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=$(a);var b=0,c=0,d=[],e=[],f;for(var g=0,h=a[q];g<h;g++){f=a[g];if(f[0]=="M")b=f[1],c=f[2],d[B](b),e[B](c);else{var k=Z(b,c,f[1],f[2],f[3],f[4],f[5],f[6]);d=d[j](k.min.x,k.max.x),e=e[j](k.min.y,k.max.y),b=f[5],c=f[6]}}var l=v[i](0,d),m=v[i](0,e);return{x:l,y:m,width:u[i](0,d)-l,height:u[i](0,e)-m}}),S=function(a){var b=[];if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);for(var c=0,d=a[q];c<d;c++){b[c]=[];for(var e=0,g=a[c][q];e<g;e++)b[c][e]=a[c][e]}return b[x]=f._path
 2string,b},T=Q(function(a){if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);var b=[],c=0,d=0,e=0,g=0,h=0;a[0][0]=="M"&&(c=a[0][1],d=a[0][2],e=c,g=d,h++,b[B](["M",c,d]));for(var i=h,j=a[q];i<j;i++){var k=b[i]=[],l=a[i];if(l[0]!=s.call(l[0])){k[0]=s.call(l[0]);switch(k[0]){case"a":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]-c).toFixed(3),k[7]=+(l[7]-d).toFixed(3);break;case"v":k[1]=+(l[1]-d).toFixed(3);break;case"m":e=l[1],g=l[2];default:for(var m=1,n=l[q];m<n;m++)k[m]=+(l[m]-(m%2?c:d)).toFixed(3)}}else{k=b[i]=[],l[0]=="m"&&(e=l[1]+c,g=l[2]+d);for(var o=0,p=l[q];o<p;o++)b[i][o]=l[o]}var r=b[i][q];switch(b[i][0]){case"z":c=e,d=g;break;case"h":c+=+b[i][r-1];break;case"v":d+=+b[i][r-1];break;default:c+=+b[i][r-2],d+=+b[i][r-1]}}return b[x]=f._path2string,b},0,S),U=Q(function(a){if(!f.is(a,"array")||!f.is(a&&a[0],"array"))a=f.parsePathString(a);var b=[],c=0,d=0,e=0,g=0,h=0;a[0][0]=="M"&&(c=+a[0][1],d=+a[0][2],e=c,g=d,h++,b[0]=["M",c,d]);for(var i=h,j=a[
 q];i<j;i++){var k=b[i]=[],l=a[i];if(l[0]!=J.call(l[0])){k[0]=J.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+c),k[7]=+(l[7]+d);break;case"V":k[1]=+l[1]+d;break;case"H":k[1]=+l[1]+c;break;case"M":e=+l[1]+c,g=+l[2]+d;default:for(var m=1,n=l[q];m<n;m++)k[m]=+l[m]+(m%2?c:d)}}else for(var o=0,p=l[q];o<p;o++)b[i][o]=l[o];switch(k[0]){case"Z":c=e,d=g;break;case"H":c=k[1];break;case"V":d=k[1];break;default:c=b[i][b[i][q]-2],d=b[i][b[i][q]-1]}}return b[x]=f._path2string,b},null,S),V=function(a,b,c,d){return[a,b,c,d,c,d]},W=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},X=function(a,b,c,d,e,f,g,h,i,k){var l=t.PI,n=l*120/180,o=l/180*(+e||0),r=[],s,v=Q(function(a,b,c){var d=a*t.cos(c)-b*t.sin(c),e=a*t.sin(c)+b*t.cos(c);return{x:d,y:e}});if(!k){s=v(a,b,-o),a=s.x,b=s.y,s=v(h,i,-o),h=s.x,i=s.y;var w=t.cos(l/180*e),x=t.sin(l/180*e),y=(a-h)/2,z=(b-i)/2;c=u(c,t.abs(y)),d=u(d,t.abs(z));var A=y*y/(c*c)+z*z/(d*d);A>1&&(c
 =t.sqrt(A)*c,d=t.sqrt(A)*d);var B=c*c,C=d*d,D=(f==g?-1:1)*t.sqrt(t.abs((B*C-B*z*z-C*y*y)/(B*z*z+C*y*y))),E=D*c*z/d+(a+h)/2,F=D*-d*y/c+(b+i)/2,G=t.asin(((b-F)/d).toFixed(7)),H=t.asin(((i-F)/d).toFixed(7));G=a<E?l-G:G,H=h<E?l-H:H,G<0&&(G=l*2+G),H<0&&(H=l*2+H),g&&G>H&&(G-=l*2),!g&&H>G&&(H-=l*2)}else G=k[0],H=k[1],E=k[2],F=k[3];var I=H-G;if(t.abs(I)>n){var J=H,K=h,L=i;H=G+n*(g&&H>G?1:-1),h=E+c*t.cos(H),i=F+d*t.sin(H),r=X(h,i,c,d,e,0,g,K,L,[H,J,E,F])}I=H-G;var M=t.cos(G),N=t.sin(G),O=t.cos(H),P=t.sin(H),R=t.tan(I/4),S=4/3*c*R,T=4/3*d*R,U=[a,b],V=[a+S*N,b-T*M],W=[h+S*P,i-T*O],Y=[h,i];V[0]=2*U[0]-V[0],V[1]=2*U[1]-V[1];if(k)return[V,W,Y][j](r);r=[V,W,Y][j](r)[p]()[m](",");var Z=[];for(var $=0,_=r[q];$<_;$++)Z[$]=$%2?v(r[$-1],r[$],o).y:v(r[$],r[$+1],o).x;return Z},Y=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},Z=Q(function(a,b,c,d,e,f,g,h){var j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+t.sqrt(k*k-4
 *j*l))/2/j,n=(-k-t.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g],q;return t.abs(m)>1e12&&(m=.5),t.abs(n)>1e12&&(n=.5),m>0&&m<1&&(q=Y(a,b,c,d,e,f,g,h,m),p[B](q.x),o[B](q.y)),n>0&&n<1&&(q=Y(a,b,c,d,e,f,g,h,n),p[B](q.x),o[B](q.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+t.sqrt(k*k-4*j*l))/2/j,n=(-k-t.sqrt(k*k-4*j*l))/2/j,t.abs(m)>1e12&&(m=.5),t.abs(n)>1e12&&(n=.5),m>0&&m<1&&(q=Y(a,b,c,d,e,f,g,h,m),p[B](q.x),o[B](q.y)),n>0&&n<1&&(q=Y(a,b,c,d,e,f,g,h,n),p[B](q.x),o[B](q.y)),{min:{x:v[i](0,p),y:v[i](0,o)},max:{x:u[i](0,p),y:u[i](0,o)}}}),$=Q(function(a,b){var c=U(a),d=b&&U(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][j](X[i](0,[b.x,b.y][j](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][j](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.
 x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][j](W(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][j](W(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][j](V(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][j](V(b.x,b.y,a[1],b.y));break;case"V":a=["C"][j](V(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][j](V(b.x,b.y,b.X,b.Y))}return a},h=function(a,b){if(a[b][q]>7){a[b].shift();var e=a[b];while(e[q])a.splice(b++,0,["C"][j](e.splice(0,6)));a.splice(b,1),m=u(c[q],d&&d[q]||0)}},k=function(a,b,e,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),e.bx=0,e.by=0,e.x=a[g][1],e.y=a[g][2],m=u(c[q],d&&d[q]||0))};for(var l=0,m=u(c[q],d&&d[q]||0);l<m;l++){c[l]=g(c[l],e),h(c,l),d&&(d[l]=g(d[l],f)),d&&h(d,l),k(c,d,e,f,l),k(d,c,f,e,l);var n=c[l],o=d&&d[l],p=n[q],r=d&&o[q];e.x=n[p-2],e.y=n[p-1],e.bx=H(n[p-4])||e.x,e.by=H(n[p-3])||e.y,f.bx=d&&(H(o[r-4])||f.x),f.by=d&&(H(o[r-3])||f.y),f.x=d&&o[r-2],f.y=d&&o[r-1]}return d?[c,d]:c},null,S),_=Q(function(a){var b=[];for(var c=0,d=a
 [q];c<d;c++){var e={},g=a[c].match(/^([^:]*):?([\d\.]*)/);e.color=f.getRGB(g[1]);if(e.color.error)return null;e.color=e.color.hex,g[2]&&(e.offset=g[2]+"%"),b[B](e)}for(var c=1,d=b[q]-1;c<d;c++)if(!b[c].offset){var h=H(b[c-1].offset||0),i=0;for(var j=c+1;j<d;j++)if(b[j].offset){i=b[j].offset;break}i||(i=100,j=d),i=H(i);var k=(i-h)/(j-c+1);for(;c<j;c++)h+=k,b[c].offset=h+"%"}return b}),ba=function(){var a,b,d,e,g;if(f.is(arguments[0],"string")||f.is(arguments[0],"object")){f.is(arguments[0],"string")?a=c.getElementById(arguments[0]):a=arguments[0];if(a.tagName)return arguments[1]==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:arguments[1],height:arguments[2]}}else if(f.is(arguments[0],w)&&arguments[q]>3)return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]}},bb=function(a,b){var c=this;for(var d in b)if(b[o](d)&&!(d in a))switch(typeof b[d]){case"function":(function(b){a[d]=a==
 =c?b:function(){return b[i](c,arguments)}})(b[d]);break;case"object":a[d]=a[d]||{},bb.call(this,a[d],b[d]);break;default:a[d]=b[d]}},bc=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)},bd=function(a,b){if(b.top===a)return;bc(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a},be=function(a,b){if(b.bottom===a)return;bc(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a},bf=function(a,b,c){bc(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bg=function(a,b,c){bc(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bh=function(a){return function(){throw new Error("Raphaël: you are calling to method “"+a+"” of removed object")}},bi=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(f.svg){g[r].svgns="http://www.w3.org/2000/svg",g[r].xlink="http://www.w3.org/1999/xlink";var F=function(a){return+a+(~~a===a)*.5},bj=function(a){for(var b=0,c
 =a[q];b<c;b++)if(s.call(a[b][0])!="a")for(var d=1,e=a[b][q];d<e;d++)a[b][d]=F(a[b][d]);else a[b][6]=F(a[b][6]),a[b][7]=F(a[b][7]);return a},bk=function(a,b){if(!b)return c.createElementNS(g[r].svgns,a);for(var d in b)b[o](d)&&a[G](d,b[d])};f[x]=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var bl=function(a,b){var c=bk("path");b.canvas&&b.canvas[h](c);var d=new br(c,b);return d.type="path",bo(d,{fill:"none",stroke:"#000",path:a}),d},bm=function(a,b,c){var d="linear",e=.5,g=.5,i=a.style;b=(b+k)[M](bi,function(a,b,c){d="radial";if(b&&c){e=H(b),g=H(c);var f=(g>.5)*2-1;A(e-.5,2)+A(g-.5,2)>.25&&(g=t.sqrt(.25-A(e-.5,2))*f+.5)&&g!=.5&&(g=g.toFixed(5)-1e-5*f)}return k}),b=b[m](/\s*\-\s*/);if(d=="linear"){var j=b.shift();j=-H(j);if(isNaN(j))return null;var l=[0,0,t.cos(j*t.PI/180),t.sin(j*t.PI/180)],n=1/(u(t.abs(l[2]),t.abs(l[3]))||1);l[2]*=n,l[3]*=n,l[2]<0&&(l[0]=-l[2],l[2]=0),l[3]<0&&(l[1]=-l[3],l[3]=0)}var o=_(b);if(!o)return null;var p=bk(d+"Gradi
 ent");p.id="r"+(f._id++)[x](36),bk(p,d=="radial"?{fx:e,fy:g}:{x1:l[0],y1:l[1],x2:l[2],y2:l[3]}),c.defs[h](p);for(var r=0,s=o[q];r<s;r++){var v=bk("stop");bk(v,{offset:o[r].offset?o[r].offset:r?"100%":"0%","stop-color":o[r].color||"#fff"}),p[h](v)}return bk(a,{fill:"url(#"+p.id+")",opacity:1,"fill-opacity":1}),i.fill=k,i.opacity=1,i.fillOpacity=1,1},bn=function(a){var b=a.getBBox();bk(a.pattern,{patternTransform:f.format("translate({0},{1})",b.x,b.y)})},bo=function(b,d){var e={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},g=b.node,i=b.attrs,j=b.rotate(),n=function(a,b){b=e[s.call(b)];if(b){var c=a.attrs["stroke-width"]||"1",f={round:c,square:c,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,h=[],i=b[q];while(i--)h[i]=b[i]*c+(i%2?1:-1)*f;bk(g,{"stroke-dasharray":h[p](",")})}};d[o]("rotation")&&(j=d.rotation);var r=(j+k)[m](a);r.length-1?(r[1]=+r[1],r[2]=+r[2]):r=n
 ull,H(j)&&b.rotate(0,!0);for(var t in d)if(d[o](t)){if(!K[o](t))continue;var u=d[t];i[t]=u;switch(t){case"rotation":b.rotate(u,!0);break;case"href":case"title":case"target":var v=g.parentNode;if(s.call(v.tagName)!="a"){var w=bk("a");v.insertBefore(w,g),w[h](g),v=w}v.setAttributeNS(b.paper.xlink,t,u);break;case"cursor":g.style.cursor=u;break;case"clip-rect":var y=(u+k)[m](a);if(y[q]==4){b.clip&&b.clip.parentNode.parentNode.removeChild(b.clip.parentNode);var z=bk("clipPath"),A=bk("rect");z.id="r"+(f._id++)[x](36),bk(A,{x:y[0],y:y[1],width:y[2],height:y[3]}),z[h](A),b.paper.defs[h](z),bk(g,{"clip-path":"url(#"+z.id+")"}),b.clip=A}if(!u){var B=c.getElementById(g.getAttribute("clip-path")[M](/(^url\(#|\)$)/g,k));B&&B.parentNode.removeChild(B),bk(g,{"clip-path":k}),delete b.clip}break;case"path":u&&b.type=="path"&&(i.path=bj(U(u)),bk(g,{d:i.path}));break;case"width":g[G](t,u);if(i.fx)t="x",u=i.x;else break;case"x":i.fx&&(u=-i.x-(i.width||0));case"rx":if(t=="rx"&&b.type=="rect")break;case"
 cx":r&&(t=="x"||t=="cx")&&(r[1]+=u-i[t]),g[G](t,F(u)),b.pattern&&bn(b);break;case"height":g[G](t,u);if(i.fy)t="y",u=i.y;else break;case"y":i.fy&&(u=-i.y-(i.height||0));case"ry":if(t=="ry"&&b.type=="rect")break;case"cy":r&&(t=="y"||t=="cy")&&(r[2]+=u-i[t]),g[G](t,F(u)),b.pattern&&bn(b);break;case"r":b.type=="rect"?bk(g,{rx:u,ry:u}):g[G](t,u);break;case"src":b.type=="image"&&g.setAttributeNS(b.paper.xlink,"href",u);break;case"stroke-width":g.style.strokeWidth=u,g[G](t,u),i["stroke-dasharray"]&&n(b,i["stroke-dasharray"]);break;case"stroke-dasharray":n(b,u);break;case"translation":var C=(u+k)[m](a);C[0]=+C[0]||0,C[1]=+C[1]||0,r&&(r[1]+=C[0],r[2]+=C[1]),bN.call(b,C[0],C[1]);break;case"scale":var C=(u+k)[m](a);b.scale(+C[0]||1,+C[1]||+C[0]||1,+C[2]||null,+C[3]||null);break;case"fill":var E=(u+k).match(D);if(E){var z=bk("pattern"),L=bk("image");z.id="r"+(f._id++)[x](36),bk(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),bk(L,{x:0,y:0}),L.setAttributeNS(b.paper.xlink,"href",E[1]
 ),z[h](L);var N=c.createElement("img");N.style.cssText="position:absolute;left:-9999em;top-9999em",N.onload=function(){bk(z,{width:this.offsetWidth,height:this.offsetHeight}),bk(L,{width:this.offsetWidth,height:this.offsetHeight}),c.body.removeChild(this),b.paper.safari()},c.body[h](N),N.src=E[1],b.paper.defs[h](z),g.style.fill="url(#"+z.id+")",bk(g,{fill:"url(#"+z.id+")"}),b.pattern=z,b.pattern&&bn(b);break}if(!f.getRGB(u).error)delete d.gradient,delete i.gradient,!f.is(i.opacity,"undefined")&&f.is(d.opacity,"undefined")&&bk(g,{opacity:i.opacity}),!f.is(i["fill-opacity"],"undefined")&&f.is(d["fill-opacity"],"undefined")&&bk(g,{"fill-opacity":i["fill-opacity"]});else if(({circle:1,ellipse:1}[o](b.type)||(u+k).charAt()!="r")&&bm(g,u,b.paper)){i.gradient=u,i.fill="none";break};case"stroke":g[G](t,f.getRGB(u).hex);break;case"gradient":((({circle:1,ellipse:1}))[o](b.type)||(u+k).charAt()!="r")&&bm(g,u,b.paper);break;case"opacity":case"fill-opacity":if(i.gradient){var O=c.getElementById(
 g.getAttribute("fill")[M](/^url\(#|\)$/g,k));if(O){var P=O.getElementsByTagName("stop");P[P[q]-1][G]("stop-opacity",u)}break};default:t=="font-size"&&(u=I(u,10)+"px");var Q=t[M](/(\-.)/g,function(a){return J.call(a.substring(1))});g.style[Q]=u,g[G](t,u)}}bq(b,d),r?b.rotate(r.join(l)):H(j)&&b.rotate(j,!0)},bp=1.2,bq=function(a,b){if(a.type!="text"||!(b[o]("text")||b[o]("font")||b[o]("font-size")||b[o]("x")||b[o]("y")))return;var d=a.attrs,e=a.node,f=e.firstChild?I(c.defaultView.getComputedStyle(e.firstChild,k).getPropertyValue("font-size"),10):10;if(b[o]("text")){d.text=b.text;while(e.firstChild)e.removeChild(e.firstChild);var g=(b.text+k)[m]("\n");for(var i=0,j=g[q];i<j;i++)if(g[i]){var l=bk("tspan");i&&bk(l,{dy:f*bp,x:d.x}),l[h](c.createTextNode(g[i])),e[h](l)}}else{var g=e.getElementsByTagName("tspan");for(var i=0,j=g[q];i<j;i++)i&&bk(g[i],{dy:f*bp,x:d.x})}bk(e,{y:d.y});var n=a.getBBox(),p=d.y-(n.y+n.height/2);p&&isFinite(p)&&bk(e,{y:d.y+p})},br=function(a,b){var c=0,d=0;this[0]=a
 ,this.id=f._oid++,this.node=a,a.raphael=this,this.paper=b,this.attrs=this.attrs||{},this.transformations=[],this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null};br[r].rotate=function(b,c,d){if(this.removed)return this;if(b==null)return this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][p](l):this._.rt.deg;var e=this.getBBox();return b=(b+k)[m](a),b[q]-1&&(c=H(b[1]),d=H(b[2])),b=H(b[0]),c!=null?this._.rt.deg=b:this._.rt.deg+=b,d==null&&(c=null),this._.rt.cx=c,this._.rt.cy=d,c=c==null?e.x+e.width/2:c,d=d==null?e.y+e.height/2:d,this._.rt.deg?(this.transformations[0]=f.format("rotate({0} {1} {2})",this._.rt.deg,c,d),this.clip&&bk(this.clip,{transform:f.format("rotate({0} {1} {2})",-this._.rt.deg,c,d)})):(this.transformations[0]=k,this.clip&&bk(this.clip,{transform:k})),bk(this.node,{transform:this.transformations[p](l)}),this},br[r].hide=function(){return!this.removed&&(this.node.style.displa
 y="none"),this},br[r].show=function(){return!this.removed&&(this.node.style.display=""),this},br[r].remove=function(){if(this.removed)return;bc(this,this.paper),this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=!0},br[r].getBBox=function(){if(this.removed)return this;if(this.type=="path")return R(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var d=0,e=this.node.getNumberOfChars();d<e;d++){var f=this.node.getExtentOfChar(d);f.y<b.y&&(b.y=f.y),f.y+f.height-b.y>b.height&&(b.height=f.y+f.height-b.y),f.x+f.width-b.x>b.width&&(b.width=f.x+f.width-b.x)}}return a&&this.hide(),b},br[r].attr=function(){if(this.removed)return this;if(arguments[q]==0){var a={};for(var b in this.attrs)this.attrs[o](b)&&(a[b]=this.attrs[b]);return this._.rt.deg&&(a.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(a.sc
 ale=this.scale()),a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient,a}if(arguments[q]==1&&f.is(arguments[0],"string"))return arguments[0]=="translation"?bN.call(this):arguments[0]=="rotation"?this.rotate():arguments[0]=="scale"?this.scale():arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[arguments[0]];if(arguments[q]==1&&f.is(arguments[0],"array")){var c={};for(var d in arguments[0])arguments[0][o](d)&&(c[arguments[0][d]]=this.attrs[arguments[0][d]]);return c}if(arguments[q]==2){var e={};e[arguments[0]]=arguments[1],bo(this,e)}else arguments[q]==1&&f.is(arguments[0],"object")&&bo(this,arguments[0]);return this},br[r].toFront=function(){if(this.removed)return this;this.node.parentNode[h](this.node);var a=this.paper;return a.top!=this&&bd(this,a),this},br[r].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.first
 Child),be(this,this.paper);var a=this.paper}return this},br[r].insertAfter=function(a){if(this.removed)return this;var b=a.node;return b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[h](this.node),bf(this,a,this.paper),this},br[r].insertBefore=function(a){if(this.removed)return this;var b=a.node;return b.parentNode.insertBefore(this.node,b),bg(this,a,this.paper),this};var bs=function(a,b,c,d){b=F(b),c=F(c);var e=bk("circle");a.canvas&&a.canvas[h](e);var f=new br(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",bk(e,f.attrs),f},bt=function(a,b,c,d,e,f){b=F(b),c=F(c);var g=bk("rect");a.canvas&&a.canvas[h](g);var i=new br(g,a);return i.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},i.type="rect",bk(g,i.attrs),i},bu=function(a,b,c,d,e){b=F(b),c=F(c);var f=bk("ellipse");a.canvas&&a.canvas[h](f);var g=new br(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",bk(f
 ,g.attrs),g},bv=function(a,b,c,d,e,f){var g=bk("image");bk(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(a.xlink,"href",b),a.canvas&&a.canvas[h](g);var i=new br(g,a);return i.attrs={x:c,y:d,width:e,height:f,src:b},i.type="image",i},bw=function(a,b,c,d){var e=bk("text");bk(e,{x:b,y:c,"text-anchor":"middle"}),a.canvas&&a.canvas[h](e);var f=new br(e,a);return f.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:K.font,stroke:"none",fill:"#000"},f.type="text",bo(f,f.attrs),f},bx=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas[G]("width",this.width),this.canvas[G]("height",this.height),this},by=function(){var a=ba[i](null,arguments),b=a&&a.container,d=a.x,e=a.y,j=a.width,k=a.height;if(!b)throw new Error("SVG container not found.");var l=bk("svg");return j=j||512,k=k||342,bk(l,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:j,height:k}),b==1?(l.style.cssText="position:absolute;left:"+d+"px;top:"+e+"px",c.body[h](l)):b.f
 irstChild?b.insertBefore(l,b.firstChild):b[h](l),b=new g,b.width=j,b.height=k,b.canvas=l,bb.call(b,b,f.fn),b.clear(),b};g[r].clear=function(){var a=this.canvas;while(a.firstChild)a.removeChild(a.firstChild);this.bottom=this.top=null,(this.desc=bk("desc"))[h](c.createTextNode("Created with Raphaël")),a[h](this.desc),a[h](this.defs=bk("defs"))},g[r].remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bh(a)}}if(f.vml){var bz=function(a){var b=/[ahqstv]/ig,c=U;(a+k).match(b)&&(c=$),b=/[clmz]/g;if(c==U&&!(a+k).match(b)){var d={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},e=/([clmz]),?([^clmz]*)/gi,f=/-?[^,\s-]+/g,g=(a+k)[M](e,function(a,b,c){var e=[];return c[M](f,function(a){e[B](F(a))}),d[b]+e});return g}var h=c(a),i,g=[],j;for(var m=0,n=h[q];m<n;m++){i=h[m],j=s.call(h[m][0]),j=="z"&&(j="x");for(var o=1,r=i[q];o<r;o++)j+=F(i[o])+(o!=r-1?",":k);g[B](j)}return g[p](l)};f[x]=function(){return"Your browser doesn’t suppo
 rt SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var bl=function(a,b){var c=bA("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px",c.coordsize=b.coordsize,c.coordorigin=b.coordorigin;var d=bA("shape"),e=d.style;e.width=b.width+"px",e.height=b.height+"px",d.coordsize=this.coordsize,d.coordorigin=this.coordorigin,c[h](d);var f=new br(d,c,b);return f.isAbsolute=!0,f.type="path",f.path=[],f.Path=k,a&&bo(f,{fill:"none",stroke:"#000",path:a}),b.canvas[h](c),f},bo=function(b,d){b.attrs=b.attrs||{};var e=b.node,g=b.attrs,i=e.style,j,l=b;for(var n in d)d[o](n)&&(g[n]=d[n]);d.href&&(e.href=d.href),d.title&&(e.title=d.title),d.target&&(e.target=d.target),d.cursor&&(i.cursor=d.cursor),d.path&&b.type=="path"&&(g.path=d.path,e.path=bz(g.path)),d.rotation!=null&&b.rotate(d.rotation,!0),d.translation&&(j=(d.translation+k)[m](a),bN.call(b,j[0],j[1]),b._.rt.cx!=null&&(b._.rt.cx+=+j[0],b._.rt.cy+=+j[1],b.setBox(b.attrs,j[0],j[1]))),
 d.scale&&(j=(d.scale+k)[m](a),b.scale(+j[0]||1,+j[1]||+j[0]||1,+j[2]||null,+j[3]||null));if("clip-rect"in d){var p=(d["clip-rect"]+k)[m](a);if(p[q]==4){p[2]=+p[2]+ +p[0],p[3]=+p[3]+ +p[1];var r=e.clipRect||c.createElement("div"),s=r.style,t=e.parentNode;s.clip=f.format("rect({1}px {2}px {3}px {0}px)",p),e.clipRect||(s.position="absolute",s.top=0,s.left=0,s.width=b.paper.width+"px",s.height=b.paper.height+"px",t.parentNode.insertBefore(r,t),r[h](t),e.clipRect=r)}d["clip-rect"]||e.clipRect&&(e.clipRect.style.clip=k)}b.type=="image"&&d.src&&(e.src=d.src),b.type=="image"&&d.opacity&&(e.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+d.opacity*100+")",i.filter=(e.filterMatrix||k)+(e.filterOpacity||k)),d.font&&(i.font=d.font),d["font-family"]&&(i.fontFamily='"'+d["font-family"][m](",")[0][M](/^['"]+|['"]+$/g,k)+'"'),d["font-size"]&&(i.fontSize=d["font-size"]),d["font-weight"]&&(i.fontWeight=d["font-weight"]),d["font-style"]&&(i.fontStyle=d["font-style"]);if(d.opacity!=nu
 ll||d["stroke-width"]!=null||d.fill!=null||d.stroke!=null||d["stroke-width"]!=null||d["stroke-opacity"]!=null||d["fill-opacity"]!=null||d["stroke-dasharray"]!=null||d["stroke-miterlimit"]!=null||d["stroke-linejoin"]!=null||d["stroke-linecap"]!=null){e=b.shape||e;var u=e.getElementsByTagName("fill")&&e.getElementsByTagName("fill")[0],v=!1;!u&&(v=u=bA("fill"));if("fill-opacity"in d||"opacity"in d){var w=((+g["fill-opacity"]+1||2)-1)*((+g.opacity+1||2)-1);w<0&&(w=0),w>1&&(w=1),u.opacity=w}d.fill&&(u.on=!0);if(u.on==null||d.fill=="none")u.on=!1;if(u.on&&d.fill){var x=d.fill.match(D);x?(u.src=x[1],u.type="tile"):(u.color=f.getRGB(d.fill).hex,u.src=k,u.type="solid",f.getRGB(d.fill).error&&(l.type in{circle:1,ellipse:1}||(d.fill+k).charAt()!="r")&&bm(l,d.fill)&&(g.fill="none",g.gradient=d.fill))}v&&e[h](u);var y=e.getElementsByTagName("stroke")&&e.getElementsByTagName("stroke")[0],z=!1;!y&&(z=y=bA("stroke"));if(d.stroke&&d.stroke!="none"||d["stroke-width"]||d["stroke-opacity"]!=null||d["st
 roke-dasharray"]||d["stroke-miterlimit"]||d["stroke-linejoin"]||d["stroke-linecap"])y.on=!0;(d.stroke=="none"||y.on==null||d.stroke==0||d["stroke-width"]==0)&&(y.on=!1),y.on&&d.stroke&&(y.color=f.getRGB(d.stroke).hex);var w=((+g["stroke-opacity"]+1||2)-1)*((+g.opacity+1||2)-1),A=(H(d["stroke-width"])||1)*.75;w<0&&(w=0),w>1&&(w=1),d["stroke-width"]==null&&(A=g["stroke-width"]),d["stroke-width"]&&(y.weight=A),A&&A<1&&(w*=A)&&(y.weight=1),y.opacity=w,d["stroke-linejoin"]&&(y.joinstyle=d["stroke-linejoin"]||"miter"),y.miterlimit=d["stroke-miterlimit"]||8,d["stroke-linecap"]&&(y.endcap=d["stroke-linecap"]=="butt"?"flat":d["stroke-linecap"]=="square"?"square":"round");if(d["stroke-dasharray"]){var B={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};y.dashstyle=B[o](d["stroke-dasharray"])?B[d["stroke-dasharray"]]:k}z&&e[h](y)}if(l.type=="text"){var i=l.paper.span.st
 yle;g.font&&(i.font=g.font),g["font-family"]&&(i.fontFamily=g["font-family"]),g["font-size"]&&(i.fontSize=g["font-size"]),g["font-weight"]&&(i.fontWeight=g["font-weight"]),g["font-style"]&&(i.fontStyle=g["font-style"]),l.node.string&&(l.paper.span.innerHTML=(l.node.string+k)[M](/</g,"&#60;")[M](/&/g,"&#38;")[M](/\n/g,"<br>")),l.W=g.w=l.paper.span.offsetWidth,l.H=g.h=l.paper.span.offsetHeight,l.X=g.x,l.Y=g.y+F(l.H/2);switch(g["text-anchor"]){case"start":l.node.style["v-text-align"]="left",l.bbx=F(l.W/2);break;case"end":l.node.style["v-text-align"]="right",l.bbx=-F(l.W/2);break;default:l.node.style["v-text-align"]="center"}}},bm=function(a,b){a.attrs=a.attrs||{};var c=a.attrs,d=a.node.getElementsByTagName("fill"),e="linear",f=".5 .5";a.attrs.gradient=b,b=(b+k)[M](bi,function(a,b,c){return e="radial",b&&c&&(b=H(b),c=H(c),A(b-.5,2)+A(c-.5,2)>.25&&(c=t.sqrt(.25-A(b-.5,2))*((c>.5)*2-1)+.5),f=b+l+c),k}),b=b[m](/\s*\-\s*/);if(e=="linear"){var g=b.shift();g=-H(g);if(isNaN(g))return null}var 
 h=_(b);if(!h)return null;a=a.shape||a.node,d=d[0]||bA("fill");if(h[q]){d.on=!0,d.method="none",d.type=e=="radial"?"gradientradial":"gradient",d.color=h[0].color,d.color2=h[h[q]-1].color;var i=[];for(var j=0,n=h[q];j<n;j++)h[j].offset&&i[B](h[j].offset+l+h[j].color);d.colors&&(d.colors.value=i[q]?i[p](","):"0% "+d.color),e=="radial"?(d.focus="100%",d.focussize=f,d.focusposition=f):d.angle=(270-g)%360}return 1},br=function(a,b,c){var d=0,e=0,g=0,h=1;this[0]=a,this.id=f._oid++,this.node=a,a.raphael=this,this.X=0,this.Y=0,this.attrs={},this.Group=b,this.paper=c,this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null};br[r].rotate=function(b,c,d){return this.removed?this:b==null?this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][p](l):this._.rt.deg:(b=(b+k)[m](a),b[q]-1&&(c=H(b[1]),d=H(b[2])),b=H(b[0]),c!=null?this._.rt.deg=b:this._.rt.deg+=b,d==null&&(c=null),this._.rt.cx=c,this._.rt.cy=d,this.setBox(this.
 attrs,c,d),this.Group.style.rotation=this._.rt.deg,this)},br[r].setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,e=this.shape&&this.shape.style||this.node.style;a=a||{};for(var f in a)a[o](f)&&(this.attrs[f]=a[f]);b=b||this._.rt.cx,c=c||this._.rt.cy;var g=this.attrs,i,j,l,m;switch(this.type){case"circle":i=g.cx-g.r,j=g.cy-g.r,l=m=g.r*2;break;case"ellipse":i=g.cx-g.rx,j=g.cy-g.ry,l=g.rx*2,m=g.ry*2;break;case"rect":case"image":i=+g.x,j=+g.y,l=g.width||0,m=g.height||0;break;case"text":this.textpath.v=["m",F(g.x),", ",F(g.y-2),"l",F(g.x)+1,", ",F(g.y-2)][p](k),i=g.x-F(this.W/2),j=g.y-this.H/2,l=this.W,m=this.H;break;case"path":if(!this.attrs
-.path)i=0,j=0,l=this.paper.width,m=this.paper.height;else{var n=R(this.attrs.path);i=n.x,j=n.y,l=n.width,m=n.height}break;default:i=0,j=0,l=this.paper.width,m=this.paper.height}b=b==null?i+l/2:b,c=c==null?j+m/2:c;var r=b-this.paper.width/2,s=c-this.paper.height/2;if(this.type=="path"||this.type=="text")d.left!=r+"px"&&(d.left=r+"px"),d.top!=s+"px"&&(d.top=s+"px"),this.X=this.type=="text"?i:-r,this.Y=this.type=="text"?j:-s,this.W=l,this.H=m,e.left!=-r+"px"&&(e.left=-r+"px"),e.top!=-s+"px"&&(e.top=-s+"px");else{d.left!=r+"px"&&(d.left=r+"px"),d.top!=s+"px"&&(d.top=s+"px"),this.X=i,this.Y=j,this.W=l,this.H=m,d.width!=this.paper.width+"px"&&(d.width=this.paper.width+"px"),d.height!=this.paper.height+"px"&&(d.height=this.paper.height+"px"),e.left!=i-r+"px"&&(e.left=i-r+"px"),e.top!=j-s+"px"&&(e.top=j-s+"px"),e.width!=l+"px"&&(e.width=l+"px"),e.height!=m+"px"&&(e.height=m+"px");var t=(+a.r||0)/v(l,m);if(this.type=="rect"&&this.arcsize.toFixed(4)!=t.toFixed(4)&&(t||this.arcsize)){var u=bA(
 "roundrect"),w={},f=0,x=this.events&&this.events[q];u.arcsize=t,u.raphael=this,this.Group[h](u),this.Group.removeChild(this.node),this[0]=this.node=u,this.arcsize=t;for(var f in g)w[f]=g[f];delete w.scale,this.attr(w);if(this.events)for(;f<x;f++)this.events[f].unbind=bC(this.node,this.events[f].name,this.events[f].f,this)}}},br[r].hide=function(){return!this.removed&&(this.Group.style.display="none"),this},br[r].show=function(){return!this.removed&&(this.Group.style.display="block"),this},br[r].getBBox=function(){return this.removed?this:this.type=="path"?R(this.attrs.path):{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}},br[r].remove=function(){if(this.removed)return;bc(this,this.paper),this.node.parentNode.removeChild(this.node),this.Group.parentNode.removeChild(this.Group),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=!0},br[r].attr=function(){if(this.removed)return this;if(arguments[q]==0){var a={};for(var b 
 in this.attrs)this.attrs[o](b)&&(a[b]=this.attrs[b]);return this._.rt.deg&&(a.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale()),a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient,a}if(arguments[q]==1&&f.is(arguments[0],"string"))return arguments[0]=="translation"?bN.call(this):arguments[0]=="rotation"?this.rotate():arguments[0]=="scale"?this.scale():arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[arguments[0]];if(this.attrs&&arguments[q]==1&&f.is(arguments[0],"array")){var c={};for(var b=0,d=arguments[0][q];b<d;b++)c[arguments[0][b]]=this.attrs[arguments[0][b]];return c}var e;return arguments[q]==2&&(e={},e[arguments[0]]=arguments[1]),arguments[q]==1&&f.is(arguments[0],"object")&&(e=arguments[0]),e&&(e.text&&this.type=="text"&&(this.node.string=e.text),bo(this,e),e.gradient&&({circle:1,ellipse:1}[o](this.type)||(e.gradient+k).charAt()!="r")&&bm(this,e.gradient),(this.type!="path"||this._.rt.
 deg)&&this.setBox(this.attrs)),this},br[r].toFront=function(){return!this.removed&&this.Group.parentNode[h](this.Group),this.paper.top!=this&&bd(this,this.paper),this},br[r].toBack=function(){return this.removed?this:(this.Group.parentNode.firstChild!=this.Group&&(this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild),be(this,this.paper)),this)},br[r].insertAfter=function(a){return this.removed?this:(a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[h](this.Group),bf(this,a,this.paper),this)},br[r].insertBefore=function(a){return this.removed?this:(a.Group.parentNode.insertBefore(this.Group,a.Group),bg(this,a,this.paper),this)};var bs=function(a,b,c,d){var e=bA("group"),f=bA("oval"),g=f.style;e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",e.coordsize=a.coordsize,e.coordorigin=a.coordorigin,e[h](f);var i=new br(f,e,a);return i.type="circle",bo(i,{stroke:"#000",fil
 l:"none"}),i.attrs.cx=b,i.attrs.cy=c,i.attrs.r=d,i.setBox({x:b-d,y:c-d,width:d*2,height:d*2}),a.canvas[h](e),i},bt=function(a,b,c,d,e,f){var g=bA("group"),i=bA("roundrect"),j=(+f||0)/v(d,e);g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",g.coordsize=a.coordsize,g.coordorigin=a.coordorigin,g[h](i),i.arcsize=j;var k=new br(i,g,a);return k.type="rect",bo(k,{stroke:"#000"}),k.arcsize=j,k.setBox({x:b,y:c,width:d,height:e,r:f}),a.canvas[h](g),k},bu=function(a,b,c,d,e){var f=bA("group"),g=bA("oval"),i=g.style;f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",f.coordsize=a.coordsize,f.coordorigin=a.coordorigin,f[h](g);var j=new br(g,f,a);return j.type="ellipse",bo(j,{stroke:"#000"}),j.attrs.cx=b,j.attrs.cy=c,j.attrs.rx=d,j.attrs.ry=e,j.setBox({x:b-d,y:c-e,width:d*2,height:e*2}),a.canvas[h](f),j},bv=function(a,b,c,d,e,f){var g=bA("group"),i=bA("image"),j=i.style;g.style.cssText="position:absolute;left:0;top:0
 ;width:"+a.width+"px;height:"+a.height+"px",g.coordsize=a.coordsize,g.coordorigin=a.coordorigin,i.src=b,g[h](i);var k=new br(i,g,a);return k.type="image",k.attrs.src=b,k.attrs.x=c,k.attrs.y=d,k.attrs.w=e,k.attrs.h=f,k.setBox({x:c,y:d,width:e,height:f}),a.canvas[h](g),k},bw=function(a,b,c,d){var e=bA("group"),g=bA("shape"),i=g.style,j=bA("path"),l=j.style,m=bA("textpath");e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px",e.coordsize=a.coordsize,e.coordorigin=a.coordorigin,j.v=f.format("m{0},{1}l{2},{1}",F(b),F(c),F(b)+1),j.textpathok=!0,i.width=a.width,i.height=a.height,m.string=d+k,m.on=!0,g[h](m),g[h](j),e[h](g);var n=new br(m,e,a);return n.shape=g,n.textpath=j,n.type="text",n.attrs.text=d,n.attrs.x=b,n.attrs.y=c,n.attrs.w=1,n.attrs.h=1,bo(n,{font:K.font,stroke:"none",fill:"#000"}),n.setBox(),a.canvas[h](e),n},bx=function(a,b){var c=this.canvas.style;return a==+a&&(a+="px"),b==+b&&(b+="px"),c.width=a,c.height=b,c.clip="rect(0 "+a+" "+b+" 0)"
 ,this},bA;c.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!c.namespaces.rvml&&c.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),bA=function(a){return c.createElement("<rvml:"+a+' class="rvml">')}}catch(bB){bA=function(a){return c.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}var by=function(){var a=ba[i](null,arguments),b=a.container,d=a.height,e,j=a.width,k=a.x,l=a.y;if(!b)throw new Error("VML container not found.");var m=new g,n=m.canvas=c.createElement("div"),o=n.style;return j=j||512,d=d||342,j==+j&&(j+="px"),d==+d&&(d+="px"),m.width=1e3,m.height=1e3,m.coordsize="1000 1000",m.coordorigin="0 0",m.span=c.createElement("span"),m.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",n[h](m.span),o.cssText=f.format("width:{0};height:{1};position:absolute;clip:rect(0 {0} {1} 0);overflow:hidden",j,d),b==1?(c.body[h](n),o.left=k+"px",o.top=l+"px"):(b.style.width=j,b.st
 yle.height=d,b.firstChild?b.insertBefore(n,b.firstChild):b[h](n)),bb.call(m,m,f.fn),m};g[r].clear=function(){this.canvas.innerHTML=k,this.span=c.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas[h](this.span),this.bottom=this.top=null},g[r].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bh(a)}}/^Apple|^Google/.test(navigator.vendor)&&!(navigator.userAgent.indexOf("Version/4.0")+1)?g[r].safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99);setTimeout(function(){a.remove()})}:g[r].safari=function(){};var bC=function(){if(c.addEventListener)return function(a,b,c,d){var e=function(a){return c.call(d,a)};return a.addEventListener(b,e,!1),function(){return a.removeEventListener(b,e,!1),!0}};if(c.attachEvent)return function(a,b,c,e){var f=function(a){return c.call(e,a||d.event)};a.attachEvent("on"+b,f);var g=function(){return a
 .detachEvent("on"+b,f),!0};return g}}();for(var bD=n[q];bD--;)(function(a){br[r][a]=function(b){return f.is(b,"function")&&(this.events=this.events||[],this.events.push({name:a,f:b,unbind:bC(this.shape||this.node,a,b,this)})),this},br[r]["un"+a]=function(b){var c=this.events,d=c[q];while(d--)if(c[d].name==a&&c[d].f==b)return c[d].unbind(),c.splice(d,1),!c.length&&delete this.events,this;return this}})(n[bD]);br[r].hover=function(a,b){return this.mouseover(a).mouseout(b)},br[r].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)},g[r].circle=function(a,b,c){return bs(this,a||0,b||0,c||0)},g[r].rect=function(a,b,c,d,e){return bt(this,a||0,b||0,c||0,d||0,e||0)},g[r].ellipse=function(a,b,c,d){return bu(this,a||0,b||0,c||0,d||0)},g[r].path=function(a){return a&&!f.is(a,"string")&&!f.is(a[0],"array")&&(a+=k),bl(f.format[i](f,arguments),this)},g[r].image=function(a,b,c,d,e){return bv(this,a||"about:blank",b||0,c||0,d||0,e||0)},g[r].text=function(a,b,c){return bw(this,a||0,b||0,c
 ||k)},g[r].set=function(a){return arguments[q]>1&&(a=Array[r].splice.call(arguments,0,arguments[q])),new bP(a)},g[r].setSize=bx,g[r].top=g[r].bottom=null,g[r].raphael=f,br[r].scale=function(a,b,c,d){if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:bE};b=b||a,!+b&&(b=a);var e,f,g,h,i=this.attrs;if(a!=0){var m=this.getBBox(),n=m.x+m.width/2,o=m.y+m.height/2,r=a/this._.sx,s=b/this._.sy;c=+c||c==0?c:n,d=+d||d==0?d:o;var u=~~(a/t.abs(a)),w=~~(b/t.abs(b)),x=this.node.style,y=c+(n-c)*r,z=d+(o-d)*s;switch(this.type){case"rect":case"image":var A=i.width*u*r,B=i.height*w*s;this.attr({height:B,r:i.r*v(u*r,w*s),width:A,x:y-A/2,y:z-B/2});break;case"circle":case"ellipse":this.attr({rx:i.rx*u*r,ry:i.ry*w*s,r:i.r*v(u*r,w*s),cx:y,cy:z});break;case"path":var C=T(i.path),D=!0;for(var E=0,F=C[q];E<F;E++){var H=C[E],I,K=J.call(H[0]);if(K=="M"&&D)continue;D=!1;if(K=="A")H[C[E][q]-2]*=r,H[C[E][q]-1]*=s,H[1]*=u*r,H[2]*=w*s,H[5]=+(u+w?!!+H[5]:!+H[5]);else if(K=="H")for(I=1,jj=H[q];I<jj;I++)H[I]*=
 r;else if(K=="V")for(I=1,jj=H[q];I<jj;I++)H[I]*=s;else for(I=1,jj=H[q];I<jj;I++)H[I]*=I%2?r:s}var L=R(C),e=y-L.x-L.width/2,f=z-L.y-L.height/2;C[0][1]+=e,C[0][2]+=f,this.attr({path:C})}this.type in{text:1,image:1}&&(u!=1||w!=1)?this.transformations?(this.transformations[2]="scale("[j](u,",",w,")"),this.node[G]("transform",this.transformations[p](l)),e=u==-1?-i.x-(A||0):i.x,f=w==-1?-i.y-(B||0):i.y,this.attr({x:e,y:f}),i.fx=u-1,i.fy=w-1):(this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11="[j](u,", M12=0, M21=0, M22=",w,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')"),x.filter=(this.node.filterMatrix||k)+(this.node.filterOpacity||k)):this.transformations?(this.transformations[2]=k,this.node[G]("transform",this.transformations[p](l)),i.fx=0,i.fy=0):(this.node.filterMatrix=k,x.filter=(this.node.filterMatrix||k)+(this.node.filterOpacity||k)),i.scale=[a,b,c,d][p](l),this._.sx=a,this._.sy=b}return this},br[r].clone=function(){var a=this.attr();return de
 lete a.scale,delete a.translation,this.paper[this.type]().attr(a)};var bF=function(a,b){return function(c,d,e){c=$(c);var g,h,i,j,k="",l={},m,n=0;for(var o=0,q=c.length;o<q;o++){i=c[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=bG(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>d){if(b&&!l.start){m=f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],(d-n)/j),k+=["C",m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(e)return k;l.start=k,k=["M",m.x,m.y+"C",m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]][p](),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!b)return m=f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],(d-n)/j),{x:m.x,y:m.y,alpha:m.alpha}}n+=j,g=+i[5],h=+i[6]}k+=i}return l.end=k,m=a?n:b?l:f.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha}),m}},bG=Q(function(a,b,c,d,e,f,g,h){var i={x:0,y:0},j=0;for(var k=0;k<1.01;k+=.01){var l=Y(a,b,c,d,e,f,g,h,k);k&&(j+=t.sqrt(A(i.x-l.x,2)+A(i.y-l.y,2))),i=l}return j}),bH=bF(1),bI=bF(),bJ=bF(0,1);br[r].getTotalLength=functio
 n(){if(this.type!="path")return;return bH(this.attrs.path)},br[r].getPointAtLength=function(a){if(this.type!="path")return;return bI(this.attrs.path,a)},br[r].getSubpath=function(a,b){if(this.type!="path")return;if(t.abs(this.getTotalLength()-b)<1e-6)return bJ(this.attrs.path,a).end;var c=bJ(this.attrs.path,b,1);return a?bJ(c,a).end:c},f.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,3)},">":function(a){return A(a-1,3)+1},"<>":function(a){return a*=2,a<1?A(a,3)/2:(a-=2,(A(a,3)+2)/2)},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=.3,c=b/4;return A(2,-10*a)*t.sin((a-c)*2*t.PI/b)+1},bounce:function(a){var b=7.5625,c=2.75,d;return a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375),d}};var bK={length:0},bL=function(){var a=+(new Date);for(var b in bK)if(b!="length"&&bK[o](b)){var c=bK[
 b];if(c.stop){delete bK[b],bK[q]--;continue}var d=a-c.start,e=c.ms,g=c.easing,h=c.from,i=c.diff,j=c.to,m=c.t,n=c.prev||0,r=c.el,s=c.callback,t={},u;if(d<e){var v=f.easing_formulas[g]?f.easing_formulas[g](d/e):d/e;for(var w in h)if(h[o](w)){switch(L[w]){case"along":u=v*e*i[w],j.back&&(u=j.len-u);var x=bI(j[w],u);r.translate(i.sx-i.x||0,i.sy-i.y||0),i.x=x.x,i.y=x.y,r.translate(x.x-i.sx,x.y-i.sy),j.rot&&r.rotate(i.r+x.alpha,x.x,x.y);break;case"number":u=+h[w]+v*e*i[w];break;case"colour":u="rgb("+[bM(F(h[w].r+v*e*i[w].r)),bM(F(h[w].g+v*e*i[w].g)),bM(F(h[w].b+v*e*i[w].b))][p](",")+")";break;case"path":u=[];for(var y=0,z=h[w][q];y<z;y++){u[y]=[h[w][y][0]];for(var A=1,B=h[w][y][q];A<B;A++)u[y][A]=+h[w][y][A]+v*e*i[w][y][A];u[y]=u[y][p](l)}u=u[p](l);break;case"csv":switch(w){case"translation":var C=i[w][0]*(d-n),D=i[w][1]*(d-n);m.x+=C,m.y+=D,u=C+l+D;break;case"rotation":u=+h[w][0]+v*e*i[w][0],h[w][1]&&(u+=","+h[w][1]+","+h[w][2]);break;case"scale":u=[+h[w][0]+v*e*i[w][0],+h[w][1]+v*e*i[w][1
 ],2 in j[w]?j[w][2]:k,3 in j[w]?j[w][3]:k][p](l);break;case"clip-rect":u=[];var y=4;while(y--)u[y]=+h[w][y]+v*e*i[w][y]}}t[w]=u}r.attr(t),r._run&&r._run.call(r)}else{if(j.along){var x=bI(j.along,j.len*!j.back);r.translate(i.sx-(i.x||0)+x.x-i.sx,i.sy-(i.y||0)+x.y-i.sy),j.rot&&r.rotate(i.r+x.alpha,x.x,x.y)}(m.x||m.y)&&r.translate(-m.x,-m.y),j.scale&&(j.scale=j.scale+k),r.attr(j),delete bK[b],bK[q]--,r.in_animation=null,f.is(s,"function")&&s.call(r)}c.prev=d}f.svg&&r&&r.paper.safari(),bK[q]&&setTimeout(bL)},bM=function(a){return a>255?255:a<0?0:a},bN=function(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:bE};this._.tx+=+a,this._.ty+=+b;switch(this.type){case"circle":case"ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case"path":var c=T(this.attrs.path);c[0][1]+=+a,c[0][2]+=+b,this.attr({path:c})}return this};br[r].animateWith=function(a,b,c,d,e){return bK[a.id]&&(b.st
 art=bK[a.id].start),this.animate(b,c,d,e)},br[r].animateAlong=bO(),br[r].animateAlongBack=bO(1),br[r].onAnimation=function(a){return this._run=a||0,this},br[r].animate=function(b,c,d,e){if(f.is(d,"function")||!d)e=d||null;var g={},h={},i={};for(var j in b)if(b[o](j)&&L[o](j)){g[j]=this.attr(j),g[j]==null&&(g[j]=K[j]),h[j]=b[j];switch(L[j]){case"along":var l=bH(b[j]),n=bI(b[j],l*!!b.back),p=this.getBBox();i[j]=l/c,i.tx=p.x,i.ty=p.y,i.sx=n.x,i.sy=n.y,h.rot=b.rot,h.back=b.back,h.len=l,b.rot&&(i.r=H(this.rotate())||0);break;case"number":i[j]=(h[j]-g[j])/c;break;case"colour":g[j]=f.getRGB(g[j]);var r=f.getRGB(h[j]);i[j]={r:(r.r-g[j].r)/c,g:(r.g-g[j].g)/c,b:(r.b-g[j].b)/c};break;case"path":var s=$(g[j],h[j]);g[j]=s[0];var t=s[1];i[j]=[];for(var u=0,v=g[j][q];u<v;u++){i[j][u]=[0];for(var w=1,x=g[j][u][q];w<x;w++)i[j][u][w]=(t[u][w]-g[j][u][w])/c}break;case"csv":var y=(b[j]+k)[m](a),z=(g[j]+k)[m](a);switch(j){case"translation":g[j]=[0,0],i[j]=[y[0]/c,y[1]/c];break;case"rotation":g[j]=z[1]==
 y[1]&&z[2]==y[2]?z:[0,y[1],y[2]],i[j]=[(y[0]-g[j][0])/c,0,0];break;case"scale":b[j]=y,g[j]=(g[j]+k)[m](a),i[j]=[(y[0]-g[j][0])/c,(y[1]-g[j][1])/c,0,0];break;case"clip-rect":g[j]=(g[j]+k)[m](a),i[j]=[];var u=4;while(u--)i[j][u]=(y[u]-g[j][u])/c}h[j]=y}}return this.stop(),this.in_animation=1,bK[this.id]={start:b.start||+(new Date),ms:c,easing:d,from:g,diff:i,to:h,el:this,callback:e,t:{x:0,y:0}},++bK[q]==1&&bL(),this},br[r].stop=function(){return bK[this.id]&&bK[q]--,delete bK[this.id],this},br[r].translate=function(a,b){return this.attr({translation:a+" "+b})},br[r][x]=function(){return"Raphaël’s object"},f.ae=bK;var bP=function(a){this.items=[],this[q]=0;if(a)for(var b=0,c=a[q];b<c;b++)a[b]&&(a[b].constructor==br||a[b].constructor==bP)&&(this[this.items[q]]=this.items[this.items[q]]=a[b],this[q]++)};bP[r][B]=function(){var a,b;for(var c=0,d=arguments[q];c<d;c++)a=arguments[c],a&&(a.constructor==br||a.constructor==bP)&&(b=this.items[q],this[b]=this.items[b]=a,this[q]++);return this
 },bP[r].pop=function(){return delete this[this[q]--],this.items.pop()};for(var bQ in br[r])br[r][o](bQ)&&(bP[r][bQ]=function(a){return function(){for(var b=0,c=this.items[q];b<c;b++)this.items[b][a][i](this.items[b],arguments);return this}}(bQ));return bP[r].attr=function(a,b){if(a&&f.is(a,"array")&&f.is(a[0],"object"))for(var c=0,d=a[q];c<d;c++)this.items[c].attr(a[c]);else for(var e=0,g=this.items[q];e<g;e++)this.items[e].attr[i](this.items[e],arguments);return this},bP[r].animate=function(a,b,c,d){(f.is(c,"function")||!c)&&(d=c||null);var e=this.items[q],g=e,h=this,i;d&&(i=function(){!--e&&d.call(h)}),this.items[--g].animate(a,b,c||i,i);while(g--)this.items[g].animateWith(this.items[e-1],a,b,c||i,i);return this},bP[r].insertAfter=function(a){var b=this.items[q];while(b--)this.items[b].insertAfter(a);return this},bP[r].getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items[q];e--;){var f=this.items[e].getBBox();a[B](f.x),b[B](f.y),c[B](f.x+f.width),d[B](f.y+f.height)}retu
 rn a=v[i](0,a),b=v[i](0,b),{x:a,y:b,width:u[i](0,c)-a,height:u[i](0,d)-b}},f.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[o](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c][B](b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=I(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[o](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d[M](/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var g in f.k)f[o](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},g[r].getFont=function(a,b,c,d){d=d||"normal",c=c||"normal",b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;var e=f.fonts[a];if(!e){var g=new RegExp("(^|\\s)"+a[M](/[^\w\d\s+!~.:_-]/g,k)+"(\\s|$)","i");for(var h in f.fonts)if(f.fonts[o](h)&&g.test(h)){e=f.fonts[h];break}}var i;if(e)for(var j=0,l=e[q];j<l;j++){i=e[j];if(i.face["font-weight"]==b&&(i.face["f
 ont-style"]==c||!i.face["font-style"])&&i.face["font-stretch"]==d)break}return i},g[r].print=function(b,c,d,e,g,h){h=h||"middle";var i=this.set(),j=(d+k)[m](k),l=0,n=k,o;f.is(e,"string")&&(e=this.getFont(e));if(e){o=(g||16)/e.face["units-per-em"];var p=e.face.bbox.split(a),r=+p[0],s=+p[1]+(h=="baseline"?p[3]-p[1]+ +e.face.descent:(p[3]-p[1])/2);for(var t=0,u=j[q];t<u;t++){var v=t&&e.glyphs[j[t-1]]||{},w=e.glyphs[j[t]];l+=t?(v.w||e.w)+(v.k&&v.k[j[t]]||0):0,w&&w.d&&i[B](this.path(w.d).attr({fill:"#000",stroke:"none",translation:[l,0]}))}i.scale(o,o,r,s).translate(b-r,c-s)}return i},f.format=function(a){var b=f.is(arguments[1],"array")?[0][j](arguments[1]):arguments,c=/\{(\d+)\}/g;return a&&f.is(a,"string")&&b[q]-1&&(a=a[M](c,function(a,c){return b[++c]==null?k:b[c]})),a||k},f.ninja=function(){var a=Raphael;return e.was?Raphael=e.is:delete Raphael,a},f.el=br[r],f}();var Graph=function(){this.nodes=[],this.nodelist=[],this.edges=[],this.snapshots=[]};Graph.prototype={addNode:function(a,
 b){return this.nodes[a]==undefined&&(this.nodes[a]=new Graph.Node(a,b||{id:a}),this.nodelist.push(this.nodes[a])),this.nodes[a]},addEdge:function(a,b,c){var d=this.addNode(a),e=this.addNode(b),f={source:d,target:e,style:c,weight:c&&c.weight||1};d.edges.push(f),this.edges.push(f);if(!c||!c.directed){var g={source:e,target:d,style:c,weight:c&&c.weight||1,backedge:f};this.edges.push(g),e.edges.push(g)}},snapShot:function(a,b){var c=new Graph;jQuery.extend(!0,c.nodes,this.nodes),jQuery.extend(!0,c.nodelist,this.nodelist),jQuery.extend(!0,c.edges,this.edges),c.snapShot=null,this.snapshots.push({comment:a,graph:c})}},Graph.Node=function(a,b){return b.id=a,b.edges=[],b},Graph.Node.prototype={},Graph.Renderer={},Graph.Renderer.Raphael=function(a,b,c,d,e){this.width=c||400,this.height=d||400;var f=this;this.r=Raphael(a,this.width,this.height),this.radius=e&&e.noderadius?e.noderadius:40,this.graph=b,this.mouse_in=!1,this.graph.render||(this.graph.render=function(){return}),this.isDrag=!1,this
 .dragger=function(a){this.dx=a.clientX,this.dy=a.clientY,f.isDrag=this,this.set&&this.set.animate({"fill-opacity":.1},200)&&this.set.toFront(),a.preventDefault&&a.preventDefault()},document.onmousemove=function(a){a=a||window.event;if(f.isDrag){var b=f.isDrag.set.getBBox(),c=a.clientX-f.isDrag.dx+(b.x+b.width/2),d=a.clientY-f.isDrag.dy+(b.y+b.height/2),e=a.clientX-(c<20?c-20:c>f.width-20?c-f.width+20:0),g=a.clientY-(d<20?d-20:d>f.height-20?d-f.height+20:0);f.isDrag.set.translate(e-f.isDrag.dx,g-f.isDrag.dy);for(var h in f.graph.edges)f.graph.edges[h].connection&&f.graph.edges[h].connection.draw();f.isDrag.dx=e,f.isDrag.dy=g}},document.onmouseup=function(){f.isDrag&&f.isDrag.set.animate({"fill-opacity":.6},500),f.isDrag=!1}},Graph.Renderer.Raphael.prototype={translate:function(a){return[Math.round((a[0]-this.graph.layoutMinX)*this.factorX+this.radius),Math.round((a[1]-this.graph.layoutMinY)*this.factorY+this.radius)]},rotate:function(a,b,c){var d=b*Math.cos(c),e=b*Math.sin(c);return[
 a[0]+d,a[1]+e]},draw:function(){this.factorX=(this.width-10*this.radius)/(this.graph.layoutMaxX-this.graph.layoutMinX),this.factorY=(this.height-15*this.radius)/(this.graph.layoutMaxY-this.graph.layoutMinY);for(a in this.graph.nodes)this.drawNode(this.graph.nodes[a]);for(var a=0;a<this.graph.edges.length;a++)this.drawEdge(this.graph.edges[a])},drawNode:function(a){var b=this.translate([a.layoutPosX,a.layoutPosY]);a.point=b;if(a.shape){var c=a.shape.getBBox(),d=[c.x+Math.round(c.width/2),c.y+Math.round(c.height/2)];a.shape.translate(b[0]-d[0],b[1]-d[1]),this.r.safari();return}var e;if(a.render)e=a.render(this.r,a);else if(!a.shape){var f=Raphael.getColor();e=this.r.set().push(this.r.ellipse(b[0],b[1],30,20).attr({fill:f,stroke:f,"stroke-width":2})).push(this.r.text(b[0],b[1]+30,a.label||a.id))}e.attr({"fill-opacity":.6}),e.items.forEach(function(a){a.set=e,a.node.style.cursor="pointer"}),e.mousedown(this.dragger),a.shape=e},drawEdge:function(a){if(a.backedge)return;a.connection&&a.co
 nnection.draw(),a.connection||(a.style&&a.style.callback&&a.style.callback(a),a.connection=this.r.connection(a.source.shape,a.target.shape,a.style))}},Graph.Layout={},Graph.Layout.Spring=function(a){this.graph=a,this.iterations=500,this.maxRepulsiveForceDistance=6,this.k=2,this.c=.01,this.maxVertexMovement=.5},Graph.Layout.Spring.prototype={layout:function(){this.layoutPrepare();for(var a=0;a<this.iterations;a++)this.layoutIteration();this.layoutCalcBounds()},layoutPrepare:function(){for(i in this.graph.nodes){var a=this.graph.nodes[i];a.layoutPosX=0,a.layoutPosY=0,a.layoutForceX=0,a.layoutForceY=0}},layoutCalcBounds:function(){var a=Infinity,b=-Infinity,c=Infinity,d=-Infinity;for(i in this.graph.nodes){var e=this.graph.nodes[i].layoutPosX,f=this.graph.nodes[i].layoutPosY;e>b&&(b=e),e<a&&(a=e),f>d&&(d=f),f<c&&(c=f)}this.graph.layoutMinX=a,this.graph.layoutMaxX=b,this.graph.layoutMinY=c,this.graph.layoutMaxY=d},layoutIteration:function(){for(var a=0;a<this.graph.nodelist.length;a++){
 var b=this.graph.nodelist[a];for(var c=a+1;c<this.graph.nodelist.length;c++){var d=this.graph.nodelist[c];this.layoutRepulsive(b,d)}}for(var a=0;a<this.graph.edges.length;a++){var e=this.graph.edges[a];this.layoutAttractive(e)}for(a in this.graph.nodes){var f=this.graph.nodes[a],g=this.c*f.layoutForceX,h=this.c*f.layoutForceY,i=this.maxVertexMovement;g>i&&(g=i),g<-i&&(g=-i),h>i&&(h=i),h<-i&&(h=-i),f.layoutPosX+=g,f.layoutPosY+=h,f.layoutForceX=0,f.layoutForceY=0}},layoutRepulsive:function(a,b){var c=b.layoutPosX-a.layoutPosX,d=b.layoutPosY-a.layoutPosY,e=c*c+d*d;if(e<.01){c=.1*Math.random()+.1,d=.1*Math.random()+.1;var e=c*c+d*d}var f=Math.sqrt(e);if(f<this.maxRepulsiveForceDistance){var g=this.k*this.k/f;b.layoutForceX+=g*c/f,b.layoutForceY+=g*d/f,a.layoutForceX-=g*c/f,a.layoutForceY-=g*d/f}},layoutAttractive:function(a){var b=a.source,c=a.target,d=c.layoutPosX-b.layoutPosX,e=c.layoutPosY-b.layoutPosY,f=d*d+e*e;if(f<.01){d=.1*Math.random()+.1,e=.1*Math.random()+.1;var f=d*d+e*e}var
  g=Math.sqrt(f);g>this.maxRepulsiveForceDistance&&(g=this.maxRepulsiveForceDistance,f=g*g);var h=(f-this.k*this.k)/this.k;a.attraction==undefined&&(a.attraction=1),h*=Math.log(a.attraction)*.5+1,c.layoutForceX-=h*d/g,c.layoutForceY-=h*e/g,b.layoutForceX+=h*d/g,b.layoutForceY+=h*e/g}},Raphael.el.tooltip=function(a){return this.tp=a,this.tp.o={x:0,y:0},this.tp.hide(),this.hover(function(a){this.mousemove(function(a){this.tp.translate(a.clientX-this.tp.o.x,a.clientY-this.tp.o.y),this.tp.o={x:a.clientX,y:a.clientY}}),this.tp.show().toFront()},function(a){this.tp.hide(),this.unmousemove()}),this},Raphael.fn.connection=function(a,b,c){var d=this,e={draw:function(){var f=a.getBBox(),g=b.getBBox(),h=0,i=0,j=[{x:f.x+f.width/2,y:f.y-h},{x:f.x+f.width/2,y:f.y+f.height+h},{x:f.x-h,y:f.y+f.height/2},{x:f.x+f.width+h,y:f.y+f.height/2},{x:g.x+g.width/2,y:g.y-i},{x:g.x+g.width/2,y:g.y+g.height+i},{x:g.x-i,y:g.y+g.height/2},{x:g.x+g.width+i,y:g.y+g.height/2}],k={},l=[];for(var m=0;m<4;m++)for(var n=
 4;n<8;n++){var o=Math.abs(j[m].x-j[n].x),p=Math.abs(j[m].y-j[n].y);if(m==n-4||(m!=3&&n!=6||j[m].x<j[n].x)&&(m!=2&&n!=7||j[m].x>j[n].x)&&(m!=0&&n!=5||j[m].y>j[n].y)&&(m!=1&&n!=4||j[m].y<j[n].y))l.push(o+p),k[l[l.length-1].toFixed(3)]=[m,n]}var q=l.length==0?[0,4]:k[Math.min.apply(Math,l).toFixed(3)],r=j[q[0]].x,s=j[q[0]].y,t=j[q[1]].x,u=j[q[1]].y,o=Math.max(Math.abs(r-t)/2,10),p=Math.max(Math.abs(s-u)/2,10),v=[r,r,r-o,r+o][q[0]].toFixed(3),w=[s-p,s+p,s,s][q[0]].toFixed(3),x=[0,0,0,0,t,t,t-o,t+o][q[1]].toFixed(3),y=[0,0,0,0,s+p,s-p,u,u][q[1]].toFixed(3),z=["M",r.toFixed(3),s.toFixed(3),"C",v,w,x,y,t.toFixed(3),u.toFixed(3)].join(",");if(c&&c.directed){var A=Math.sqrt((u-y)*(u-y)+(t-x)*(t-x)),B=function(a,b){return-a*(b||5)/A},C=[{x:(B(t-x)+B(u-y)+t).toFixed(3),y:(B(u-y)+B(t-x)+u).toFixed(3)},{x:(B(t-x)-B(u-y)+t).toFixed(3),y:(B(u-y)-B(t-x)+u).toFixed(3)}];z=z+",M"+C[0].x+","+C[0].y+",L"+t+","+u+",L"+C[1].x+","+C[1].y}e.fg&&e.fg.attr({path:z})||(e.fg=d.path(z).attr({stroke:c&&c.stroke|
 |"#000",fill:"none"}).toBack()),e.bg&&e.bg.attr({path:z})||c&&c.fill&&(e.bg=c.fill.split&&d.path(z).attr({stroke:c.fill,fill:"none","stroke-width":c.width||3}).toBack()),c&&c.label&&(e.label&&e.label.attr({x:(r+t)/2,y:(s+u)/2})||(e.label=d.text((r+t)/2,(s+u)/2,c.label).attr({fill:"#000","font-size":c.fontsize||"12px"})))}};return e.draw(),e};
\ No newline at end of file


[39/41] git commit: - some more improvements to webjars

Posted by ss...@apache.org.
- some more improvements to webjars


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/00f64a01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/00f64a01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/00f64a01

Branch: refs/heads/develop
Commit: 00f64a0188c6d964f8fb761b94a27be2d60e1b42
Parents: f14c7b0
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Jul 9 11:03:58 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Jul 9 11:03:58 2013 +0200

----------------------------------------------------------------------
 extras/webjars/pom.xml                          |   1 +
 extras/webjars/strftime/pom.xml                 |  51 ++
 .../strftime/src/main/resources/strftime.js     | 750 +++++++++++++++++++
 parent/pom.xml                                  |  11 +
 platform/marmotta-core/pom.xml                  |   4 +
 .../src/main/resources/web/admin/system.html    |   6 +-
 .../src/main/resources/web/admin/tasks.html     |   2 +-
 .../resources/web/public/js/lib/strftime.js     | 750 -------------------
 8 files changed, 821 insertions(+), 754 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/extras/webjars/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/pom.xml b/extras/webjars/pom.xml
index a37c28b..4712dd0 100644
--- a/extras/webjars/pom.xml
+++ b/extras/webjars/pom.xml
@@ -18,6 +18,7 @@
         <module>snorql</module>
         <module>codemirror</module>
         <module>sgvizler</module>
+        <module>strftime</module>
     </modules>
     
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/extras/webjars/strftime/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/strftime/pom.xml b/extras/webjars/strftime/pom.xml
new file mode 100644
index 0000000..21ff8a6
--- /dev/null
+++ b/extras/webjars/strftime/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>strftime</artifactId>
+    <version>1.3</version>
+    <packaging>jar</packaging>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <nomunge>true</nomunge>
+                    <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                    <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/strftime.js</output>
+                </configuration>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>**/*.js</exclude>
+                </excludes>
+                <filtering>false</filtering>
+                <targetPath>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</targetPath>
+            </resource>
+        </resources>
+     </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/extras/webjars/strftime/src/main/resources/strftime.js
----------------------------------------------------------------------
diff --git a/extras/webjars/strftime/src/main/resources/strftime.js b/extras/webjars/strftime/src/main/resources/strftime.js
new file mode 100644
index 0000000..4e84444
--- /dev/null
+++ b/extras/webjars/strftime/src/main/resources/strftime.js
@@ -0,0 +1,750 @@
+/*
+ strftime for Javascript
+ Copyright (c) 2008, Philip S Tellis <ph...@bluesmoon.info>
+ All rights reserved.
+ 
+ extended with german locales and %F formatter for Marmotta
+ Jakob Frank <ja...@apache.org>
+ 
+ This code is distributed under the terms of the BSD licence
+ 
+ Redistribution and use of this software 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.
+   * The names of the contributors to this file may not 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.
+ */
+
+/**
+ * \file strftime.js
+ * \author Philip S Tellis \<philip@bluesmoon.info\>
+ * \version 1.3
+ * \date 2008/06
+ * \brief Javascript implementation of strftime
+ * 
+ * Implements strftime for the Date object in javascript based on the PHP implementation described at
+ * http://www.php.net/strftime  This is in turn based on the Open Group specification defined
+ * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
+ * include modified conversion specifiers (i.e., Ex and Ox)
+ *
+ * The following format specifiers are supported:
+ *
+ * \copydoc formats
+ *
+ * \%a, \%A, \%b and \%B should be localised for non-English locales.
+ *
+ * \par Usage:
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
+ * \sa Date.ext.locales for localisation information
+ * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
+ * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
+ */
+
+//! Date extension object - all supporting objects go in here.
+Date.ext = Date.ext || {};
+
+//! Utility methods
+Date.ext.util = Date.ext.util || {};
+
+/**
+\brief Left pad a number with something
+\details Takes a number and pads it to the left with the passed in pad character
+\param x	The number to pad
+\param pad	The string to pad with
+\param r	[optional] Upper limit for pad.  A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
+		Default is 10.
+
+\return The number left padded with the pad character.  This function returns a string and not a number.
+*/
+Date.ext.util.xPad=function(x, pad, r)
+{
+	if(typeof(r) == 'undefined')
+	{
+		r=10;
+	}
+	for( ; parseInt(x, 10)<r && r>1; r/=10)
+		x = pad.toString() + x;
+	return x.toString();
+};
+
+/**
+\brief Currently selected locale.
+\details
+The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
+The default will be based on the lang attribute of the HTML tag of your document
+*/
+Date.prototype.locale = 'en-GB';
+//! \cond FALSE
+if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
+{
+	Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
+}
+//! \endcond
+
+/**
+\brief Localised strings for days of the week and months of the year.
+\details
+To create your own local strings, add a locale object to the locales object.
+The key of your object should be the same as your locale name.  For example:
+   en-US,
+   fr,
+   fr-CH,
+   de-DE
+Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+Your locale object must contain the following keys:
+\param a	Short names of days of week starting with Sunday
+\param A	Long names days of week starting with Sunday
+\param b	Short names of months of the year starting with January
+\param B	Long names of months of the year starting with February
+\param c	The preferred date and time representation in your locale
+\param p	AM or PM in your locale
+\param P	am or pm in your locale
+\param x	The  preferred date representation for the current locale without the time.
+\param X	The preferred time representation for the current locale without the date.
+
+\sa Date.ext.locales.en for a sample implementation
+\sa \ref localisation for detailed documentation on localising strftime for your own locale
+*/
+Date.ext.locales = Date.ext.locales || { };
+
+/**
+ * \brief Localised strings for English (British).
+ * \details
+ * This will be used for any of the English dialects unless overridden by a country specific one.
+ * This is the default locale if none specified
+ */
+Date.ext.locales.en = Date.ext.locales.en || {
+	a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+	A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+	b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+	B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+	c: '%a %d %b %Y %T %Z',
+	p: ['AM', 'PM'],
+	P: ['am', 'pm'],
+	x: '%d/%m/%y',
+	X: '%T'
+};
+
+//! \cond FALSE
+// Localised strings for US English
+Date.ext.locales['en-US'] = Date.ext.locales.en;
+Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
+Date.ext.locales['en-US'].x = '%D';
+Date.ext.locales['en-US'].X = '%r';
+
+// Localised strings for British English
+Date.ext.locales['en-GB'] = Date.ext.locales.en;
+
+// Localised strings for Australian English
+Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
+//! \endcond
+
+Date.ext.locales.de = Date.ext.locales.de || {
+        a: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
+        A: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
+        b: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
+        B: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
+        c: '%a %d %b %Y %T %Z',
+        p: ['', ''],
+        P: ['', ''],
+        x: '%d.%m.%Y',
+        X: '%T'
+    };
+Date.ext.locales['de-AT'] = Date.ext.locales['de-AT'] || Date.ext.locales.de;
+Date.ext.locales['de-CH'] = Date.ext.locales['de-CH'] || Date.ext.locales.de;
+Date.ext.locales['de-DE'] = Date.ext.locales['de-DE'] || Date.ext.locales.de;
+//! \brief List of supported format specifiers.
+/**
+ * \details
+ * \arg \%a - abbreviated weekday name according to the current locale
+ * \arg \%A - full weekday name according to the current locale
+ * \arg \%b - abbreviated month name according to the current locale
+ * \arg \%B - full month name according to the current locale
+ * \arg \%c - preferred date and time representation for the current locale
+ * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+ * \arg \%d - day of the month as a decimal number (range 01 to 31)
+ * \arg \%D - same as %m/%d/%y
+ * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
+ * \arg \%F - same as %Y-%m-%d
+ * \arg \%g - like %G, but without the century
+ * \arg \%G - The 4-digit year corresponding to the ISO week number
+ * \arg \%h - same as %b
+ * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+ * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+ * \arg \%j - day of the year as a decimal number (range 001 to 366)
+ * \arg \%m - month as a decimal number (range 01 to 12)
+ * \arg \%M - minute as a decimal number
+ * \arg \%n - newline character
+ * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
+ * \arg \%P - like %p, but lower case
+ * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
+ * \arg \%R - time in 24 hour notation equal to %H:%M
+ * \arg \%S - second as a decimal number
+ * \arg \%t - tab character
+ * \arg \%T - current time, equal to %H:%M:%S
+ * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
+ * \arg \%U - week number of the current year as a decimal number, starting with
+ *            the first Sunday as the first day of the first week
+ * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
+ *            range 01 to 53, where week 1 is the first week that has at least 4 days
+ *            in the current year, and with Monday as the first day of the week.
+ * \arg \%w - day of the week as a decimal, Sunday being 0
+ * \arg \%W - week number of the current year as a decimal number, starting with the
+ *            first Monday as the first day of the first week
+ * \arg \%x - preferred date representation for the current locale without the time
+ * \arg \%X - preferred time representation for the current locale without the date
+ * \arg \%y - year as a decimal number without a century (range 00 to 99)
+ * \arg \%Y - year as a decimal number including the century
+ * \arg \%z - numerical time zone representation
+ * \arg \%Z - time zone name or abbreviation
+ * \arg \%% - a literal `\%' character
+ */
+Date.ext.formats = {
+	a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
+	A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
+	b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
+	B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
+	c: 'toLocaleString',
+	C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
+	d: ['getDate', '0'],
+	e: ['getDate', ' '],
+	g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
+	G: function(d) {
+			var y = d.getFullYear();
+			var V = parseInt(Date.ext.formats.V(d), 10);
+			var W = parseInt(Date.ext.formats.W(d), 10);
+
+			if(W > V) {
+				y++;
+			} else if(W===0 && V>=52) {
+				y--;
+			}
+
+			return y;
+		},
+	H: ['getHours', '0'],
+	I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
+	j: function(d) {
+			var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
+			ms += d.getTimezoneOffset()*60000;
+			var doy = parseInt(ms/60000/60/24, 10)+1;
+			return Date.ext.util.xPad(doy, 0, 100);
+		},
+	m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
+	M: ['getMinutes', '0'],
+	p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
+	P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
+	S: ['getSeconds', '0'],
+	u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
+	U: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 6-d.getDay();
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0);
+		},
+	V: function(d) {
+			var woy = parseInt(Date.ext.formats.W(d), 10);
+			var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
+			// First week is 01 and not 00 as in the case of %U and %W,
+			// so we add 1 to the final result except if day 1 of the year
+			// is a Monday (then %W returns 01).
+			// We also need to subtract 1 if the day 1 of the year is 
+			// Friday-Sunday, so the resulting equation becomes:
+			var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
+			if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
+			{
+				idow = 1;
+			}
+			else if(idow === 0)
+			{
+				idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
+			}
+
+			return Date.ext.util.xPad(idow, 0);
+		},
+	w: 'getDay',
+	W: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 7-Date.ext.formats.u(d);
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0, 10);
+		},
+	y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
+	Y: 'getFullYear',
+	z: function(d) {
+			var o = d.getTimezoneOffset();
+			var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
+			var M = Date.ext.util.xPad(o%60, 0);
+			return (o>0?'-':'+') + H + M;
+		},
+	Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
+	'%': function(d) { return '%'; }
+};
+
+/**
+\brief List of aggregate format specifiers.
+\details
+Aggregate format specifiers map to a combination of basic format specifiers.
+These are implemented in terms of Date.ext.formats.
+
+A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
+
+\sa Date.ext.formats
+*/
+Date.ext.aggregates = {
+	c: 'locale',
+	D: '%m/%d/%y',
+	F: '%Y-%m-%d',
+	h: '%b',
+	n: '\n',
+	r: '%I:%M:%S %p',
+	R: '%H:%M',
+	t: '\t',
+	T: '%H:%M:%S',
+	x: 'locale',
+	X: 'locale'
+};
+
+//! \cond FALSE
+// Cache timezone values because they will never change for a given JS instance
+Date.ext.aggregates.z = Date.ext.formats.z(new Date());
+Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
+//! \endcond
+
+//! List of unsupported format specifiers.
+/**
+ * \details
+ * All format specifiers supported by the PHP implementation are supported by
+ * this javascript implementation.
+ */
+Date.ext.unsupported = { };
+
+
+/**
+ * \brief Formats the date according to the specified format.
+ * \param fmt	The format to format the date in.  This may be a combination of the following:
+ * \copydoc formats
+ *
+ * \return	A string representation of the date formatted based on the passed in parameter
+ * \sa http://www.php.net/strftime for documentation on format specifiers
+*/
+Date.prototype.strftime=function(fmt)
+{
+	// Fix locale if declared locale hasn't been defined
+	// After the first call this condition should never be entered unless someone changes the locale
+	if(!(this.locale in Date.ext.locales))
+	{
+		if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
+		{
+			this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
+		}
+		else
+		{
+			this.locale = 'en-GB';
+		}
+	}
+
+	var d = this;
+	// First replace aggregates
+	while(fmt.match(/%[cDFhnrRtTxXzZ]/))
+	{
+		fmt = fmt.replace(/%([cDFhnrRtTxXzZ])/g, function(m0, m1)
+				{
+					var f = Date.ext.aggregates[m1];
+					return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
+				});
+	}
+
+
+	// Now replace formats - we need a closure so that the date object gets passed through
+	var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1) 
+			{
+				var f = Date.ext.formats[m1];
+				if(typeof(f) == 'string') {
+					return d[f]();
+				} else if(typeof(f) == 'function') {
+					return f.call(d, d);
+				} else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
+					return Date.ext.util.xPad(d[f[0]](), f[1]);
+				} else {
+					return m1;
+				}
+			});
+	d=null;
+	return str;
+};
+
+/**
+ * \mainpage strftime for Javascript
+ *
+ * \section toc Table of Contents
+ * - \ref intro_sec
+ * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
+ * - \subpage usage
+ * - \subpage format_specifiers
+ * - \subpage localisation
+ * - \link strftime.js API Documentation \endlink
+ * - \subpage demo
+ * - \subpage changelog
+ * - \subpage faq
+ * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
+ * - \subpage copyright_licence
+ *
+ * \section intro_sec Introduction
+ *
+ * C and PHP developers have had access to a built in strftime function for a long time.
+ * This function is an easy way to format dates and times for various display needs.
+ *
+ * This library brings the flexibility of strftime to the javascript Date object
+ *
+ * Use this library if you frequently need to format dates in javascript in a variety of ways.  For example,
+ * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
+ * progressively enhanced javascript, then this library can do exactly what you want.
+ *
+ *
+ *
+ *
+ * \page usage Example usage
+ *
+ * \section usage_sec Usage
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \subsection examples Examples
+ * 
+ * To get the current time in hours and minutes:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%H:%M");
+ * \endcode
+ *
+ * To get the current time with seconds in AM/PM notation:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%r");
+ * \endcode
+ *
+ * To get the year and day of the year for August 23, 2009:
+ * \code
+ * 	var d = new Date('2009/8/23');
+ * 	d.strftime("%Y-%j");
+ * \endcode
+ *
+ * \section demo_sec Demo
+ *
+ * Try your own examples on the \subpage demo page.  You can use any of the supported
+ * \subpage format_specifiers.
+ *
+ *
+ *
+ *
+ * \page localisation Localisation
+ * You can localise strftime by implementing the short and long forms for days of the
+ * week and months of the year, and the localised aggregates for the preferred date
+ * and time representation for your locale.  You need to add your locale to the
+ * Date.ext.locales object.
+ *
+ * \section localising_fr Localising for french
+ *
+ * For example, this is how we'd add French language strings to the locales object:
+ * \dontinclude index.html
+ * \skip Generic french
+ * \until };
+ * The % format specifiers are all defined in \ref formats.  You can use any of those.
+ *
+ * This locale definition may be included in your own source file, or in the HTML file
+ * including \c strftime.js, however it must be defined \em after including \c strftime.js
+ *
+ * The above definition includes generic french strings and formats that are used in France.
+ * Other french speaking countries may have other representations for dates and times, so we
+ * need to override this for them.  For example, Canadian french uses a Y-m-d date format,
+ * while French french uses d.m.Y.  We fix this by defining Canadian french to be the same
+ * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
+ * \until End french
+ *
+ * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
+ * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
+ * \code
+ *     var d = new Date("2008/04/22");
+ *     d.locale = "fr";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 22.04.2008
+ * \endcode
+ * While changing the locale to "fr-CA":
+ * \code
+ *     d.locale = "fr-CA";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 2008-04-22
+ * \endcode
+ *
+ * You can use any of the format specifiers defined at \ref formats
+ *
+ * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
+ * it is set, or to \c "en" otherwise.
+ * \note
+ * Your locale definitions \b MUST be added to the locale object before calling
+ * \link Date.prototype.strftime Date.strftime \endlink.
+ *
+ * \sa \ref formats for a list of format specifiers that can be used in your definitions
+ * for c, x and X.
+ *
+ * \section locale_names Locale names
+ *
+ * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
+ * defined language code and an optional ISO3166 defined country code separated by a -
+ * 
+ * eg: fr-FR, de-DE, hi-IN
+ *
+ * \sa http://www.ietf.org/rfc/rfc1766.txt
+ * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+ * 
+ * \section locale_fallback Locale fallbacks
+ *
+ * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
+ * to fall back to the two letter language code.  If a locale object corresponding to that isn't found
+ * either, then the locale will fall back to \c "en".  No warning will be issued.
+ *
+ * For example, if we define a locale for de:
+ * \until };
+ * Then set the locale to \c "de-DE":
+ * \code
+ *     d.locale = "de-DE";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * Swiss german will return the same since it will also fall back to \c "de":
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * We need to override the \c a specifier for Swiss german, since it's different from German german:
+ * \until End german
+ * We now get the correct results:
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Die, 22 Apr
+ * \endcode
+ *
+ * \section builtin_locales Built in locales
+ *
+ * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
+ *
+ * 
+ *
+ *
+ * \page format_specifiers Format specifiers
+ * 
+ * \section specifiers Format specifiers
+ * strftime has several format specifiers defined by the Open group at 
+ * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
+ *
+ * PHP added a few of its own, defined at http://www.php.net/strftime
+ *
+ * This javascript implementation supports all the PHP specifiers
+ *
+ * \subsection supp Supported format specifiers:
+ * \copydoc formats
+ * 
+ * \subsection unsupportedformats Unsupported format specifiers:
+ * \copydoc unsupported
+ *
+ *
+ *
+ *
+ * \page demo strftime demo
+ * <div style="float:right;width:45%;">
+ * \copydoc formats
+ * </div>
+ * \htmlinclude index.html
+ *
+ *
+ *
+ *
+ * \page faq FAQ
+ * 
+ * \section how_tos Usage
+ *
+ * \subsection howtouse Is there a manual on how to use this library?
+ *
+ * Yes, see \ref usage
+ *
+ * \subsection wheretoget Where can I get a minified version of this library?
+ *
+ * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
+ *
+ * \subsection which_specifiers Which format specifiers are supported?
+ *
+ * See \ref format_specifiers
+ *
+ * \section whys Why?
+ *
+ * \subsection why_lib Why this library?
+ *
+ * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
+ * to do date formatting.  When I needed to do date formatting in javascript, I decided
+ * that it made the most sense to just reuse what I'm already familiar with.
+ *
+ * \subsection why_another Why another strftime implementation for Javascript?
+ *
+ * Yes, there are other strftime implementations for Javascript, but I saw problems with
+ * all of them that meant I couldn't use them directly.  Some implementations had bad
+ * designs.  For example, iterating through all possible specifiers and scanning the string
+ * for them.  Others were tied to specific libraries like prototype.
+ *
+ * Trying to extend any of the existing implementations would have required only slightly
+ * less effort than writing this from scratch.  In the end it took me just about 3 hours
+ * to write the code and about 6 hours battling with doxygen to write these docs.
+ *
+ * I also had an idea of how I wanted to implement this, so decided to try it.
+ *
+ * \subsection why_extend_date Why extend the Date class rather than subclass it?
+ *
+ * I tried subclassing Date and failed.  I didn't want to waste time on figuring
+ * out if there was a problem in my code or if it just wasn't possible.  Adding to the
+ * Date.prototype worked well, so I stuck with it.
+ *
+ * I did have some worries because of the way for..in loops got messed up after json.js added
+ * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
+ *
+ * My last doubt was about the Date.ext namespace that I created.  I still don't like this,
+ * but I felt that \c ext at least makes clear that this is external or an extension.
+ *
+ * It's quite possible that some future version of javascript will add an \c ext or a \c locale
+ * or a \c strftime property/method to the Date class, but this library should probably
+ * check for capabilities before doing what it does.
+ *
+ * \section curiosity Curiosity
+ *
+ * \subsection how_big How big is the code?
+ *
+ * \arg 26K bytes with documentation
+ * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
+ * \arg 1477 bytes minified and gzipped
+ *
+ * \subsection how_long How long did it take to write this?
+ *
+ * 15 minutes for the idea while I was composing this blog post:
+ * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
+ *
+ * 3 hours in one evening to write v1.0 of the code and 6 hours the same
+ * night to write the docs and this manual.  As you can tell, I'm fairly
+ * sleepy.
+ *
+ * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
+ * in under one hour.
+ *
+ * \section contributing Contributing
+ *
+ * \subsection how_to_rfe How can I request features or make suggestions?
+ *
+ * You can leave a comment on my blog post about this library here:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ *
+ * \subsection how_to_contribute Can I/How can I contribute code to this library?
+ *
+ * Yes, that would be very nice, thank you.  You can do various things.  You can make changes
+ * to the library, and make a diff against the current file and mail me that diff at
+ * philip@bluesmoon.info, or you could just host the new file on your own servers and add
+ * your name to the copyright list at the top stating which parts you've added.
+ *
+ * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
+ *
+ * \subsection copyright_signover Who owns the copyright on contributed code?
+ *
+ * The contributor retains copyright on contributed code.
+ *
+ * In some cases I may use contributed code as a template and write the code myself.  In this
+ * case I'll give the contributor credit for the idea, but will not add their name to the
+ * copyright holders list.
+ *
+ *
+ *
+ *
+ * \page copyright_licence Copyright & Licence
+ *
+ * \section copyright Copyright
+ * \dontinclude strftime.js
+ * \skip Copyright
+ * \until rights
+ *
+ * \section licence Licence
+ * \skip This code
+ * \until SUCH DAMAGE.
+ *
+ *
+ *
+ * \page changelog ChangeLog
+ *
+ * \par 1.3 - 2008/06/17:
+ * - Fixed padding issue with negative timezone offsets in %r
+ *   reported and fixed by Mikko <mi...@iki.fi>
+ * - Added support for %P
+ * - Internationalised %r, %p and %P
+ *
+ * \par 1.2 - 2008/04/27:
+ * - Fixed support for c (previously it just returned toLocaleString())
+ * - Add support for c, x and X
+ * - Add locales for en-GB, en-US and en-AU
+ * - Make en-GB the default locale (previous was en)
+ * - Added more localisation docs
+ *
+ * \par 1.1 - 2008/04/27:
+ * - Fix bug in xPad which wasn't padding more than a single digit
+ * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
+ * - Add support for g, G, U, V and W
+ *
+ * \par 1.0 - 2008/04/22:
+ * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
+ */

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index f6ef3f8..b780d80 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -372,6 +372,9 @@
                         <header>parent/src/etc/header.txt</header>
                         <strictCheck>true</strictCheck>
                         <excludes>
+                            <!-- everything in extras is contributed 3rd party -->
+                            <exclude>**/extras/**</exclude>
+
                             <exclude>**/src/ext/**</exclude>
                             <exclude>COPYING.txt</exclude>
                             <exclude>NOTICE.txt</exclude>
@@ -415,6 +418,9 @@
                     <configuration>
                         <excludeSubProjects>false</excludeSubProjects>
                         <excludes>
+                            <!-- everything in extras is contributed 3rd party -->
+                            <exclude>**/extras/**</exclude>
+
                             <!-- auto-generated files -->
                             <exclude>**/*.txt</exclude>
                             <exclude>**/atlassian-ide-plugin.xml</exclude>
@@ -925,6 +931,11 @@
                 <version>0.5.1</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.marmotta.webjars</groupId>
+                <artifactId>strftime</artifactId>
+                <version>1.3</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.marmotta</groupId>
                 <artifactId>marmotta-client-js</artifactId>
                 <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/platform/marmotta-core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/pom.xml b/platform/marmotta-core/pom.xml
index aceb0fa..654c052 100644
--- a/platform/marmotta-core/pom.xml
+++ b/platform/marmotta-core/pom.xml
@@ -315,6 +315,10 @@
             <artifactId>sgvizler</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>strftime</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.marmotta</groupId>
             <artifactId>marmotta-client-js</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/platform/marmotta-core/src/main/resources/web/admin/system.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/system.html b/platform/marmotta-core/src/main/resources/web/admin/system.html
index 7d982cb..9b54c6b 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/system.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/system.html
@@ -25,10 +25,10 @@
 </script>
 <!--###BEGIN_HEAD###-->
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
-<script type="text/javascript" src="../public/js/lib/strftime.js"></script>
-<script type="text/javascript" src="js/widgets/system.js"></script>
+    <script type="text/javascript" src="../../webjars/strftime/1.3/strftime.js"></script>
+    <script type="text/javascript" src="js/widgets/system.js"></script>
 
-<link rel="stylesheet" href="css/admin-style.css"/>
+    <link rel="stylesheet" href="css/admin-style.css"/>
 <!--###END_HEAD###-->
 </head>
 <body id="center">

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/platform/marmotta-core/src/main/resources/web/admin/tasks.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/tasks.html b/platform/marmotta-core/src/main/resources/web/admin/tasks.html
index 39a4e9e..5efb26b 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/tasks.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/tasks.html
@@ -22,7 +22,7 @@
     <!--###BEGIN_HEAD###-->
     <title>Marmotta - Current Tasks</title>
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
-    <script type="text/javascript" src="../public/js/lib/strftime.js"></script>
+    <script type="text/javascript" src="../../webjars/strftime/1.3/strftime.js"></script>
     <script type="text/javascript">
     $(function() {
 		var container = $("#tasks"),

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/00f64a01/platform/marmotta-core/src/main/resources/web/public/js/lib/strftime.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/js/lib/strftime.js b/platform/marmotta-core/src/main/resources/web/public/js/lib/strftime.js
deleted file mode 100644
index 4e84444..0000000
--- a/platform/marmotta-core/src/main/resources/web/public/js/lib/strftime.js
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
- strftime for Javascript
- Copyright (c) 2008, Philip S Tellis <ph...@bluesmoon.info>
- All rights reserved.
- 
- extended with german locales and %F formatter for Marmotta
- Jakob Frank <ja...@apache.org>
- 
- This code is distributed under the terms of the BSD licence
- 
- Redistribution and use of this software 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.
-   * The names of the contributors to this file may not 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.
- */
-
-/**
- * \file strftime.js
- * \author Philip S Tellis \<philip@bluesmoon.info\>
- * \version 1.3
- * \date 2008/06
- * \brief Javascript implementation of strftime
- * 
- * Implements strftime for the Date object in javascript based on the PHP implementation described at
- * http://www.php.net/strftime  This is in turn based on the Open Group specification defined
- * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
- * include modified conversion specifiers (i.e., Ex and Ox)
- *
- * The following format specifiers are supported:
- *
- * \copydoc formats
- *
- * \%a, \%A, \%b and \%B should be localised for non-English locales.
- *
- * \par Usage:
- * This library may be used as follows:
- * \code
- *     var d = new Date();
- *
- *     var ymd = d.strftime('%Y/%m/%d');
- *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
- *
- * \endcode
- *
- * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
- * \sa Date.ext.locales for localisation information
- * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
- * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
- */
-
-//! Date extension object - all supporting objects go in here.
-Date.ext = Date.ext || {};
-
-//! Utility methods
-Date.ext.util = Date.ext.util || {};
-
-/**
-\brief Left pad a number with something
-\details Takes a number and pads it to the left with the passed in pad character
-\param x	The number to pad
-\param pad	The string to pad with
-\param r	[optional] Upper limit for pad.  A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
-		Default is 10.
-
-\return The number left padded with the pad character.  This function returns a string and not a number.
-*/
-Date.ext.util.xPad=function(x, pad, r)
-{
-	if(typeof(r) == 'undefined')
-	{
-		r=10;
-	}
-	for( ; parseInt(x, 10)<r && r>1; r/=10)
-		x = pad.toString() + x;
-	return x.toString();
-};
-
-/**
-\brief Currently selected locale.
-\details
-The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
-The default will be based on the lang attribute of the HTML tag of your document
-*/
-Date.prototype.locale = 'en-GB';
-//! \cond FALSE
-if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
-{
-	Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
-}
-//! \endcond
-
-/**
-\brief Localised strings for days of the week and months of the year.
-\details
-To create your own local strings, add a locale object to the locales object.
-The key of your object should be the same as your locale name.  For example:
-   en-US,
-   fr,
-   fr-CH,
-   de-DE
-Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
-Your locale object must contain the following keys:
-\param a	Short names of days of week starting with Sunday
-\param A	Long names days of week starting with Sunday
-\param b	Short names of months of the year starting with January
-\param B	Long names of months of the year starting with February
-\param c	The preferred date and time representation in your locale
-\param p	AM or PM in your locale
-\param P	am or pm in your locale
-\param x	The  preferred date representation for the current locale without the time.
-\param X	The preferred time representation for the current locale without the date.
-
-\sa Date.ext.locales.en for a sample implementation
-\sa \ref localisation for detailed documentation on localising strftime for your own locale
-*/
-Date.ext.locales = Date.ext.locales || { };
-
-/**
- * \brief Localised strings for English (British).
- * \details
- * This will be used for any of the English dialects unless overridden by a country specific one.
- * This is the default locale if none specified
- */
-Date.ext.locales.en = Date.ext.locales.en || {
-	a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
-	A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
-	b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
-	B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
-	c: '%a %d %b %Y %T %Z',
-	p: ['AM', 'PM'],
-	P: ['am', 'pm'],
-	x: '%d/%m/%y',
-	X: '%T'
-};
-
-//! \cond FALSE
-// Localised strings for US English
-Date.ext.locales['en-US'] = Date.ext.locales.en;
-Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
-Date.ext.locales['en-US'].x = '%D';
-Date.ext.locales['en-US'].X = '%r';
-
-// Localised strings for British English
-Date.ext.locales['en-GB'] = Date.ext.locales.en;
-
-// Localised strings for Australian English
-Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
-//! \endcond
-
-Date.ext.locales.de = Date.ext.locales.de || {
-        a: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
-        A: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
-        b: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
-        B: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
-        c: '%a %d %b %Y %T %Z',
-        p: ['', ''],
-        P: ['', ''],
-        x: '%d.%m.%Y',
-        X: '%T'
-    };
-Date.ext.locales['de-AT'] = Date.ext.locales['de-AT'] || Date.ext.locales.de;
-Date.ext.locales['de-CH'] = Date.ext.locales['de-CH'] || Date.ext.locales.de;
-Date.ext.locales['de-DE'] = Date.ext.locales['de-DE'] || Date.ext.locales.de;
-//! \brief List of supported format specifiers.
-/**
- * \details
- * \arg \%a - abbreviated weekday name according to the current locale
- * \arg \%A - full weekday name according to the current locale
- * \arg \%b - abbreviated month name according to the current locale
- * \arg \%B - full month name according to the current locale
- * \arg \%c - preferred date and time representation for the current locale
- * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
- * \arg \%d - day of the month as a decimal number (range 01 to 31)
- * \arg \%D - same as %m/%d/%y
- * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
- * \arg \%F - same as %Y-%m-%d
- * \arg \%g - like %G, but without the century
- * \arg \%G - The 4-digit year corresponding to the ISO week number
- * \arg \%h - same as %b
- * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
- * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
- * \arg \%j - day of the year as a decimal number (range 001 to 366)
- * \arg \%m - month as a decimal number (range 01 to 12)
- * \arg \%M - minute as a decimal number
- * \arg \%n - newline character
- * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
- * \arg \%P - like %p, but lower case
- * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
- * \arg \%R - time in 24 hour notation equal to %H:%M
- * \arg \%S - second as a decimal number
- * \arg \%t - tab character
- * \arg \%T - current time, equal to %H:%M:%S
- * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
- * \arg \%U - week number of the current year as a decimal number, starting with
- *            the first Sunday as the first day of the first week
- * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
- *            range 01 to 53, where week 1 is the first week that has at least 4 days
- *            in the current year, and with Monday as the first day of the week.
- * \arg \%w - day of the week as a decimal, Sunday being 0
- * \arg \%W - week number of the current year as a decimal number, starting with the
- *            first Monday as the first day of the first week
- * \arg \%x - preferred date representation for the current locale without the time
- * \arg \%X - preferred time representation for the current locale without the date
- * \arg \%y - year as a decimal number without a century (range 00 to 99)
- * \arg \%Y - year as a decimal number including the century
- * \arg \%z - numerical time zone representation
- * \arg \%Z - time zone name or abbreviation
- * \arg \%% - a literal `\%' character
- */
-Date.ext.formats = {
-	a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
-	A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
-	b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
-	B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
-	c: 'toLocaleString',
-	C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
-	d: ['getDate', '0'],
-	e: ['getDate', ' '],
-	g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
-	G: function(d) {
-			var y = d.getFullYear();
-			var V = parseInt(Date.ext.formats.V(d), 10);
-			var W = parseInt(Date.ext.formats.W(d), 10);
-
-			if(W > V) {
-				y++;
-			} else if(W===0 && V>=52) {
-				y--;
-			}
-
-			return y;
-		},
-	H: ['getHours', '0'],
-	I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
-	j: function(d) {
-			var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
-			ms += d.getTimezoneOffset()*60000;
-			var doy = parseInt(ms/60000/60/24, 10)+1;
-			return Date.ext.util.xPad(doy, 0, 100);
-		},
-	m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
-	M: ['getMinutes', '0'],
-	p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
-	P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
-	S: ['getSeconds', '0'],
-	u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
-	U: function(d) {
-			var doy = parseInt(Date.ext.formats.j(d), 10);
-			var rdow = 6-d.getDay();
-			var woy = parseInt((doy+rdow)/7, 10);
-			return Date.ext.util.xPad(woy, 0);
-		},
-	V: function(d) {
-			var woy = parseInt(Date.ext.formats.W(d), 10);
-			var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
-			// First week is 01 and not 00 as in the case of %U and %W,
-			// so we add 1 to the final result except if day 1 of the year
-			// is a Monday (then %W returns 01).
-			// We also need to subtract 1 if the day 1 of the year is 
-			// Friday-Sunday, so the resulting equation becomes:
-			var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
-			if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
-			{
-				idow = 1;
-			}
-			else if(idow === 0)
-			{
-				idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
-			}
-
-			return Date.ext.util.xPad(idow, 0);
-		},
-	w: 'getDay',
-	W: function(d) {
-			var doy = parseInt(Date.ext.formats.j(d), 10);
-			var rdow = 7-Date.ext.formats.u(d);
-			var woy = parseInt((doy+rdow)/7, 10);
-			return Date.ext.util.xPad(woy, 0, 10);
-		},
-	y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
-	Y: 'getFullYear',
-	z: function(d) {
-			var o = d.getTimezoneOffset();
-			var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
-			var M = Date.ext.util.xPad(o%60, 0);
-			return (o>0?'-':'+') + H + M;
-		},
-	Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
-	'%': function(d) { return '%'; }
-};
-
-/**
-\brief List of aggregate format specifiers.
-\details
-Aggregate format specifiers map to a combination of basic format specifiers.
-These are implemented in terms of Date.ext.formats.
-
-A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
-
-\sa Date.ext.formats
-*/
-Date.ext.aggregates = {
-	c: 'locale',
-	D: '%m/%d/%y',
-	F: '%Y-%m-%d',
-	h: '%b',
-	n: '\n',
-	r: '%I:%M:%S %p',
-	R: '%H:%M',
-	t: '\t',
-	T: '%H:%M:%S',
-	x: 'locale',
-	X: 'locale'
-};
-
-//! \cond FALSE
-// Cache timezone values because they will never change for a given JS instance
-Date.ext.aggregates.z = Date.ext.formats.z(new Date());
-Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
-//! \endcond
-
-//! List of unsupported format specifiers.
-/**
- * \details
- * All format specifiers supported by the PHP implementation are supported by
- * this javascript implementation.
- */
-Date.ext.unsupported = { };
-
-
-/**
- * \brief Formats the date according to the specified format.
- * \param fmt	The format to format the date in.  This may be a combination of the following:
- * \copydoc formats
- *
- * \return	A string representation of the date formatted based on the passed in parameter
- * \sa http://www.php.net/strftime for documentation on format specifiers
-*/
-Date.prototype.strftime=function(fmt)
-{
-	// Fix locale if declared locale hasn't been defined
-	// After the first call this condition should never be entered unless someone changes the locale
-	if(!(this.locale in Date.ext.locales))
-	{
-		if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
-		{
-			this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
-		}
-		else
-		{
-			this.locale = 'en-GB';
-		}
-	}
-
-	var d = this;
-	// First replace aggregates
-	while(fmt.match(/%[cDFhnrRtTxXzZ]/))
-	{
-		fmt = fmt.replace(/%([cDFhnrRtTxXzZ])/g, function(m0, m1)
-				{
-					var f = Date.ext.aggregates[m1];
-					return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
-				});
-	}
-
-
-	// Now replace formats - we need a closure so that the date object gets passed through
-	var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1) 
-			{
-				var f = Date.ext.formats[m1];
-				if(typeof(f) == 'string') {
-					return d[f]();
-				} else if(typeof(f) == 'function') {
-					return f.call(d, d);
-				} else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
-					return Date.ext.util.xPad(d[f[0]](), f[1]);
-				} else {
-					return m1;
-				}
-			});
-	d=null;
-	return str;
-};
-
-/**
- * \mainpage strftime for Javascript
- *
- * \section toc Table of Contents
- * - \ref intro_sec
- * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
- * - \subpage usage
- * - \subpage format_specifiers
- * - \subpage localisation
- * - \link strftime.js API Documentation \endlink
- * - \subpage demo
- * - \subpage changelog
- * - \subpage faq
- * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
- * - \subpage copyright_licence
- *
- * \section intro_sec Introduction
- *
- * C and PHP developers have had access to a built in strftime function for a long time.
- * This function is an easy way to format dates and times for various display needs.
- *
- * This library brings the flexibility of strftime to the javascript Date object
- *
- * Use this library if you frequently need to format dates in javascript in a variety of ways.  For example,
- * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
- * progressively enhanced javascript, then this library can do exactly what you want.
- *
- *
- *
- *
- * \page usage Example usage
- *
- * \section usage_sec Usage
- * This library may be used as follows:
- * \code
- *     var d = new Date();
- *
- *     var ymd = d.strftime('%Y/%m/%d');
- *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
- *
- * \endcode
- *
- * \subsection examples Examples
- * 
- * To get the current time in hours and minutes:
- * \code
- * 	var d = new Date();
- * 	d.strftime("%H:%M");
- * \endcode
- *
- * To get the current time with seconds in AM/PM notation:
- * \code
- * 	var d = new Date();
- * 	d.strftime("%r");
- * \endcode
- *
- * To get the year and day of the year for August 23, 2009:
- * \code
- * 	var d = new Date('2009/8/23');
- * 	d.strftime("%Y-%j");
- * \endcode
- *
- * \section demo_sec Demo
- *
- * Try your own examples on the \subpage demo page.  You can use any of the supported
- * \subpage format_specifiers.
- *
- *
- *
- *
- * \page localisation Localisation
- * You can localise strftime by implementing the short and long forms for days of the
- * week and months of the year, and the localised aggregates for the preferred date
- * and time representation for your locale.  You need to add your locale to the
- * Date.ext.locales object.
- *
- * \section localising_fr Localising for french
- *
- * For example, this is how we'd add French language strings to the locales object:
- * \dontinclude index.html
- * \skip Generic french
- * \until };
- * The % format specifiers are all defined in \ref formats.  You can use any of those.
- *
- * This locale definition may be included in your own source file, or in the HTML file
- * including \c strftime.js, however it must be defined \em after including \c strftime.js
- *
- * The above definition includes generic french strings and formats that are used in France.
- * Other french speaking countries may have other representations for dates and times, so we
- * need to override this for them.  For example, Canadian french uses a Y-m-d date format,
- * while French french uses d.m.Y.  We fix this by defining Canadian french to be the same
- * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
- * \until End french
- *
- * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
- * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
- * \code
- *     var d = new Date("2008/04/22");
- *     d.locale = "fr";
- *
- *     d.strftime("%A, %d %B == %x");
- * \endcode
- * will return:
- * \code
- *     mardi, 22 avril == 22.04.2008
- * \endcode
- * While changing the locale to "fr-CA":
- * \code
- *     d.locale = "fr-CA";
- *
- *     d.strftime("%A, %d %B == %x");
- * \endcode
- * will return:
- * \code
- *     mardi, 22 avril == 2008-04-22
- * \endcode
- *
- * You can use any of the format specifiers defined at \ref formats
- *
- * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
- * it is set, or to \c "en" otherwise.
- * \note
- * Your locale definitions \b MUST be added to the locale object before calling
- * \link Date.prototype.strftime Date.strftime \endlink.
- *
- * \sa \ref formats for a list of format specifiers that can be used in your definitions
- * for c, x and X.
- *
- * \section locale_names Locale names
- *
- * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
- * defined language code and an optional ISO3166 defined country code separated by a -
- * 
- * eg: fr-FR, de-DE, hi-IN
- *
- * \sa http://www.ietf.org/rfc/rfc1766.txt
- * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
- * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
- * 
- * \section locale_fallback Locale fallbacks
- *
- * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
- * to fall back to the two letter language code.  If a locale object corresponding to that isn't found
- * either, then the locale will fall back to \c "en".  No warning will be issued.
- *
- * For example, if we define a locale for de:
- * \until };
- * Then set the locale to \c "de-DE":
- * \code
- *     d.locale = "de-DE";
- *
- *     d.strftime("%a, %d %b");
- * \endcode
- * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
- * \code
- *     Di, 22 Apr
- * \endcode
- *
- * Swiss german will return the same since it will also fall back to \c "de":
- * \code
- *     d.locale = "de-CH";
- *
- *     d.strftime("%a, %d %b");
- * \endcode
- * \code
- *     Di, 22 Apr
- * \endcode
- *
- * We need to override the \c a specifier for Swiss german, since it's different from German german:
- * \until End german
- * We now get the correct results:
- * \code
- *     d.locale = "de-CH";
- *
- *     d.strftime("%a, %d %b");
- * \endcode
- * \code
- *     Die, 22 Apr
- * \endcode
- *
- * \section builtin_locales Built in locales
- *
- * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
- *
- * 
- *
- *
- * \page format_specifiers Format specifiers
- * 
- * \section specifiers Format specifiers
- * strftime has several format specifiers defined by the Open group at 
- * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
- *
- * PHP added a few of its own, defined at http://www.php.net/strftime
- *
- * This javascript implementation supports all the PHP specifiers
- *
- * \subsection supp Supported format specifiers:
- * \copydoc formats
- * 
- * \subsection unsupportedformats Unsupported format specifiers:
- * \copydoc unsupported
- *
- *
- *
- *
- * \page demo strftime demo
- * <div style="float:right;width:45%;">
- * \copydoc formats
- * </div>
- * \htmlinclude index.html
- *
- *
- *
- *
- * \page faq FAQ
- * 
- * \section how_tos Usage
- *
- * \subsection howtouse Is there a manual on how to use this library?
- *
- * Yes, see \ref usage
- *
- * \subsection wheretoget Where can I get a minified version of this library?
- *
- * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
- *
- * \subsection which_specifiers Which format specifiers are supported?
- *
- * See \ref format_specifiers
- *
- * \section whys Why?
- *
- * \subsection why_lib Why this library?
- *
- * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
- * to do date formatting.  When I needed to do date formatting in javascript, I decided
- * that it made the most sense to just reuse what I'm already familiar with.
- *
- * \subsection why_another Why another strftime implementation for Javascript?
- *
- * Yes, there are other strftime implementations for Javascript, but I saw problems with
- * all of them that meant I couldn't use them directly.  Some implementations had bad
- * designs.  For example, iterating through all possible specifiers and scanning the string
- * for them.  Others were tied to specific libraries like prototype.
- *
- * Trying to extend any of the existing implementations would have required only slightly
- * less effort than writing this from scratch.  In the end it took me just about 3 hours
- * to write the code and about 6 hours battling with doxygen to write these docs.
- *
- * I also had an idea of how I wanted to implement this, so decided to try it.
- *
- * \subsection why_extend_date Why extend the Date class rather than subclass it?
- *
- * I tried subclassing Date and failed.  I didn't want to waste time on figuring
- * out if there was a problem in my code or if it just wasn't possible.  Adding to the
- * Date.prototype worked well, so I stuck with it.
- *
- * I did have some worries because of the way for..in loops got messed up after json.js added
- * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
- *
- * My last doubt was about the Date.ext namespace that I created.  I still don't like this,
- * but I felt that \c ext at least makes clear that this is external or an extension.
- *
- * It's quite possible that some future version of javascript will add an \c ext or a \c locale
- * or a \c strftime property/method to the Date class, but this library should probably
- * check for capabilities before doing what it does.
- *
- * \section curiosity Curiosity
- *
- * \subsection how_big How big is the code?
- *
- * \arg 26K bytes with documentation
- * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
- * \arg 1477 bytes minified and gzipped
- *
- * \subsection how_long How long did it take to write this?
- *
- * 15 minutes for the idea while I was composing this blog post:
- * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
- *
- * 3 hours in one evening to write v1.0 of the code and 6 hours the same
- * night to write the docs and this manual.  As you can tell, I'm fairly
- * sleepy.
- *
- * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
- * in under one hour.
- *
- * \section contributing Contributing
- *
- * \subsection how_to_rfe How can I request features or make suggestions?
- *
- * You can leave a comment on my blog post about this library here:
- * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
- *
- * \subsection how_to_contribute Can I/How can I contribute code to this library?
- *
- * Yes, that would be very nice, thank you.  You can do various things.  You can make changes
- * to the library, and make a diff against the current file and mail me that diff at
- * philip@bluesmoon.info, or you could just host the new file on your own servers and add
- * your name to the copyright list at the top stating which parts you've added.
- *
- * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
- *
- * \subsection copyright_signover Who owns the copyright on contributed code?
- *
- * The contributor retains copyright on contributed code.
- *
- * In some cases I may use contributed code as a template and write the code myself.  In this
- * case I'll give the contributor credit for the idea, but will not add their name to the
- * copyright holders list.
- *
- *
- *
- *
- * \page copyright_licence Copyright & Licence
- *
- * \section copyright Copyright
- * \dontinclude strftime.js
- * \skip Copyright
- * \until rights
- *
- * \section licence Licence
- * \skip This code
- * \until SUCH DAMAGE.
- *
- *
- *
- * \page changelog ChangeLog
- *
- * \par 1.3 - 2008/06/17:
- * - Fixed padding issue with negative timezone offsets in %r
- *   reported and fixed by Mikko <mi...@iki.fi>
- * - Added support for %P
- * - Internationalised %r, %p and %P
- *
- * \par 1.2 - 2008/04/27:
- * - Fixed support for c (previously it just returned toLocaleString())
- * - Add support for c, x and X
- * - Add locales for en-GB, en-US and en-AU
- * - Make en-GB the default locale (previous was en)
- * - Added more localisation docs
- *
- * \par 1.1 - 2008/04/27:
- * - Fix bug in xPad which wasn't padding more than a single digit
- * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
- * - Add support for g, G, U, V and W
- *
- * \par 1.0 - 2008/04/22:
- * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
- */


[20/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-ui-1.8.21.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-ui-1.8.21.js b/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-ui-1.8.21.js
deleted file mode 100755
index 3fe9ccb..0000000
--- a/platform/marmotta-core/src/main/resources/web/public/js/lib/jquery-ui-1.8.21.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.core.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.21",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number
 "?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelectio
 n:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b)
 {return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0
 ,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.widget.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e
 ].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(
 this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||
 c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.mouse.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(t
 his._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:fun
 ction(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.position.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),
 n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left
 )},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.
 curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;/*! jQuery UI - v1.8.21
  - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.draggable.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return thi
 s.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),rel
 ative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!
 this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle
 ||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){thi
 s.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop")
 ,10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|wind
 ow|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="abs
 olute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h
 =[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.left<h[0]&&(f=h[0]+this.offset.click.left),b.pageY-this.offset.click.top<h[1]&&(g=h[1]+this.offset.click.top),b.pageX-this.offset.click.left>h[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.top<h[1]||j-this.offset.click.top>h[3]?j-this.offset.click.top<h[1]?j+c.grid[1]:j-c.grid[1]:j:j;var k=c.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX;f=h?k-this.offset.click.left<h[0]||k-this.offset.click.left>h[2]?k-this.offset.click.left<h[0]?k+c.grid[0]:k-c.grid[0]:k:k}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version
 <526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),b=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.extend(a.ui.draggable,{version:"1.8.21"}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(
 this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,d.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this,f=function(b){var c=this.offset.click.top,d=this.offset.click.left,e=this.positionAbs.top,f=this.positionAbs.left,g
 =b.height,h=b.width,i=b.top,j=b.left;return a.ui.isOver(e+c,f+d,i,j,g,h)};a.each(d.sortables,function(f){this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=
 this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c){var d=a("body"),e=a(this).data("draggable").options;d.css("cursor")&&(e._cursor=d.css("cursor")),d.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")
 ),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(b,c){var d=a(this).data("draggable");d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"&&(d.overflowOffset=d.scrollParent.offset())},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=!1;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")d.overflowOffset.top+d.scrollParent[0].offsetHeight-b.pageY<e.scrollSensitivity?d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop-e.scrollSpeed);if(!e.axis||e.axis!="y")d.overflowOffset.left+d.scrollParent[0].offsetWidth-b.pageX<e.scrollSensitivity?d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensit
 ivity&&(d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft-e.scrollSpeed)}else{if(!e.axis||e.axis!="x")b.pageY-a(document).scrollTop()<e.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<e.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")b.pageX-a(document).scrollLeft()<e.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<e.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+e.scrollSpeed))}f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c){var d=a(this).data("draggable"),e=d.options;d.snapElements=[],a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.pu
 sh({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,i=c.offset.top,j=i+d.helperProportions.height;for(var k=d.snapElements.length-1;k>=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f<g&&g<m+f&&n-f<i&&i<o+f||l-f<g&&g<m+f&&n-f<j&&j<o+f||l-f<h&&h<m+f&&n-f<i&&i<o+f||l-f<h&&h<m+f&&n-f<j&&j<o+f)){d.snapElements[k].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=!1;continue}if(e.snapMode!="inner"){var p=Math.abs(n-j)<=f,q=Math.abs(o-i)<=f,r=Math.abs(l-h)<=f,s=Math.abs(m-g)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n-d.helperProportions.height,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o,left
 :0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m}).left-d.margins.left)}var t=p||q||r||s;if(e.snapMode!="outer"){var p=Math.abs(n-i)<=f,q=Math.abs(o-j)<=f,r=Math.abs(l-g)<=f,s=Math.abs(m-h)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o-d.helperProportions.height,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m-d.helperProportions.width}).left-d.margins.left)}!d.snapElements[k].snapping&&(p||q||r||s||t)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=p||q||r||s||t}}}),a.ui.plugin.add("draggable","stack",{st
 art:function(b,c){var d=a(this).data("draggable").options,e=a.makeArray(a(d.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(!e.length)return;var f=parseInt(e[0].style.zIndex)||0;a(e).each(function(a){this.style.zIndex=f+a}),this[0].style.zIndex=f+e.length}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.droppable.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0,this.isout=1,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);return this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"),this},_setOption:function(b,c){b=="accept"&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)}),a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=
 a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]==this.element[0])return!1;var e=!1;r
 eturn this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==d.options.scope&&b.accept.call(b.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(b,{offset:b.element.offset()}),b.options.tolerance))return e=!0,!1}),e?!1:this.accept.call(this.element[0],d.currentItem||d.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d)),this.element):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.extend(a.ui.droppable,{version:"1.8.21"}),a.ui.intersect=function(b,c,d){if(!c.offset)return!1;var e=(b.positionAbs||b.position.absolute).left,f=e+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,h=g+b.helperProportions.height,i=c.offset.lef
 t,j=i+c.proportions.width,k=c.offset.top,l=k+c.proportions.height;switch(d){case"fit":return i<=e&&f<=j&&k<=g&&h<=l;case"intersect":return i<e+b.helperProportions.width/2&&f-b.helperProportions.width/2<j&&k<g+b.helperProportions.height/2&&h-b.helperProportions.height/2<l;case"pointer":var m=(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,n=(b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,o=a.ui.isOver(n,m,k,i,c.proportions.height,c.proportions.width);return o;case"touch":return(g>=k&&g<=l||h>=k&&h<=l||g<k&&h>l)&&(e>=i&&e<=j||f>=i&&f<=j||e<i&&f>j);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h<d.length;h++){if(d[h].options.disabled||b&&!d[h].accept.call(d[h].element[0],b.currentItem||b.element))continue;for(var i=0;i<f.lengt
 h;i++)if(f[i]==d[h].element[0]){d[h].proportions.height=0;continue g}d[h].visible=d[h].element.css("display")!="none";if(!d[h].visible)continue;e=="mousedown"&&d[h]._activate.call(d[h],c),d[h].offset=d[h].element.offset(),d[h].proportions={width:d[h].element[0].offsetWidth,height:d[h].element[0].offsetHeight}}},drop:function(b,c){var d=!1;return a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,c))}),d},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.opt
 ions.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var d=a.ui.intersect(b,this,this.options.tolerance),e=!d&&this.isover==1?"isout":d&&this.isover==0?"isover":null;if(!e)return;var f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");g.length&&(f=a.data(g[0],"droppable"),f.greedyChild=e=="isover"?1:0)}f&&e=="isover"&&(f.isover=0,f.isout=1,f._out.call(f,c)),this[e]=1,this[e=="isout"?"isover":"isout"]=0,this[e=="isover"?"_over":"_out"].call(this,c),f&&e=="isout"&&(f.isout=0,f.isover=1,f._over.call(f,c))})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}}})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.resizable.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data(
 "resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne
 ,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e<d.length;e++){var f=a.trim(d[e]),g="ui-resizable-"+f,h=a('<div class="ui-resizable-handle '+g+'"></div>');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseov
 er(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCaptu
 re:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalM
 ousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigg
 er("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.mi
 nHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),e<h.maxWidth&&(h.maxWidth=e),g<h.maxHeight&&(h.maxHeight=g);this._vBoundaries=h},_updateCache:function(a){var b=this.options;this.offset=this.helper.offset(),d(a.left)&&(this.position.left=a.left),d(a.top)&&(this.position.top=a.top),d(a.height)&&(this.size.height=a.height),d(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,b){var c=this.options,e=this.position,f=this.size,g=this.axis;return d(a.height)?a.width=a.height*this.aspectRatio:d(a.width)&&(a.height=a.width/this.aspectRatio),g=="sw"&&(a.left=e.left+(f.width-a.width),a.top=null),g=="nw"&&(a.top=e.top+(f.height-a.height),a.left=e.left+(f.width-a.width)),a},_respectSize:function(a,b){var c=this.helper,e=this._vBoundaries,f=this._aspectRatio||b.shiftKey,g=thi
 s.axis,h=d(a.width)&&e.maxWidth&&e.maxWidth<a.width,i=d(a.height)&&e.maxHeight&&e.maxHeight<a.height,j=d(a.width)&&e.minWidth&&e.minWidth>a.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d<this._proportionallyResizeElements.length;d++){var e=this._proportionallyResizeElements[d];if(!this.borderDif){var f=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borde
 rLeftWidth")],g=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];this.borderDif=a.map(f,function(a,b){var c=parseInt(a,10)||0,d=parseInt(g[b],10)||0;return c+d})}if(!a.browser.msie||!a(c).is(":hidden")&&!a(c).parents(":hidden").length)e.css({height:c.height()-this.borderDif[0]-this.borderDif[2]||0,width:c.width()-this.borderDif[1]-this.borderDif[3]||0});else continue}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSiz
 e.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:thi
 s.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.21"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?[
 "width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),1
 0),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i
 ,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d
 .sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.
 originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.
 width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.selectable.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mou
 seStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unsele
 cting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.right<e||i.top>h||i.bottom<f):d.tolerance=="fit"&&(j=i.left>e&&i.right<g&&i.top>f&&i.bottom<h),j?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,c._trigger("selecting",b,{selecting:i.element}))):(i.selecting&&((b.metaKey||b.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selec
 ting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),c._trigger("unselecting",b,{unselecting:i.element}))),i.selected&&!b.metaKey&&!b.ctrlKey&&!i.startselected&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,c._trigger("unselecting",b,{unselecting:i.element})))}),!1},_mouseStop:function(b){var c=this;this.dragged=!1;var d=this.options;return a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove(),!1}}),a.extend(a.ui.selectable,{version:"1.8.21"})})
 (jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.sortable.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return thi
 s},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset
 (),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIn
 dex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scro
 llParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollL
 eft()+c.scrollSpeed))),d!==!1&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseS
 top:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return 
 this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top
 ,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+j<i&&b+k>f&&b+k<g;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?l:f<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<g&&h<d+this.helperProportions.height/2&&e-this.helperProportions.height/2<i},_intersectsWithPointer:function(b){var c=this.options.axis==="x"||a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),d=this.options.axis==="y"||a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),e=c&&d,f=this._getDragVerticalDirection(),g=this._getDragHorizontalDirection();return e?this.floating?g&&g=="right"||f=="down"?2:1:f&&(f=="down"?2:1):!1},_intersectsWithSides:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.c
 lick.top,b.top+b.height/2,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&d||f=="left"&&!d:e&&(e=="down"&&c||e=="up"&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options
 .items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(b){this.items=[],this.containers=[this];var c=this.items,d=this,e=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],f=this._connectWith();if(f&&this.ready)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=
 a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i<m;i++){var n=a(l[i]);n.data(this.widgetName+"-item",k),c.push({item:n,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;c>=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.con
 tainers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft
 ")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui
 .contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)<f&&(f=Math.abs(j-h),g=this.items[i],this.direction=j-h>0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]
 ),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.cont
 ains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}}
 ,_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("bo
 rderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d
 )}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click
 .top<this.containment[1]||h-this.offset.click.top>this.containment[3]?h-this.offset.click.top<this.containment[1]?h+c.grid[1]:h-c.grid[1]:h:h;var i=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0];f=this.containment?i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2]?i-this.offset.click.left<this.containment[0]?i+c.grid[0]:i-c.grid[0]:i:i}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling)
 ,this.counter=this.counter?++this.counter:1;var e=this,f=this.counter;window.setTimeout(function(){f==e.counter&&e.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var d=[],e=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!c&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0])){c||d.push(function(a){this._trigger("remove",a,this._u
 iHash())});for(var f=this.containers.length-1;f>=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._t
 rigger("beforeStop",b,this._uiHash());for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return!1}c||this._trigger("beforeStop",b,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!c){for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}}),a.extend(a.ui.sortable,{version:"1.8.21"})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05
-* https://github.com/jquery/jquery-ui
-* Includes: jquery.ui.accordion.js
-* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
-(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this)
 .removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("
 tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex
 "),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}r
 eturn f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=

<TRUNCATED>

[25/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/js/lib/d3.v2.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/js/lib/d3.v2.min.js b/platform/marmotta-core/src/main/resources/web/admin/js/lib/d3.v2.min.js
deleted file mode 100644
index 521c420..0000000
--- a/platform/marmotta-core/src/main/resources/web/admin/js/lib/d3.v2.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-(function(){function e(a,b){try{for(var c in b)Object.defineProperty(a.prototype,c,{value:b[c],enumerable:!1})}catch(d){a.prototype=b}}function g(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function h(a){return Array.prototype.slice.call(a)}function k(){}function n(a){return a}function o(){return this}function p(){return!0}function q(a){return typeof a=="function"?a:function(){return a}}function r(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function s(a){return a!=null&&!isNaN(a)}function t(a){return a.length}function v(a){return a==null}function w(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function x(a){var b=1;while(a*b%1)b*=10;return b}function A(){}function B(a){function d(){var c=b,d=-1,e=c.length,f;while(++d<e)(f=c[d].on)&&f.apply(this,arguments);return a}var b=[],c=new k;return d.on=function(d,e){var f=c.get(d),g;return arguments.length<2?f&&f.on:(f&&(f.on=null,b=b.slice(0,g=b.indexOf(f)).concat(b.slice(
 g+1)),c.remove(d)),e&&b.push(c.set(d,{on:e})),a)},d}function E(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function F(a){return a+""}function G(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function I(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function O(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function P(a){return function(b){return 1-a(1-b)}}function Q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function R(a){return a}function S(a){return function(b){return Math.pow(b,a)}}function T(a){return 1-Math.cos(a*Math.PI/2)}function U(a){return Math.pow(2,10*(a-1))}function V(a){return 1-Math.sqrt(1-a*a)}function W(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function X(a){re
 turn a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function Y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function Z(){d3.event.stopPropagation(),d3.event.preventDefault()}function $(){var a=d3.event,b;while(b=a.sourceEvent)a=b;return a}function _(a){var b=new A,c=0,d=arguments.length;while(++c<d)b[arguments[c]]=B(b);return b.of=function(c,d){return function(e){try{var f=e.sourceEvent=d3.event;e.target=a,d3.event=e,b[e.type].apply(c,d)}finally{d3.event=f}}},b}function bb(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function bc(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function bd(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function be(a,b,c){return new bf(a,b,c)}function bf(a,b,c){this.r=a,this.g=b,this.b=c}function bg(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function bh(a,
 b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(bj(h[0]),bj(h[1]),bj(h[2]))}}return(i=bk.get(a))?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function bi(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,bl(g,h,i)}function bj(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function bl(a,b,c){return new bm(a,b,c)}function bm(a,b,c){this.h=a,this.s=b,this.l=c}function bn(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}fu
 nction g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,be(g(a+120),g(a),g(a-120))}function bo(a){return j(a,bu),a}function bv(a){return function(){return bp(a,this)}}function bw(a){return function(){return bq(a,this)}}function by(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=w(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=w(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bz(a){return{__data_
 _:a}}function bA(a){return function(){return bt(this,a)}}function bB(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bD(a){return j(a,bE),a}function bF(a,b,c){j(a,bJ);var d=new k,e=d3.dispatch("start","end"),f=bR;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d.get(b):(c==null?d.remove(b):d.set(b,c),a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bS.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){return o.active>b?r():(o.active=b,d.forEach(function(a,b){(b=b.call(l,h,i))&&k.push(b)}),e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1)}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bL=b,e.end.call(l,h,i),bL=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].d
 elay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bH(a,b,c){return c!=""&&bG}function bI(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bG:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=bb(a);return typeof b=="function"?d:b==null?bH:(b+="",e)}function bS(a){var b=bL,c=bR,d=bP,e=bQ;bL=this.id,bR=this.ease();for(var f=0,g=this.length;f<g;f++)for(var h=this[f],i=0,j=h.length;i<j;i++){var k=h[i];k&&(bP=this[f][i].delay,bQ=this[f][i].duration,a.call(k=k.node,k.__data__,i,f))}return bL=b,bR=c,bP=d,bQ=e,this}function bW(){var a,b=Date.now(),c=bT;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bX()-b;d>24?(isFinite(d)&&(clearTimeout(bV),bV=setTimeout(bW,d)),bU=0):(bU=1,bY(bW))}function bX(){var a=null,b=bT,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bT=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bZ(a){var b=[a.a,a.b],c=[a.c,a
 .d],d=b_(b),e=b$(b,c),f=b_(ca(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*cb,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*cb:0}function b$(a,b){return a[0]*b[0]+a[1]*b[1]}function b_(a){var b=Math.sqrt(b$(a,a));return b&&(a[0]/=b,a[1]/=b),b}function ca(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function cd(a,b){var c=a.ownerSVGElement||a;if(c.createSVGPoint){var d=c.createSVGPoint();if(cc<0&&(window.scrollX||window.scrollY)){c=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var e=c[0][0].getScreenCTM();cc=!e.f&&!e.e,c.remove()}return cc?(d.x=b.pageX,d.y=b.pageY):(d.x=b.clientX,d.y=b.clientY),d=d.matrixTransform(a.getScreenCTM().inverse()),[d.x,d.y]}var f=a.getBoundingClientRect();return[b.clientX-f.left-a.clientLeft,b.clientY-f.top-a.clientTop]}function ce(){}function cf(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}funct
 ion cg(a){return a.rangeExtent?a.rangeExtent():cf(a.range())}function ch(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function ci(){return Math}function cj(a,b,c,d){function g(){var g=Math.min(a.length,b.length)>2?cq:cp,i=d?bd:bc;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return cn(a,b)},h.tickFormat=function(b){return co(a,b)},h.nice=function(){return ch(a,cl),g()},h.copy=function(){return cj(a,b,c,d)},g()}function ck(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clam
 p")}function cl(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function cm(a,b){var c=cf(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function cn(a,b){return d3.range.apply(d3,cm(a,b))}function co(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(cm(a,b)[2])/Math.LN10+.01))+"f")}function cp(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function cq(a,b,c,d){var e=[],f=[],g=0,h=Math.min(a.length,b.length)-1;a[h]<a[0]&&(a=a.slice().reverse(),b=b.slice().reverse());while(++g<=h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,h)-1;return f[c](e[c](b))}}function cr(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=fu
 nction(e){return arguments.length?(b=e[0]<0?cu:ct,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(ch(a.domain(),ci)),d},d.ticks=function(){var d=cf(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=cs);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cu?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return cr(a.copy(),b)},ck(d,a)}function ct(a){return Math.log(a<0?0:a)/Math.LN10}function cu(a){return-Math.log(a>0?0:-a)/Math.LN10}function cv(a,b){function e(b){return a(c(b))}var c=cw(b),d=cw(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function
 (b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return cn(e.domain(),a)},e.tickFormat=function(a){return co(e.domain(),a)},e.nice=function(){return e.domain(ch(e.domain(),cl))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=cw(b=a),d=cw(1/b),e.domain(f)},e.copy=function(){return cv(a.copy(),b)},ck(e,a)}function cw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function cx(a,b){function f(b){return d[((c.get(b)||c.set(b,a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c=new k;var e=-1,g=d.length,h;while(++e<g)c.has(h=d[e])||c.set(h,a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k)
 ,e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[1]<c[0],j=c[i-0],k=c[1-i],l=(k-j)/(a.length+h);return d=g(j+l*h,l),i&&d.reverse(),e=l*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[1]<c[0],j=c[i-0],k=c[1-i],l=Math.floor((k-j)/(a.length+h)),m=k-j-(a.length-h)*l;return d=g(j+Math.round(m/2),l),i&&d.reverse(),e=Math.round(l*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return cf(b.x)},f.copy=function(){return cx(a,b)},f.domain(a)}function cC(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return
  cC(a,b)},d()}function cD(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return cD(a,b,c)},g()}function cE(a){function b(a){return+a}return b.invert=b,b.domain=b.range=function(c){return arguments.length?(a=c.map(b),b):a},b.ticks=function(b){return cn(a,b)},b.tickFormat=function(b){return co(a,b)},b.copy=function(){return cE(a)},b}function cH(a){return a.innerRadius}function cI(a){return a.outerRadius}function cJ(a){return a.startAngle}function cK(a){return a.endAngle}function cL(a){function h(e){function o(){h.push("M",f(a(i),g))}var h=[],i=[],j=-1,k=e.length,l,m=q(b),n=q(c);while(++j<k)d.call(this,l=e[j],j)?i.push([+m.call(this,l,j),+n.call(this,l,j)]):i.length&&(o(),i=[]);return i.length&&o(),h.length?h.join(""):null}var b=cM,c=cN,
 d=p,e=cO,f=cQ,g=.7;return h.x=function(a){return arguments.length?(b=a,h):b},h.y=function(a){return arguments.length?(c=a,h):c},h.defined=function(a){return arguments.length?(d=a,h):d},h.interpolate=function(a){return arguments.length?(cP.has(a+="")||(a=cO),f=cP.get(e=a),h):e},h.tension=function(a){return arguments.length?(g=a,h):g},h}function cM(a){return a[0]}function cN(a){return a[1]}function cQ(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cR(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cS(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cT(a,b){return a.length<4?cQ(a):a[1]+cW(a.slice(1,a.length-1),cX(a,b))}function cU(a,b){return a.length<3?cQ(a):a[0]+cW((a.push(a[0]),a),cX([a[a.length-2]].concat(a,[a[1]]),b))}function cV(a,b,c){return a.length<3?cQ(a):a[0]+cW(a,c
 X(a,b))}function cW(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cQ(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cX(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cY(a){if(a.length<3)return cQ(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];de(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),de(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),de(i,g,h);return i.join("")}function cZ(a){i
 f(a.length<4)return cQ(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(da(dd,f)+","+da(dd,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),de(b,f,g);return b.join("")}function c$(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[da(dd,g),",",da(dd,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),de(b,g,h);return b.join("")}function c_(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cY(a)}function da(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function de(a,b,c){a.push("C",da(db,b),",",da(db,c),",",da(dc,b),",",da(dc,c),",",da(dd,b),",",da(dd,c))}function df(a,b){return(b[1]-a[1])/(b[0]-a[0])}function dg(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=df(e,f);while(++b<c)d[b]=g+(g=df(e=f,f=a[b+1]));return d[b]=g,d}function dh(a
 ){var b=[],c,d,e,f,g=dg(a),h=-1,i=a.length-1;while(++h<i)c=df(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function di(a){return a.length<3?cQ(a):a[0]+cW(a,dh(a))}function dj(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cF,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function dk(a){function l(g){function y(){l.push("M",h(a(n),k),j,i(a(m.reverse()),k),"Z")}var l=[],m=[],n=[],o=-1,p=g.length,r,s=q(b),t=q(d),u=b===c?function(){return w}:q(c),v=d===e?function(){return x}:q(e),w,x;while(++o<p)f.call(this,r=g[o],o)?(m.push([w=+s.call(this,r,o),x=+t.call(this,r,o)]),n.push([+u.call(this,r,o),+v.call(this,r,o)])):m.length&&(y(),m=[],n=[]);return m.length&&y(),l.length?l.join(""):null}var b=cM,c=cM,d=0,e=cN,f=p,g=cO,h=cQ,i=cQ,j="L",k=.7;return l.x=function(a){return arguments.lengt
 h?(b=c=a,l):c},l.x0=function(a){return arguments.length?(b=a,l):b},l.x1=function(a){return arguments.length?(c=a,l):c},l.y=function(a){return arguments.length?(d=e=a,l):e},l.y0=function(a){return arguments.length?(d=a,l):d},l.y1=function(a){return arguments.length?(e=a,l):e},l.defined=function(a){return arguments.length?(f=a,l):f},l.interpolate=function(a){return arguments.length?(cP.has(a+="")||(a=cO),h=cP.get(g=a),i=h.reverse||h,j=/-closed$/.test(a)?"M":"L",l):g},l.tension=function(a){return arguments.length?(k=a,l):k},l}function dl(a){return a.source}function dm(a){return a.target}function dn(a){return a.radius}function dp(a){return a.startAngle}function dq(a){return a.endAngle}function dr(a){return[a.x,a.y]}function ds(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cF;return[c*Math.cos(d),c*Math.sin(d)]}}function dt(){return 64}function du(){return"circle"}function dv(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,
 "+b+"Z"}function dz(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function dA(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dB(a,b,c){e=[];if(c&&b.length>1){var d=cf(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dG(){dE||(dE=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dE.scrollTop=1e3,dE.dispatchEvent(a),b=1e3-dE.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b}function dH(a){var b=a.source,c=a.target,d=dJ(b,c),e=[b];while(b!==d)b=b.parent,e.push(b);var f=e.length;while(c!==d)e.splice(f,0,c),c=c.parent;return e}function dI(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;return b.push(a),b}function dJ(a,b){if(a
 ===b)return a;var c=dI(a),d=dI(b),e=c.pop(),f=d.pop(),g=null;while(e===f)g=e,e=c.pop(),f=d.pop();return g}function dM(a){a.fixed|=2}function dN(a){a!==dL&&(a.fixed&=1)}function dO(){dL.fixed&=1,dK=dL=null}function dP(){dL.px=d3.event.x,dL.py=d3.event.y,dK.resume()}function dQ(a,b,c){var d=0,e=0;a.charge=0;if(!a.leaf){var f=a.nodes,g=f.length,h=-1,i;while(++h<g){i=f[h];if(i==null)continue;dQ(i,b,c),a.charge+=i.charge,d+=i.charge*i.cx,e+=i.charge*i.cy}}if(a.point){a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5);var j=b*c[a.point.index];a.charge+=a.pointCharge=j,d+=j*a.point.x,e+=j*a.point.y}a.cx=d/a.charge,a.cy=e/a.charge}function dR(a){return 20}function dS(a){return 1}function dU(a){return a.x}function dV(a){return a.y}function dW(a,b,c){a.y0=b,a.y=c}function dZ(a){return d3.range(a.length)}function d$(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}function d_(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function 
 ea(a){return a.reduce(eb,0)}function eb(a,b){return a+b[1]}function ec(a,b){return ed(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function ed(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function ee(a){return[d3.min(a),d3.max(a)]}function ef(a,b){return d3.rebind(a,b,"sort","children","value"),a.links=ej,a.nodes=function(b){return ek=!0,(a.nodes=a)(b)},a}function eg(a){return a.children}function eh(a){return a.value}function ei(a,b){return b.value-a.value}function ej(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function el(a,b){return a.value-b.value}function em(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function en(a,b){a._pack_next=b,b._pack_prev=a}function eo(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function ep(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,
 c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(eq),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],eu(g,h,i),l(i),em(g,i),g._pack_prev=i,em(i,h),h=g._pack_next;for(var m=3;m<f;m++){eu(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(eo(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(eo(k,i))break;n?(o<p||o==p&&h.r<g.r?en(g,h=j):en(g=k,h),m--):(em(g,i),h=i,l(i))}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}return a.forEach(er),s}function eq(a){a._pack_next=a._pack_prev=a}function er(a){delete a._pack_next,delete a._pack_prev}function es(a){var b=a.children;b&&b.length?(b.forEach(es),a.r=ep(b)):a.r=Math.sqrt(a.value)}function et(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)et(e[f],b,c,d)}}function eu(a,b,c){var d=a.r+c.r,e=b.x-a.x,f=b.y-a.y;if(d&&(e||f))
 {var g=b.r+c.r,h=Math.sqrt(e*e+f*f),i=Math.max(-1,Math.min(1,(d*d+h*h-g*g)/(2*d*h))),j=Math.acos(i),k=i*(d/=h),l=Math.sin(j)*d;c.x=a.x+k*e+l*f,c.y=a.y+k*f-l*e}else c.x=a.x+d,c.y=a.y}function ev(a){return 1+d3.max(a,function(a){return a.y})}function ew(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function ex(a){var b=a.children;return b&&b.length?ex(b[0]):a}function ey(a){var b=a.children,c;return b&&(c=b.length)?ey(b[c-1]):a}function ez(a,b){return a.parent==b.parent?1:2}function eA(a){var b=a.children;return b&&b.length?b[0]:a._tree.thread}function eB(a){var b=a.children,c;return b&&(c=b.length)?b[c-1]:a._tree.thread}function eC(a,b){var c=a.children;if(c&&(e=c.length)){var d,e,f=-1;while(++f<e)b(d=eC(c[f],b),a)>0&&(a=d)}return a}function eD(a,b){return a.x-b.x}function eE(a,b){return b.x-a.x}function eF(a,b){return a.depth-b.depth}function eG(a,b){function c(a,d){var e=a.children;if(e&&(i=e.length)){var f,g=null,h=-1,i;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}f
 unction eH(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function eI(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function eJ(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function eK(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function eL(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];return e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0),{x:c,y:d,dx:e,dy:f}}function eM(a){return a.map(eN).join(",")}function eN(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}function eP(a,b){return function(c){return c&&a.hasOwnProperty(c.type)?a[c.type](c):b}}function eQ(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function eR(a,b){eS.hasOwnProperty(a.type)&&eS[a.type](a,b)}function eT(a,b){eR(a.geometry,b)}function eU(a,b){for(var c=a.features,d=0,e=c.length;d<e;d++)eR(c[d].geometry,b)}function eV(a,b
 ){for(var c=a.geometries,d=0,e=c.length;d<e;d++)eR(c[d],b)}function eW(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function eX(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function eY(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d][0],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function eZ(a,b){b.apply(null,a.coordinates)}function e$(a,b){for(var c=a.coordinates[0],d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function e_(a){return a.source}function fa(a){return a.target}function fb(a,b){function q(a){var b=Math.sin(o-(a*=o))/p,c=Math.sin(a)/p,f=b*g*d+c*m*j,i=b*g*e+c*m*k,l=b*h+c*n;return[Math.atan2(i,f)/eO,Math.atan2(l,Math.sqrt(f*f+i*i))/eO]}var c=a[0]*eO,d=Math.cos(c),e=Math.sin(c),f=a[1]*eO,g=Math.cos(f),h=Math.sin(f),i=b[0]*eO,j=Math.cos(i),k=Math.sin(i),l=b[1]*eO,m=Math.cos(l),n=Math.sin(l),o=q.d=Math.acos(Math.max(-1,Math.min(1,h*n+g*m*Math.cos(i-c)))),p=Math.sin(o);return q
 }function fe(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b===0?(b=c+1,c=0):(b-=1,c+=1)}}function ff(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function fg(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function fh(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function fj(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.
 leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l,b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[fi[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y<i.y||h.y==i.y&&h.x<i.x?(j=a,k=c):(j=b,k=d);var l=f>=k.region.r.x;return l&&j.side==="l"||!l&&j.side==="r"?null:{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side==="l")return 1;if(!e&&a.side==="r"
 )return 0;if(c.a===1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)<j*f*(1+2*g/j+c.b*c.b),c.b<0&&(i=!i)}}else{var k=c.c-c.a*b.x,l=b.y-k,m=b.x-d.x,n=k-d.y;i=l*l>m*m+n*n}return a.side==="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;if(!a.ep[fi[c]])return;b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;d<g;d++){var h=e[d];if(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return f.list.length===0},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=c.li
 st.shift();var g=c.list.shift(),h,i,j,k,l,m,n,o,p,q,r,s,t;for(;;){f.empty()||(h=f.min());if(g&&(f.empty()||g.y<h.y||g.y==h.y&&g.x<h.x))i=d.leftBound(g),j=d.right(i),n=d.rightRegion(i),s=e.bisect(n,g),m=d.createHalfEdge(s,"l"),d.insert(i,m),q=e.intersect(i,m),q&&(f.del(i),f.insert(i,q,e.distance(q,g))),i=m,m=d.createHalfEdge(s,"r"),d.insert(i,m),q=e.intersect(m,j),q&&f.insert(m,q,e.distance(q,g)),g=c.list.shift();else if(!f.empty())i=f.extractMin(),k=d.left(i),j=d.right(i),l=d.right(j),n=d.leftRegion(i),o=d.rightRegion(j),r=i.vertex,e.endPoint(i.edge,i.side,r),e.endPoint(j.edge,j.side,r),d.del(i),f.del(j),d.del(j),t="l",n.y>o.y&&(p=n,n=o,o=p,t="r"),s=e.bisect(n,o),m=d.createHalfEdge(s,t),d.insert(k,m),e.endPoint(s,fi[t],r),q=e.intersect(k,m),q&&(f.del(k),f.insert(k,q,e.distance(q,n))),q=e.intersect(m,l),q&&f.insert(m,q,e.distance(q,n));else break}for(i=d.right(d.leftEnd);i!=d.rightEnd;i=d.right(i))b(i.edge)}function fk(){return{leaf:!0,nodes:[],point:null}}function fl(a,b,c,d,e,f){if
 (!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&fl(a,i[0],c,d,g,h),i[1]&&fl(a,i[1],g,d,e,h),i[2]&&fl(a,i[2],c,h,g,f),i[3]&&fl(a,i[3],g,h,e,f)}}function fm(a){return{x:a[0],y:a[1]}}function fo(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function fq(a,b,c,d){var e,f,g=0,h=b.length,i=c.length;while(g<h){if(d>=i)return-1;e=b.charCodeAt(g++);if(e==37){f=fw[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function fx(a,b,c){return fz.test(b.substring(c,c+=3))?c:-1}function fy(a,b,c){fA.lastIndex=0;var d=fA.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function fC(a,b,c){var d=fD.get(b.substring(c,c+=3).toLowerCase());return d==null?-1:(a.m=d,c)}function fE(a,b,c){fF.lastIndex=0;var d=fF.exec(b.substring(c,c+12));return d?(a.m=fG.get(d[0].toLowerCase()),c+=d[0].length):-1}function fI(a,b,c){return fq(a,fv.c.toString(),b,c)}function fJ(a,b,c){return fq(a,fv.x.toString(),b,c)}function fK(a,b,c)
 {return fq(a,fv.X.toString(),b,c)}function fL(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+4));return d?(a.y=+d[0],c+=d[0].length):-1}function fM(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.y=fN()+ +d[0],c+=d[0].length):-1}function fN(){return~~((new Date).getFullYear()/1e3)*1e3}function fO(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.m=d[0]-1,c+=d[0].length):-1}function fP(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.d=+d[0],c+=d[0].length):-1}function fQ(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.H=+d[0],c+=d[0].length):-1}function fR(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.M=+d[0],c+=d[0].length):-1}function fS(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.S=+d[0],c+=d[0].length):-1}function fT(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+3));return d?(a.L=+d[0],c+=d[0].length):-1}function fV(a,b,c){var d=fW.get(b.substring
 (c,c+=2).toLowerCase());return d==null?-1:(a.p=d,c)}function fX(a){var b=a.getTimezoneOffset(),c=b>0?"-":"+",d=~~(Math.abs(b)/60),e=Math.abs(b)%60;return c+fr(d)+fr(e)}function fZ(a){return a.toISOString()}function f$(a,b,c){function d(b){var c=a(b),d=f(c,1);return b-c<d-b?c:d}function e(c){return b(c=a(new fn(c-1)),1),c}function f(a,c){return b(a=new fn(+a),c),a}function g(a,d,f){var g=e(a),h=[];if(f>1)while(g<d)c(g)%f||h.push(new Date(+g)),b(g,1);else while(g<d)h.push(new Date(+g)),b(g,1);return h}function h(a,b,c){try{fn=fo;var d=new fo;return d._=a,g(d,b,c)}finally{fn=Date}}a.floor=a,a.round=d,a.ceil=e,a.offset=f,a.range=g;var i=a.utc=f_(a);return i.floor=i,i.round=f_(d),i.ceil=f_(e),i.offset=f_(f),i.range=h,a}function f_(a){return function(b,c){try{fn=fo;var d=new fo;return d._=b,a(d,c)._}finally{fn=Date}}}function ga(a,b,c){function d(b){return a(
-b)}return d.invert=function(b){return gc(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(gc)},d.nice=function(a){var b=gb(d.domain());return d.domain([a.floor(b[0]),a.ceil(b[1])])},d.ticks=function(c,e){var f=gb(d.domain());if(typeof c!="function"){var g=f[1]-f[0],h=g/c,i=d3.bisect(gg,h);if(i==gg.length)return b.year(f,c);if(!i)return a.ticks(c).map(gc);Math.log(h/gg[i-1])<Math.log(gg[i]/h)&&--i,c=b[i],e=c[1],c=c[0].range}return c(f[0],new Date(+f[1]+1),e)},d.tickFormat=function(){return c},d.copy=function(){return ga(a.copy(),b,c)},d3.rebind(d,a,"range","rangeRound","interpolate","clamp")}function gb(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function gc(a){return new Date(a)}function gd(a){return function(b){var c=a.length-1,d=a[c];while(!d[1](b))d=a[--c];return d[0](b)}}function ge(a){var b=new Date(a,0,1);return b.setFullYear(a),b}function gf(a){var b=a.getFullYear(),c=ge(b),d=ge(b+1);return b+(a-c)/(d-c)}function go(a){var b=n
 ew Date(Date.UTC(a,0,1));return b.setUTCFullYear(a),b}function gp(a){var b=a.getUTCFullYear(),c=go(b),d=go(b+1);return b+(a-c)/(d-c)}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.9.1"};var f=h;try{f(document.documentElement.childNodes)[0].nodeType}catch(i){f=g}var j=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.map=function(a){var b=new k;for(var c in a)b.set(c,a[c]);return b},e(k,{has:function(a){return l+a in this},get:function(a){return this[l+a]},set:function(a,b){return this[l+a]=b},remove:function(a){return a=l+a,a in this&&delete this[a]},keys:function(){var a=[];return this.forEach(function(b){a.push(b)}),a},values:function(){var a=[];return this.forEach(function(b,c){a.push(c)}),a},entries:function(){var a=[];return this.forEach(function
 (b,c){a.push({key:b,value:c})}),a},forEach:function(a){for(var b in this)b.charCodeAt(0)===m&&a.call(this,b.substring(1),this[b])}});var l="\0",m=l.charCodeAt(0);d3.functor=q,d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=r(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)s(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)s(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(s),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)
 }return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e
 );return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,t),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisector=function(a){return{left:function(b,c,d,e){arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);while(d<e){var f=d+e>>1;a.call(b,b[f],f)<c?d=f+1:e=f}return d},right:function(b,c,d,e){arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);while(d<e){var f=d+e>>1;c<a.call(b,b[f],f)?e=f:d=f+1}return d}}};var u=d3.bisector(function(a){return a});d3.bisectLeft=u.left,d3.bisect=d3.bisectRight=u.right,d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending
 );while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],l,m,n=new k,o,p={};while(++h<i)(o=n.get(l=j(m=c[h])))?o.push(m):n.set(l,[m]);return n.forEach(function(a){p[a]=f(n.get(a),g)}),p}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;whil
 e(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=v);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c===Infinity)throw new Error("infinite range");var d=[],e=x(Math.abs(c)),f=-1,g;a*=e,b*=e,c*=e;if(c<0)while((g=a+c*++f)>b)d.push(g/e);else while((g=a+c*++f)<b)d.push(g/e);return d},d3.requote=function(a){return a.replace(y,"\\$&")};var y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),b&&d.setRequestHeader("Accept",b),d.onreadystatechange=function(){if(d.readyState===4){var a=d.status;c(a>=200&&a<300||a===304?d:null)}},d.send(null)},d3.t
 ext=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var z={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:z,qualify:function(a){var b=a.indexOf(":"),c=a;return b>=0&&(c=a.substring(0,b),a=a.substring(b+1)),z.hasOwnProperty(c)?{space:z[c],local:a}:a}},d3.dispatch=function(){var a=new A,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=B(a);return a},A.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.subst
 ring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):this[a].on(d,b)},d3.format=function(a){var b=C.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=D.get(i)||F,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=G(a)),a=b+a}else{g&&(a=G(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var C=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,D=d3.map({g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=E(a,b
 )).toFixed(Math.max(0,Math.min(20,b)))}}),H=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(I);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,E(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),H[8+c/3]};var J=S(2),K=S(3),L=function(){return R},M=d3.map({linear:L,poly:S,quad:function(){return J},cubic:function(){return K},sin:function(){return T},exp:function(){return U},circle:function(){return V},elastic:W,back:X,bounce:function(){return Y}}),N=d3.map({"in":R,out:P,"in-out":Q,"out-in":function(a){return Q(P(a))}});d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return c=M.get(c)||L,d=N.get(d)||R,O(d(c.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b
 ){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;ba.lastIndex=0;for(d=0;c=ba.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=ba.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=ba.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.
 interpolateTransform=function(a,b){var c=[],d=[],e,f=d3.transform(a),g=d3.transform(b),h=f.translate,i=g.translate,j=f.rotate,k=g.rotate,l=f.skew,m=g.skew,n=f.scale,o=g.scale;return h[0]!=i[0]||h[1]!=i[1]?(c.push("translate(",null,",",null,")"),d.push({i:1,x:d3.interpolateNumber(h[0],i[0])},{i:3,x:d3.interpolateNumber(h[1],i[1])})):i[0]||i[1]?c.push("translate("+i+")"):c.push(""),j!=k?d.push({i:c.push(c.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(j,k)}):k&&c.push(c.pop()+"rotate("+k+")"),l!=m?d.push({i:c.push(c.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(l,m)}):m&&c.push(c.pop()+"skewX("+m+")"),n[0]!=o[0]||n[1]!=o[1]?(e=c.push(c.pop()+"scale(",null,",",null,")"),d.push({i:e-4,x:d3.interpolateNumber(n[0],o[0])},{i:e-2,x:d3.interpolateNumber(n[1],o[1])})):(o[0]!=1||o[1]!=1)&&c.push(c.pop()+"scale("+o+")"),e=d.length,function(a){var b=-1,f;while(++b<e)c[(f=d[b]).i]=f.x(a);return c.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.
 r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+bg(Math.round(c+f*a))+bg(Math.round(d+g*a))+bg(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bn(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=bb(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var ba=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return
 (typeof b=="string"?bk.has(b)||/^(#|rgb\(|hsl\()/.test(b):b instanceof bf||b instanceof bm)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof bf?be(a.r,a.g,a.b):bh(""+a,be,bn):be(~~a,~~b,~~c)},bf.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?be(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),be(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},bf.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),be(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},bf.prototype.hsl=function(){return bi(this.r,this.g,this.b)},bf.prototype.toString=function(){return"#"+bg(this.r)+bg(this.g)+bg(this.b)};var bk=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#f
 fe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"
 #808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#8
 08000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});bk.forEach(function(a,b){bk.set(a,bh(b,be,bn))}),d3.hsl=function(a,b,c){return arguments.length===1?a instanceof bm?bl(a.h,a.s,a.l):bh(""+a,bi,bl):bl(+a,+b,+c)},bm.prototype.brighter=f
 unction(a){return a=Math.pow(.7,arguments.length?a:1),bl(this.h,this.s,this.l/a)},bm.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),bl(this.h,this.s,a*this.l)},bm.prototype.rgb=function(){return bn(this.h,this.s,this.l)},bm.prototype.toString=function(){return this.rgb().toString()};var bp=function(a,b){return b.querySelector(a)},bq=function(a,b){return b.querySelectorAll(a)},br=document.documentElement,bs=br.matchesSelector||br.webkitMatchesSelector||br.mozMatchesSelector||br.msMatchesSelector||br.oMatchesSelector,bt=function(a,b){return bs.call(a,b)};typeof Sizzle=="function"&&(bp=function(a,b){return Sizzle(a,b)[0]},bq=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bt=Sizzle.matchesSelector);var bu=[];d3.selection=function(){return bC},d3.selection.prototype=bu,bu.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bv(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[
 i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bo(b)},bu.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=bw(a));for(var e=-1,g=this.length;++e<g;)for(var h=this[e],i=-1,j=h.length;++i<j;)if(d=h[i])b.push(c=f(a.call(d,d.__data__,i))),c.parentNode=d;return bo(b)},bu.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bu.classed=function(a,b){var 
 c=a.split(bx),d=c.length,e=-1;if(arguments.length>1){while(++e<d)by.call(this,c[e],b);return this}while(++e<d)if(!by.call(this,c[e]))return!1;return!0};var bx=/\s+/g;bu.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bu.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bu.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.textContent=b==null?"":b}:a==null?function(){this.textContent
 =""}:function(){this.textContent=a})},bu.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.innerHTML=b==null?"":b}:a==null?function(){this.innerHTML=""}:function(){this.innerHTML=a})},bu.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bu.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),bp(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),bp(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bu.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bu.data=function(a,b){function g(a,c){var d,e=a.length,f=c.length,g=Math.min(e,f),l=Math.max(e,f),m=[],n=[],o=[],p,q;if(b)
 {var r=new k,s=[],t,u=c.length;for(d=-1;++d<e;)t=b.call(p=a[d],p.__data__,d),r.has(t)?o[u++]=p:r.set(t,p),s.push(t);for(d=-1;++d<f;)t=b.call(c,q=c[d],d),r.has(t)?(m[d]=p=r.get(t),p.__data__=q,n[d]=o[d]=null):(n[d]=bz(q),m[d]=o[d]=null),r.remove(t);for(d=-1;++d<e;)r.has(s[d])&&(o[d]=a[d])}else{for(d=-1;++d<g;)p=a[d],q=c[d],p?(p.__data__=q,m[d]=p,n[d]=o[d]=null):(n[d]=bz(q),m[d]=o[d]=null);for(;d<f;++d)n[d]=bz(c[d]),m[d]=o[d]=null;for(;d<l;++d)o[d]=a[d],n[d]=m[d]=null}n.update=m,n.parentNode=m.parentNode=o.parentNode=a.parentNode,h.push(n),i.push(m),j.push(o)}var c=-1,d=this.length,e,f;if(!arguments.length){a=new Array(d=(e=this[0]).length);while(++c<d)if(f=e[c])a[c]=f.__data__;return a}var h=bD([]),i=bo([]),j=bo([]);if(typeof a=="function")while(++c<d)g(e=this[c],a.call(e,e.parentNode.__data__,c));else while(++c<d)g(e=this[c],a);return i.enter=function(){return h},i.exit=function(){return j},i},bu.datum=bu.map=function(a){return arguments.length<1?this.property("__data__"):this.prope
 rty("__data__",a)},bu.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bA(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bo(b)},bu.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e!==f.nextSibling&&e.parentNode.insertBefore(f,e),e=f;return this},bu.sort=function(a){a=bB.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bu.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function i(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this,h=g[d];h&&(g.removeEventListener(a,h,h.$),delete g[d]),b&&(g.addEventListener(a,g[d]=i,i.$=c),i._=b)})},bu.each=function(a){for(var b=-1,c=this.length;++b<c;
 )for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bu.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bu.empty=function(){return!this.node()},bu.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bu.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:bP,duration:bQ}:null)}return bF(a,bL||++bK,Date.now())};var bC=bo([[document]]);bC[0].parentNode=br,d3.select=function(a){return typeof a=="string"?bC.select(a):bo([[a]])},d3.selectAll=function(a){return typeof a=="string"?bC.selectAll(a):bo([f(a)])};var bE=[];d3.selection.enter=bD,d3.selection.enter.prototype=bE,bE.append=bu.append,bE.insert=bu.insert,bE.empty=bu.empty,bE.node=bu.node,bE.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c
 =[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bo(b)};var bG={},bJ=[],bK=0,bL=0,bM=0,bN=250,bO=d3.ease("cubic-in-out"),bP=bM,bQ=bN,bR=bO;bJ.call=bu.call,d3.transition=function(a){return arguments.length?bL?a.transition():a:bC.transition()},d3.transition.prototype=bJ,bJ.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bv(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bF(b,this.id,this.time).ease(this.ease())},bJ.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bw(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.pus
 h({node:d[k],delay:e.delay,duration:e.duration})}return bF(b,this.id,this.time).ease(this.ease())},bJ.attr=function(a,b){return this.attrTween(a,bI(a,b))},bJ.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bG?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bG?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bJ.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bI(a,b),c)},bJ.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bG?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bJ.text=function(a){return this.tween("
 text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bJ.remove=function(){return this.each("end.transition",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bJ.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=a.apply(this,arguments)|0}:(a|=0,function(c,d,e){b[e][d].delay=a}))},bJ.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=Math.max(1,a.apply(this,arguments)|0)}:(a=Math.max(1,a|0),function(c,d,e){b[e][d].duration=a}))},bJ.transition=function(){return this.select(o)};var bT=null,bU,bV;d3.timer=function(a,b,c){var d=!1,e,f=bT;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bT={callback:a,then:c,delay:b,next:bT}),bU||(bV=clearTimeout(bV),bU=1,bY(bW))},d3.timer.flush=function(){var a,b=Date.now(),c=bT;while(c)a=b-
 c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bX()};var bY=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){var b=document.createElementNS(d3.ns.prefix.svg,"g"),c={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(a){b.setAttribute("transform",a);var d=b.transform.baseVal.consolidate();return new bZ(d?d.matrix:c)})(a)},bZ.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var cb=180/Math.PI;d3.mouse=function(a){return cd(a,$())};var cc=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(a,b){return arguments.length<2&&(b=$().touches),b?f(b).map(function(b){var c=cd(a,b);return c.identifier=b.identifier,c}):[]},d3.scale={},d3.scale.linear=function(){return cj([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return cr
 (d3.scale.linear(),ct)};var cs=d3.format(".0e");ct.pow=function(a){return Math.pow(10,a)},cu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return cv(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return cx([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cy)},d3.scale.category20=function(){return d3.scale.ordinal().range(cz)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cA)},d3.scale.category20c=function(){return d3.scale.ordinal().range(cB)};var cy=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cz=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cA=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9
 e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cB=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cC([],[])},d3.scale.quantize=function(){return cD(0,1,[0,1])},d3.scale.identity=function(){return cE([0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cF,h=d.apply(this,arguments)+cF,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cG?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*
 n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=cH,b=cI,c=cJ,d=cK;return e.innerRadius=function(b){return arguments.length?(a=q(b),e):a},e.outerRadius=function(a){return arguments.length?(b=q(a),e):b},e.startAngle=function(a){return arguments.length?(c=q(a),e):c},e.endAngle=function(a){return arguments.length?(d=q(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cF;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cF=-Math.PI/2,cG=2*Math.PI-1e-6;d3.svg.line=function(){return cL(n)};var cO="linear",cP=d3.map({linear:cQ,"step-before":cR,"step-after":cS,basis:cY,"basis-open":cZ,"basis-closed":c$,bundle:c_,cardinal:cV,"cardinal-open":cT,"cardinal-closed":cU,monotone:di}),db=[0,2/3,1/3,0],dc=[0,1/3,2/3,0],dd=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cL(dj);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cR.reverse=cS
 ,cS.reverse=cR,d3.svg.area=function(){return dk(Object)},d3.svg.area.radial=function(){var a=dk(dj);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1,e.a1-e.a0)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1,f.a1-f.a0)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cF,k=e.call(a,h,g)+cF;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b,c){return"A"+a+","+a+" 0 "+ +(c>Math.PI)+",1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=dl,b=dm,c=dn,d=cJ,e=cK;return f.radius=function(a){return arguments.length?(c=q(a),f):c},f.source=function(b){return arguments.length?(a=q(b),f):a},f.target=function(a){retur
 n arguments.length?(b=q(a),f):b},f.startAngle=function(a){return arguments.length?(d=q(a),f):d},f.endAngle=function(a){return arguments.length?(e=q(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=dl,b=dm,c=dr;return d.source=function(b){return arguments.length?(a=q(b),d):a},d.target=function(a){return arguments.length?(b=q(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=dr,c=a.projection;return a.projection=function(a){return arguments.length?c(ds(b=a)):b},a},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function c(c,d){return(dw.get(a.call(this,c,d))||dv)(b.call(this,c,d))}var a=du,b=dt;return c
-.type=function(b){return arguments.length?(a=q(b),c):a},c.size=function(a){return arguments.length?(b=q(a),c):b},c};var dw=d3.map({circle:dv,cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dy)),c=b*dy;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dx),c=b*dx/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dx),c=b*dx/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}});d3.svg.symbolTypes=dw.keys();var dx=Math.sqrt(3),dy=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function k(k){k.each(function(){var k=d3.select(this),l=h==null?a.ticks?a.ticks.apply(a,g):a.domain():h,m=i==null?a.tickFormat?a.tickFormat.apply(a,g):String:i,n=dB(a,l,j),o=k
 .selectAll(".minor").data(n,String),p=o.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),q=d3.transition(o.exit()).style("opacity",1e-6).remove(),r=d3.transition(o).style("opacity",1),s=k.selectAll("g").data(l,String),t=s.enter().insert("g","path").style("opacity",1e-6),u=d3.transition(s.exit()).style("opacity",1e-6).remove(),v=d3.transition(s).style("opacity",1),w,x=cg(a),y=k.selectAll(".domain").data([0]),z=y.enter().append("path").attr("class","domain"),A=d3.transition(y),B=a.copy(),C=this.__chart__||B;this.__chart__=B,t.append("line").attr("class","tick"),t.append("text"),v.select("text").text(m);switch(b){case"bottom":w=dz,p.attr("y2",d),r.attr("x2",0).attr("y2",d),t.select("line").attr("y2",c),t.select("text").attr("y",Math.max(c,0)+f),v.select("line").attr("x2",0).attr("y2",c),v.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),A.attr("d","M"+x[0]+","+e+"V0H"+x[1]+"V"+e);break;case"top":w=dz,p.attr(
 "y2",-d),r.attr("x2",0).attr("y2",-d),t.select("line").attr("y2",-c),t.select("text").attr("y",-(Math.max(c,0)+f)),v.select("line").attr("x2",0).attr("y2",-c),v.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),A.attr("d","M"+x[0]+","+ -e+"V0H"+x[1]+"V"+ -e);break;case"left":w=dA,p.attr("x2",-d),r.attr("x2",-d).attr("y2",0),t.select("line").attr("x2",-c),t.select("text").attr("x",-(Math.max(c,0)+f)),v.select("line").attr("x2",-c).attr("y2",0),v.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),A.attr("d","M"+ -e+","+x[0]+"H0V"+x[1]+"H"+ -e);break;case"right":w=dA,p.attr("x2",d),r.attr("x2",d).attr("y2",0),t.select("line").attr("x2",c),t.select("text").attr("x",Math.max(c,0)+f),v.select("line").attr("x2",c).attr("y2",0),v.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),A.attr("d","M"+e+","+x[0]+"H0V"+x[1]+"H"+e)}if(a.ticks)t.call(w
 ,C),v.call(w,B),u.call(w,B),p.call(w,C),r.call(w,B),q.call(w,B);else{var D=B.rangeBand()/2,E=function(a){return B(a)+D};t.call(w,E),v.call(w,E)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h=null,i,j=0;return k.scale=function(b){return arguments.length?(a=b,k):a},k.orient=function(a){return arguments.length?(b=a,k):b},k.ticks=function(){return arguments.length?(g=arguments,k):g},k.tickValues=function(a){return arguments.length?(h=a,k):h},k.tickFormat=function(a){return arguments.length?(i=a,k):i},k.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,k},k.tickPadding=function(a){return arguments.length?(f=+a,k):f},k.tickSubdivide=function(a){return arguments.length?(j=+a,k):j},k},d3.svg.brush=function(){function g(a){a.each(function(){var a=d3.select(this),e=a.selectAll(".background").data([0]),f=a.selectAll(".extent").data([0]),l=a.selectAll(".resize").data(d,String),m;a.style("pointer-events","
 all").on("mousedown.brush",k).on("touchstart.brush",k),e.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),f.enter().append("rect").attr("class","extent").style("cursor","move"),l.enter().append("g").attr("class",function(a){return"resize "+a}).style("cursor",function(a){return dC[a]}).append("rect").attr("x",function(a){return/[ew]$/.test(a)?-3:null}).attr("y",function(a){return/^[ns]/.test(a)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),l.style("display",g.empty()?"none":null),l.exit().remove(),b&&(m=cg(b),e.attr("x",m[0]).attr("width",m[1]-m[0]),i(a)),c&&(m=cg(c),e.attr("y",m[0]).attr("height",m[1]-m[0]),j(a)),h(a)})}function h(a){a.selectAll(".resize").attr("transform",function(a){return"translate("+e[+/e$/.test(a)][0]+","+e[+/^s/.test(a)][1]+")"})}function i(a){a.select(".extent").attr("x",e[0][0]),a.selectAll(".extent,.n>rect,.s>rect").attr("width",e[1][0]-e[0][0])}function j(a){a.select(".exte
 nt").attr("y",e[0][1]),a.selectAll(".extent,.e>rect,.w>rect").attr("height",e[1][1]-e[0][1])}function k(){function x(){var a=d3.event.changedTouches;return a?d3.touches(d,a)[0]:d3.mouse(d)}function y(){d3.event.keyCode==32&&(q||(r=null,s[0]-=e[1][0],s[1]-=e[1][1],q=2),Z())}function z(){d3.event.keyCode==32&&q==2&&(s[0]+=e[1][0],s[1]+=e[1][1],q=0,Z())}function A(){var a=x(),d=!1;t&&(a[0]+=t[0],a[1]+=t[1]),q||(d3.event.altKey?(r||(r=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]),s[0]=e[+(a[0]<r[0])][0],s[1]=e[+(a[1]<r[1])][1]):r=null),o&&B(a,b,0)&&(i(m),d=!0),p&&B(a,c,1)&&(j(m),d=!0),d&&(h(m),l({type:"brush",mode:q?"move":"resize"}))}function B(a,b,c){var d=cg(b),g=d[0],h=d[1],i=s[c],j=e[1][c]-e[0][c],k,l;q&&(g-=i,h-=j+i),k=Math.max(g,Math.min(h,a[c])),q?l=(k+=i)+j:(r&&(i=Math.max(g,Math.min(h,2*r[c]-k))),i<k?(l=k,k=i):l=i);if(e[0][c]!==k||e[1][c]!==l)return f=null,e[0][c]=k,e[1][c]=l,!0}function C(){A(),m.style("pointer-events","all").selectAll(".resize").style("display",g.empty()?"none"
 :null),d3.select("body").style("cursor",null),u.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),l({type:"brushend"}),Z()}var d=this,k=d3.select(d3.event.target),l=a.of(d,arguments),m=d3.select(d),n=k.datum(),o=!/^(n|s)$/.test(n)&&b,p=!/^(e|w)$/.test(n)&&c,q=k.classed("extent"),r,s=x(),t,u=d3.select(window).on("mousemove.brush",A).on("mouseup.brush",C).on("touchmove.brush",A).on("touchend.brush",C).on("keydown.brush",y).on("keyup.brush",z);if(q)s[0]=e[0][0]-s[0],s[1]=e[0][1]-s[1];else if(n){var v=+/w$/.test(n),w=+/^n/.test(n);t=[e[1-v][0]-s[0],e[1-w][1]-s[1]],s[0]=e[v][0],s[1]=e[w][1]}else d3.event.altKey&&(r=s.slice());m.style("pointer-events","none").selectAll(".resize").style("display",null),d3.select("body").style("cursor",k.style("cursor")),l({type:"brushstart"}),A(),Z()}var a=_(g,"brushstart","brush","brushend"),b=null,c=null,d=dD[0],e=[[0,0],[0,0]],f;return g.x=function(a){
 return arguments.length?(b=a,d=dD[!b<<1|!c],g):b},g.y=function(a){return arguments.length?(c=a,d=dD[!b<<1|!c],g):c},g.extent=function(a){var d,h,i,j,k;return arguments.length?(f=[[0,0],[0,0]],b&&(d=a[0],h=a[1],c&&(d=d[0],h=h[0]),f[0][0]=d,f[1][0]=h,b.invert&&(d=b(d),h=b(h)),h<d&&(k=d,d=h,h=k),e[0][0]=d|0,e[1][0]=h|0),c&&(i=a[0],j=a[1],b&&(i=i[1],j=j[1]),f[0][1]=i,f[1][1]=j,c.invert&&(i=c(i),j=c(j)),j<i&&(k=i,i=j,j=k),e[0][1]=i|0,e[1][1]=j|0),g):(a=f||e,b&&(d=a[0][0],h=a[1][0],f||(d=e[0][0],h=e[1][0],b.invert&&(d=b.invert(d),h=b.invert(h)),h<d&&(k=d,d=h,h=k))),c&&(i=a[0][1],j=a[1][1],f||(i=e[0][1],j=e[1][1],c.invert&&(i=c.invert(i),j=c.invert(j)),j<i&&(k=i,i=j,j=k))),b&&c?[[d,i],[h,j]]:b?[d,h]:c&&[i,j])},g.clear=function(){return f=null,e[0][0]=e[0][1]=e[1][0]=e[1][1]=0,g},g.empty=function(){return b&&e[0][0]===e[1][0]||c&&e[0][1]===e[1][1]},d3.rebind(g,a,"on")};var dC={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw
 -resize"},dD=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",d).on("touchstart.drag",d)}function d(){function j(){var a=c.parentNode,b=d3.event.changedTouches;return b?d3.touches(a,b)[0]:d3.mouse(a)}function k(){if(!c.parentNode)return l();var a=j(),b=a[0]-g[0],e=a[1]-g[1];h|=b|e,g=a,Z(),d({type:"drag",x:a[0]+f[0],y:a[1]+f[1],dx:b,dy:e})}function l(){d({type:"dragend"}),h&&(Z(),d3.event.target===e&&i.on("click.drag",m,!0)),i.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function m(){Z(),i.on("click.drag",null)}var c=this,d=a.of(c,arguments),e=d3.event.target,f,g=j(),h=0,i=d3.select(window).on("mousemove.drag",k).on("touchmove.drag",k).on("mouseup.drag",l,!0).on("touchend.drag",l,!0);b?(f=b.apply(c,arguments),f=[f.x-g[0],f.y-g[1]]):f=[0,0],Z(),d({type:"dragstart"})}var a=_(c,"drag","dragstart","dragend"),b=null;return c.origin=function
 (a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")},d3.behavior.zoom=function(){function l(){this.on("mousedown.zoom",r).on("mousewheel.zoom",s).on("mousemove.zoom",t).on("DOMMouseScroll.zoom",s).on("dblclick.zoom",u).on("touchstart.zoom",v).on("touchmove.zoom",w).on("touchend.zoom",v)}function m(b){return[(b[0]-a[0])/c,(b[1]-a[1])/c]}function n(b){return[b[0]*c+a[0],b[1]*c+a[1]]}function o(a){c=Math.max(e[0],Math.min(e[1],a))}function p(b,c){c=n(c),a[0]+=b[0]-c[0],a[1]+=b[1]-c[1]}function q(b){h&&h.domain(g.range().map(function(b){return(b-a[0])/c}).map(g.invert)),j&&j.domain(i.range().map(function(b){return(b-a[1])/c}).map(i.invert)),d3.event.preventDefault(),b({type:"zoom",scale:c,translate:a})}function r(){function h(){d=1,p(d3.mouse(a),g),q(b)}function i(){d&&Z(),e.on("mousemove.zoom",null).on("mouseup.zoom",null),d&&d3.event.target===c&&e.on("click.zoom",j,!0)}function j(){Z(),e.on("click.zoom",null)}var a=this,b=f.of(a,arguments),c=d3.event.target,d=0,e=d3.select(wind
 ow).on("mousemove.zoom",h).on("mouseup.zoom",i),g=m(d3.mouse(a));window.focus(),Z()}function s(){b||(b=m(d3.mouse(this))),o(Math.pow(2,dG()*.002)*c),p(d3.mouse(this),b),q(f.of(this,arguments))}function t(){b=null}function u(){var a=d3.mouse(this),b=m(a);o(d3.event.shiftKey?c/2:c*2),p(a,b),q(f.of(this,arguments))}function v(){var a=d3.touches(this),e=Date.now();d=c,b={},a.forEach(function(a){b[a.identifier]=m(a)}),Z();if(a.length===1&&e-k<500){var g=a[0],h=m(a[0]);o(c*2),p(g,h),q(f.of(this,arguments))}k=e}function w(){var a=d3.touches(this),c=a[0],e=b[c.identifier];if(g=a[1]){var g,h=b[g.identifier];c=[(c[0]+g[0])/2,(c[1]+g[1])/2],e=[(e[0]+h[0])/2,(e[1]+h[1])/2],o(d3.event.scale*d)}p(c,e),q(f.of(this,arguments))}var a=[0,0],b,c=1,d,e=dF,f=_(l,"zoom"),g,h,i,j,k;return l.translate=function(b){return arguments.length?(a=b.map(Number),l):a},l.scale=function(a){return arguments.length?(c=+a,l):c},l.scaleExtent=function(a){return arguments.length?(e=a==null?dF:a.map(Number),l):e},l.x=funct
 ion(a){return arguments.length?(h=a,g=a.copy(),l):h},l.y=function(a){return arguments.length?(j=a,i=a.copy(),l):j},d3.rebind(l,f,"on")};var dE,dF=[0,Infinity];d3.layout={},d3.layout.bundle=function(){return function(a){var b=[],c=-1,d=a.length;while(++c<d)b.push(dH(a[c]));return b}},d3.layout.chord=function(){function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[s][r],u=d[s][t],v=o,w=o+=u*n;a[s+"-"+t]={index:s,subindex:t,startAngle:v,endAngle:w,value:u}}c[s]={index:s,startAngle:p,endAngle:o,value:(o-p)/n},o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var x=a[q+"-"+r],y=a[r+"-"+q];(x.value||y.value)&&b.push(x.value<y.value?{source:y,target:x}:{source:x,target:y})}}i&&k()}function k(){b.sor
 t(function(a,b){return i((a.source.value+a.target.value)/2,(b.source.value+b.target.value)/2)})}var a={},b,c,d,e,f=0,g,h,i;return a.matrix=function(f){return arguments.length?(e=(d=f)&&d.length,b=c=null,a):d},a.padding=function(d){return arguments.length?(f=d,b=c=null,a):f},a.sortGroups=function(d){return arguments.length?(g=d,b=c=null,a):g},a.sortSubgroups=function(c){return arguments.length?(h=c,b=null,a):h},a.sortChords=function(c){return arguments.length?(i=c,b&&k(),a):i},a.chords=function(){return b||j(),b},a.groups=function(){return c||j(),c},a},d3.layout.force=function(){function t(a){return function(b,c,d,e,f){if(b.point!==a){var g=b.cx-a.x,h=b.cy-a.y,i=1/Math.sqrt(g*g+h*h);if((e-c)*i<k){var j=b.charge*i*i;return a.px-=g*j,a.py-=h*j,!0}if(b.point&&isFinite(i)){var j=b.pointCharge*i*i;a.px-=g*j,a.py-=h*j}}return!b.charge}}function u(b){dM(dL=b),dK=a}var a={},b=d3.dispatch("start","tick","end"),c=[1,1],d,e,f=.9,g=dR,h=dS,i=-30,j=.1,k=.8,l,m=[],o=[],p,r,s;return a.tick=function
 (){if((e*=.99)<.005)return b.end({type:"end",alpha:e=0}),!0;var a=m.length,d=o.length,g,h,k,l,n,q,u,v,w;for(h=0;h<d;++h){k=o[h],l=k.source,n=k.target,v=n.x-l.x,w=n.y-l.y;if(q=v*v+w*w)q=e*r[h]*((q=Math.sqrt(q))-p[h])/q,v*=q,w*=q,n.x-=v*(u=l.weight/(n.weight+l.weight)),n.y-=w*u,l.x+=v*(u=1-u),l.y+=w*u}if(u=e*j){v=c[0]/2,w=c[1]/2,h=-1;if(u)while(++h<a)k=m[h],k.x+=(v-k.x)*u,k.y+=(w-k.y)*u}if(i){dQ(g=d3.geom.quadtree(m),e,s),h=-1;while(++h<a)(k=m[h]).fixed||g.visit(t(k))}h=-1;while(++h<a)k=m[h],k.fixed?(k.x=k.px,k.y=k.py):(k.x-=(k.px-(k.px=k.x))*f,k.y-=(k.py-(k.py=k.y))*f);b.tick({type:"tick",alpha:e})},a.nodes=function(b){return arguments.length?(m=b,a):m},a.links=function(b){return arguments.length?(o=b,a):o},a.size=function(b){return arguments.length?(c=b,a):c},a.linkDistance=function(b){return arguments.length?(g=q(b),a):g},a.distance=a.linkDistance,a.linkStrength=function(b){return arguments.length?(h=q(b),a):h},a.friction=function(b){return arguments.length?(f=b,a):f},a.charge=func
 tion(b){return arguments.length?(i=typeof b=="function"?b:+b,a):i},a.gravity=function(b){return arguments.length?(j=b,a):j},a.theta=function(b){return arguments.length?(k=b,a):k},a.alpha=function(c){return arguments.length?(e?c>0?e=c:e=0:c>0&&(b.start({type:"start",alpha:e=c}),d3.timer(a.tick)),a):e},a.start=function(){function q(a,c){var d=t(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}function t(){if(!l){l=[];for(d=0;d<e;++d)l[d]=[];for(d=0;d<f;++d){var a=o[d];l[a.source.index].push(a.target),l[a.target.index].push(a.source)}}return l[b]}var b,d,e=m.length,f=o.length,j=c[0],k=c[1],l,n;for(b=0;b<e;++b)(n=m[b]).index=b,n.weight=0;p=[],r=[];for(b=0;b<f;++b)n=o[b],typeof n.source=="number"&&(n.source=m[n.source]),typeof n.target=="number"&&(n.target=m[n.target]),p[b]=g.call(this,n,b),r[b]=h.call(this,n,b),++n.source.weight,++n.target.weight;for(b=0;b<e;++b)n=m[b],isNaN(n.x)&&(n.x=q("x",j)),isNaN(n.y)&&(n.y=q("y",k)),isNaN(n.px)&&(n.px=n.x),isNa
 N(n.py)&&(n.py=n.y);s=[];if(typeof i=="function")for(b=0;b<e;++b)s[b]=+i.call(this,m[b],b);else for(b=0;b<e;++b)s[b]=i;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){d||(d=d3.behavior.drag().origin(n).on("dragstart",u).on("drag",dP).on("dragend",dO)),this.on("mouseover.force",dM).on("mouseout.force",dN).call(d)},d3.rebind(a,b,"on")};var dK,dL;d3.layout.partition=function(){function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f&&(h=f.length)){var g=-1,h,i,j;d=a.value?d/a.value:0;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}function d(a){var b=a.children,c=0;if(b&&(f=b.length)){var e=-1,f;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function e(e,f){var g=a.call(this,e,f);return c(g[0],0,b[0],b[1]/d(g[0])),g}var a=d3.layout.hierarchy(),b=[1,1];return e.size=function(a){return arguments.length?(b=a,e):b},ef(e,a)},d3.layout.pie=function(){function f(g,h){var i=g.map(function(b,c){return+a.call(f,b,c)})
 ,j=+(typeof c=="function"?c.apply(this,arguments):c),k=((typeof e=="function"?e.apply(this,arguments):e)-c)/d3.sum(i),l=d3.range(g.length);b!=null&&l.sort(b===dT?function(a,b){return i[b]-i[a]}:function(a,c){return b(g[a],g[c])});var m=[];return l.forEach(function(a){m[a]={data:g[a],value:d=i[a],startAngle:j,endAngle:j+=d*k}}),m}var a=Number,b=dT,c=0,e=2*Math.PI;return f.value=function(b){return arguments.length?(a=b,f):a},f.sort=function(a){return arguments.length?(b=a,f):b},f.startAngle=function(a){return arguments.length?(c=a,f):c},f.endAngle=function(a){return arguments.length?(e=a,f):e},f};var dT={};d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1]
 ,k[p][q][1])}return h}var a=n,b=dZ,c=d$,d=dW,e=dU,f=dV;return g.values=function(b){return arguments.length?(a=b,g):a},g.order=function(a){return arguments.length?(b=typeof a=="function"?a:dX.get(a)||dZ,g):b},g.offset=function(a){return arguments.length?(c=typeof a=="function"?a:dY.get(a)||d$,g):c},g.x=function(a){return arguments.length?(e=a,g):e},g.y=function(a){return arguments.length?(f=a,g):f},g.out=function(a){return arguments.length?(d=a,g):d},g};var dX=d3.map({"inside-out":function(a){var b=a.length,c,d,e=a.map(d_),f=a.map(ea),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":dZ}),dY=d3.map({silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){va
 r b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:d$});d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;if(m>0){f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]))}return g}var a=!0,b=Number,c=ee,d=ec;return e.value=function(a){return arguments.length?(b=a,e):b},e.range=function(a){return arguments.length?(
 c=q(a),e):c},e.bins=function(a){return arguments.length?(d=typeof a=="number"?function(b){return ed(b,a)}:q(a),e):d},e.frequency=function(b){return arguments.length?(a=!!b,e):a},e},d3.layout.hierarchy=function(){function e(f,h,i){var j=b.call(g,f,h),k=ek?f:{data:f};k.depth=h,i.push(k);if(j&&(m=j.length)){var l=-1,m,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=+c.call(g,f,h)||0);return k}function f(a,b){var d=a.children,e=0;if(d&&(i=d.length)){var h=-1,i,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=+c.call(g,ek?a:a.data,b)||0);return c&&(a.value=e),e}function g(a){var b=[];return e(a,0,b),b}var a=ei,b=eg,c=eh;return g.sort=function(b){return arguments.length?(a=b,g):a},g.children=function(a){return arguments.length?(b=a,g):b},g.value=function(a){return arguments.length?(c=a,g):c},g.revalue=function(a){return f(a,0),a},g};var ek=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.
 x=0,f.y=0,es(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);return et(f,g/2,h/2,i),e}var a=d3.layout.hierarchy().sort(el),b=[1,1];return c.size=function(a){return arguments.length?(b=a,c):b},ef(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;eG(g,function(a){var c=a.children;c&&c.length?(a.x=ew(c),a.y=ev(c)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=ex(g),m=ey(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;return eG(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-(g.y?a.y/g.y:1))*c[1]}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=ez,c=[1,1];return d.separation=function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},ef(d,a)},d3.layout.tree=function(){function d(d,e){function h(a,c){var d=a.children,e=a._tree;if(d&&(f=d.length)){var f,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;eH(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}el
 se c&&(e.prelim=c._tree.prelim+b(a,c))}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c&&(e=c.length)){var d=-1,e;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=eB(g),e=eA(e),g&&e)h=eA(h),f=eB(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(eI(eJ(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!eB(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!eA(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}var f=a.call(this,d,e),g=f[0];eG(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=eC(g,eE),l=eC(g,eD),m=eC(g,eF),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;return eG(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=ez,c=[1,1];return d.separation=
 function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},ef(d,a)},d3.layout.treemap=function(){function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}function j(a){var b=a.children;if(b&&b.length){var c=e(a),d=[],f=b.slice(),g,h=Infinity,k,n=Math.min(c.dx,c.dy),o;i(f,c.dx*c.dy/a.value),d.area=0;while((o=f.length)>0)d.push(g=f[o-1]),d.area+=g.area,(k=l(d,n))<=h?(f.pop(),h=k):(d.area-=d.pop().area,m(d,n,c,!1),n=Math.min(c.dx,c.dy),d.length=d.area=0,h=Infinity);d.length&&(m(d,n,c,!0),d.length=d.area=0),b.forEach(j)}}function k(a){var b=a.children;if(b&&b.length){var c=e(a),d=b.slice(),f,g=[];i(d,c.dx*c.dy/a.value),g.area=0;while(f=d.pop())g.push(f),g.area+=f.area,f.z!=null&&(m(g,f.z?c.dx:c.dy,c,!d.length),g.length=g.area=0);b.forEach(k)}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){if(!(d=a[g].area))continue;d<f&&(f=d),d>e&&(e=d)}return c*=c,b*=b,c?Math.max(b*e*h/
 c,c/(b*f*h)):Infinity}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=Math.min(d.x+d.dx-h,j?b(k.area/j):0);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=Math.min(d.y+d.dy-i,j?b(k.area/j):0);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function n(b){var d=g||a(b),e=d[0];return e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(

<TRUNCATED>

[10/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode.js
deleted file mode 100644
index d7f26c8..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlmode.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-CodeMirror.defineMode("sparql", function(config, parserConfig) {
-  var indentUnit = config.indentUnit;
-
-
-    function wordRegexp(words) {
-	return new RegExp("^(?:" + words.join("|") + ")$", "i");
-    }
-
-    var operatorChars = /[*+\-<>=!&|\^\@]/;
-    var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", "isblank", "isliteral", "union", "regex"]);
-    var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", "graph", "by", "asc", "desc"]);
-
-    // Used as scratch variables to communicate multiple values without
-    // consing up tons of objects.
-    var type, content;
-    function ret(tp, style, cont) {
-	type = tp; content = cont;
-	return style;
-    }
-
-    function tokenBase(stream, state) {
-//	alert(stream.col);
-	var ch = stream.next();
-	if (ch == "$" || ch == "?") {
-            stream.eatWhile(/[\w\d]/);
-	    if (state.stack.length > 0) state.stack.push("arg");
-            return ret("variable","sp-var"); }
-	else if (ch=="<") {
-            stream.eatWhile(/[^\s\u00a0>]/);
-            if (stream.current() == ">") stream.next();
-	    if (state.stack.length > 0) state.stack.push("arg");
-            return ret("uri","sp-uri");
-	}
-	else if (ch == '"' || ch == "'") {
-	    if (state.stack.length > 0) state.stack.push("arg");
-	    return chain(stream, state, tokenString(ch));
-	}
-	else if (/[{\(\[]/.test(ch)) {
-	    state.stack.push(ch);
-	    return "sp-punc";
-	}
-	else if (/^\]/.test(ch)) {
-	    while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	    if (state.stack.pop()=="[")
-		state.stack.push("arg");
-	    // else syntax is mangled anyway
-	    return "sp-punc";
-	}
-	else if (/^[}\)]/.test(ch)) {
-	    while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	    state.stack.pop();
-	    return "sp-punc";
-	}
-	else if (/^\./.test(ch)) {
-	    while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	    return "sp-punc";
-	}
-	else if (/^;/.test(ch)) {
-	    while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	    if (state.stack[state.stack.length-1]!="[") 
-		state.stack.push("arg");
-	    return "sp-punc";
-	}
-	else if (/^,/.test(ch)) {
-	    while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	    if (state.stack[state.stack.length-1]!="[") 
-		state.stack.push("arg");
-	    state.stack.push("arg");
-	    return "sp-punc";
-	}
-	else if (/^\d/.test(ch)) {
-	    stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
-	    return ret("number", "sp-number");
-	}
-	else if (ch == "#") {
-	    stream.skipToEnd();
-            return ret("comment", "sp-comment");
-	}
-	else if (operatorChars.test(ch)) {
-            stream.eatWhile(ch);
-            return ret(stream.current(),"sp-operator");
-	}
-	else if (ch == ":") {
-	    stream.next();
-            stream.eatWhile(/[\w\d\._\-]/);
-	    if (state.stack.length > 0) state.stack.push("arg");
-            return "sp-prefixed";
-	} else {
-            stream.eatWhile(/[_\-\w\d]/);
-            if (stream.peek()==":") {
-		stream.next();
-		stream.eatWhile(/[\w\d_\-]/);
-		if (state.stack.length > 0) state.stack.push("arg");
-		return "sp-prefixed";
-            }
-	    var word = stream.current(), type;
-	    word= word.replace(/[ \n\t]/,"");
-
-	    if (word=="a")
-	    {
-		type= "sp-operator"
-		if (state.stack.length > 0) state.stack.push("arg");
-	    }
-            else if (ops.test(word))
-		type = "sp-operator";
-            else if (keywords.test(word))
-		type = "sp-keyword";
-            else
-		type = "sp-word";
-            return type;
-	}
-    }
-
-  function tokenString(quote) {
-    return function(stream, state) {
-      if (!nextUntilUnescaped(stream, quote))
-        state.tokenize = tokenBase;
-      return ret("string", "sp-literal");
-    };
-  }
-
-  function chain(stream, state, f) {
-    state.tokenize = f;
-    return f(stream, state);
-  }
-
-  function nextUntilUnescaped(stream, end) {
-    var escaped = false, next;
-    while ((next = stream.next()) != null) {
-      if (next == end && !escaped)
-        return false;
-      escaped = !escaped && next == "\\";
-    }
-    return escaped;
-  }
-
-
-  return {
-
-      token: tokenBase,
-      
-      startState: function(base) {
-	  return {tokenize: tokenBase,
-		  baseIndent: base,
-		  stack: [] }; },
-
-      indent: function(state, textAfter) {
-	  var n = state.stack.length;
-
-	  if (/^[\}\]\)]/.test(textAfter)) 
-	  {
-    	      while(state.stack[state.stack.length-1]=="arg")
-		state.stack.pop();
-	      n= state.stack.length-1;
-	  }
-
-	  return n * config.indentUnit;
-      },
-
-      electricChars: "}])"
-  };
-});
-


[07/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/prototype.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/prototype.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/prototype.js
deleted file mode 100755
index 3548fc0..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/prototype.js
+++ /dev/null
@@ -1,4238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*  Prototype JavaScript framework, version 1.6.0.2
- *  (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.2',
-
-  Browser: {
-    IE:     !!(window.attachEvent && !window.opera),
-    Opera:  !!window.opera,
-    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,
-    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 = Object.extend((function(m) {
-          return function() { return ancestor[m].apply(this, arguments) };
-        })(property).wrap(method), {
-          valueOf:  function() { return method },
-          toString: function() { return method.toString() }
-        });
-      }
-      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].split(",").invoke("strip");
-    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);
-  },
-
-  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)));
-    };
-  }
-});
-
-Function.prototype.defer = Function.prototype.delay.curry(0.01);
-
-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.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('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(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;
-    iterator = iterator.bind(context);
-    try {
-      this._each(function(value) {
-        iterator(value, index++);
-      });
-    } catch (e) {
-      if (e != $break) throw e;
-    }
-    return this;
-  },
-
-  eachSlice: function(number, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var index = -number, slices = [], array = this.toArray();
-    while ((index += number) < array.length)
-      slices.push(array.slice(index, index+number));
-    return slices.collect(iterator, context);
-  },
-
-  all: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = true;
-    this.each(function(value, index) {
-      result = result && !!iterator(value, index);
-      if (!result) throw $break;
-    });
-    return result;
-  },
-
-  any: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = false;
-    this.each(function(value, index) {
-      if (result = !!iterator(value, index))
-        throw $break;
-    });
-    return result;
-  },
-
-  collect: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-    this.each(function(value, index) {
-      results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  detect: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var result;
-    this.each(function(value, index) {
-      if (iterator(value, index)) {
-        result = value;
-        throw $break;
-      }
-    });
-    return result;
-  },
-
-  findAll: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  grep: function(filter, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-
-    if (Object.isString(filter))
-      filter = new RegExp(filter);
-
-    this.each(function(value, index) {
-      if (filter.match(value))
-        results.push(iterator(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) {
-    iterator = iterator.bind(context);
-    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, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == null || value >= result)
-        result = value;
-    });
-    return result;
-  },
-
-  min: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == null || value < result)
-        result = value;
-    });
-    return result;
-  },
-
-  partition: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var trues = [], falses = [];
-    this.each(function(value, index) {
-      (iterator(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) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (!iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  sortBy: function(iterator, context) {
-    iterator = iterator.bind(context);
-    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 (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 [];
-    if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
-        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) {
-    $R(0, this, true).each(iterator);
-    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) {
-      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.map(function(pair) {
-        var key = encodeURIComponent(pair.key), values = pair.value;
-
-        if (values && typeof values == 'object') {
-          if (Object.isArray(values))
-            return values.map(toQueryPair.curry(key)).join('&');
-        }
-        return toQueryPair(key, values);
-      }).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 || { });
-}).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).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, 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(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);
-    var originalAncestor = ancestor;
-
-    if (element.compareDocumentPosition)
-      return (element.compareDocumentPosition(ancestor) & 8) === 8;
-
-    if (element.sourceIndex && !Prototype.Browser.Opera) {
-      var e = element.sourceIndex, a = ancestor.sourceIndex,
-       nextAncestor = ancestor.nextSibling;
-      if (!nextAncestor) {
-        do { ancestor = ancestor.parentNode; }
-        while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
-      }
-      if (nextAncestor && nextAncestor.sourceIndex)
-       return (e > a && e < nextAncestor.sourceIndex);
-    }
-
-    while (element = element.parentNode)
-      if (element == originalAncestor) 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) {
-      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 (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.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 == '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;
-    // 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;
-    // 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 == '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);
-      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);
-        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.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').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 == '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, 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 = { };
-    var B = Prototype.Browser;
-    $w('width height').each(function(d) {
-      var D = d.capitalize();
-      dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
-        (B.Opera) ? document.body['client' + 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();
-    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(this.expression))
-      return false;
-
-    return true;
-  },
-
-  compileMatcher: function() {
-    if (this.shouldUseXPath())
-      return this.compileXPathMatcher();
-
-    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;
-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    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 or translate(text(), ' \t\r\n', '') = '')]",
-      'checked':     "[@checked]",
-      'disabled':    "[@disabled]",
-      'enabled':     "[not(@disabled)]",
-      '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()

<TRUNCATED>

[36/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.min.js b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.min.js
deleted file mode 100644
index 1804319..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a){return a!=null&&!isNaN(a)}function k(a){return a.length}function l(a){return a==null}function m(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function o(a){var b={},c=[];return b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;return c.push({listener:a,on:!0}),b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}},b}function r(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function s(a){return a+""}function t(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3)
 );return d.reverse().join(",")+c}function v(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function A(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function B(a){return function(b){return 1-a(1-b)}}function C(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function D(a){return a}function E(a){return function(b){return Math.pow(b,a)}}function F(a){return 1-Math.cos(a*Math.PI/2)}function G(a){return Math.pow(2,10*(a-1))}function H(a){return 1-Math.sqrt(1-a*a)}function I(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function J(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function K(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function N(a){return a in M||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function O(a,b){return b=b-
 (a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function P(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function Q(a,b,c){return new R(a,b,c)}function R(a,b,c){this.r=a,this.g=b,this.b=c}function S(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function T(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(V(h[0]),V(h[1]),V(h[2]))}}return(i=W[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function U(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h
 =g=0,Y(g,h,i)}function V(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function Y(a,b,c){return new Z(a,b,c)}function Z(a,b,c){this.h=a,this.s=b,this.l=c}function $(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,Q(g(a+120),g(a),g(a-120))}function _(a){return h(a,bc),a}function bd(a){return function(){return ba(a,this)}}function be(a){return function(){return bb(a,this)}}function bg(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=m(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=m(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)
 ?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bh(a){return{__data__:a}}function bi(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bk(a){return h(a,bl),a}function bm(a,b,c){h(a,bq);var d={},e=d3.dispatch("start","end"),f=bt;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bu.call(a,b):(e[b].add(c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.dispatch.call(l,h,i),q(a
 )||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bs=b,e.end.dispatch.call(l,h,i),bs=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bo(a,b,c){return c!=""&&bn}function bp(a){function b(b,c,d){var e=a.call(this,b,c);return e==null?d!=""&&bn:d!=e&&d3.interpolate(d,e)}function c(b,c,d){return d!=a&&d3.interpolate(d,a)}return typeof a=="function"?b:a==null?bo:(a+="",c)}function bu(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function by(){var a,b=Date.now(),c=bv;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bz()-b;d>24?(isFinite(d)&&(clearTimeout(bx),bx=setTimeout(by,d)),bw=0):(bw=1,bA(by))}function bz(){var 
 a=null,b=bv,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bv=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bB(){}function bC(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bD(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bE(){return Math}function bF(a,b,c,d){function g(){var g=a.length==2?bL:bM,i=d?P:O;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return bJ(a,b)},h.tickFormat=function(b){return bK(a,b)},h.nice=function(){return bD(a,bH),g()},h
 .copy=function(){return bF(a,b,c,d)},g()}function bG(a,b){return a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp),a}function bH(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bI(a,b){var c=bC(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function bJ(a,b){return d3.range.apply(d3,bI(a,b))}function bK(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bI(a,b)[2])/Math.LN10+.01))+"f")}function bL(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bM(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c]
 (e[c](b))}}function bN(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=function(e){return arguments.length?(b=e[0]<0?bQ:bP,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bD(a.domain(),bE)),d},d.ticks=function(){var d=bC(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=Math.round(c(d[0])),i=Math.round(c(d[1]));if(b===bQ){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=bO);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===bQ?(h=-1e-15,Math.floor):(h=1e-15,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return bN(a.copy(),b)},bG(d,a)}function bP(a){return Math.log(a)/Math.LN10}function bQ(a){return-Math.log(-a)/Mat
 h.LN10}function bR(a,b){function e(b){return a(c(b))}var c=bS(b),d=bS(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return bJ(e.domain(),a)},e.tickFormat=function(a){return bK(e.domain(),a)},e.nice=function(){return e.domain(bD(e.domain(),bH))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=bS(b=a),d=bS(1/b),e.domain(f)},e.copy=function(){return bR(a.copy(),b)},bG(e,a)}function bS(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bT(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/
 (a.length-1+g);return d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g},f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);return d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g},f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;return d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g},f},f.rangeBand=function(){return e},f.copy=function(){return bT(a,b)},f.domain(a)}function bY(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return bY(a,b)},d()}f
 unction bZ(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return bZ(a,b,c)},g()}function ca(a){return a.innerRadius}function cb(a){return a.outerRadius}function cc(a){return a.startAngle}function cd(a){return a.endAngle}function ce(a){function g(d){return d.length<1?null:"M"+e(a(cf(this,d,b,c)),f)}var b=cg,c=ch,d="linear",e=ci[d],f=.7;return g.x=function(a){return arguments.length?(b=a,g):b},g.y=function(a){return arguments.length?(c=a,g):c},g.interpolate=function(a){return arguments.length?(e=ci[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function cf(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while
 (++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cg(a){return a[0]}function ch(a){return a[1]}function cj(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function ck(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cl(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cm(a,b){return a.length<4?cj(a):a[1]+cp(a.slice(1,a.length-1),cq(a,b))}function cn(a,b){return a.length<3?cj(a):a[0]+cp((a.push(a[0]),a),cq([a[a.length-2]].concat(a,[a[1]]),b))}function co(a,b,c){return a.length<3?cj(a):a[0]+cp(a,cq(a,b))}function cp(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cj(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+"
 ,"+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cq(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cr(a){if(a.length<3)return cj(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cz(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cz(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cz(i,g,h);return i.join("")}function cs(a){if(a.length<4)return cj(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cv(cy,f)+","+cv(cy,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),c
 z(b,f,g);return b.join("")}function ct(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cv(cy,g),",",cv(cy,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cz(b,g,h);return b.join("")}function cu(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cr(a)}function cv(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cz(a,b,c){a.push("C",cv(cw,b),",",cv(cw,c),",",cv(cx,b),",",cv(cx,c),",",cv(cy,b),",",cv(cy,c))}function cA(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cB(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cA(e,f);while(++b<c)d[b]=g+(g=cA(e=f,f=a[b+1]));return d[b]=g,d}function cC(a){var b=[],c,d,e,f,g=cB(a),h=-1,i=a.length-1;while(++h<i)c=cA(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Mat
 h.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cD(a){return a.length<3?cj(a):a[0]+cp(a,cC(a))}function cE(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+b$,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cF(a){function j(f){if(f.length<1)return null;var j=cf(this,f,b,d),k=cf(this,f,b===c?cG(j):c,d===e?cH(j):e);return"M"+g(a(k),i)+"L"+h(a(j.reverse()),i)+"Z"}var b=cg,c=cg,d=0,e=ch,f,g,h,i=.7;return j.x=function(a){return arguments.length?(b=c=a,j):c},j.x0=function(a){return arguments.length?(b=a,j):b},j.x1=function(a){return arguments.length?(c=a,j):c},j.y=function(a){return arguments.length?(d=e=a,j):e},j.y0=function(a){return arguments.length?(d=a,j):d},j.y1=function(a){return arguments.length?(e=a,j):e},j.interpolate=function(a){return arguments.length?(g=ci[f=a],h=g.reverse||g,j):f},j.tension=function(a){return arguments.length?(i=a,j):i},j.interpolate("linear")}function cG(a){return function(b,c){return
  a[c][0]}}function cH(a){return function(b,c){return a[c][1]}}function cI(a){return a.source}function cJ(a){return a.target}function cK(a){return a.radius}function cL(a){return a.startAngle}function cM(a){return a.endAngle}function cN(a){return[a.x,a.y]}function cO(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+b$;return[c*Math.cos(d),c*Math.sin(d)]}}function cQ(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cP<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cP=!e.f&&!e.e,d.remove()}return cP?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse()),[c.x,c.y]}function cR(){return 64}function cS(){return"circle"}function cW(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cX(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cY(a,b,c){e=[];
 if(c&&b.length>1){var d=bC(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function de(a){var b=d3.event,c=c_.parentNode,d=0,e=0;c&&(c=df(c),d=c[0]-db[0],e=c[1]-db[1],db=c,dc|=d|e);try{d3.event={dx:d,dy:e},cZ[a].dispatch.apply(c_,da)}finally{d3.event=b}b.preventDefault()}function df(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function dg(){if(!c_)return;var a=c_.parentNode;if(!a)return dh();de("drag"),dj()}function dh(){if(!c_)return;de("dragend"),c_=null,dc&&c$===d3.event.target&&(dd=!0,dj())}function di(){dd&&c$===d3.event.target&&(dj(),dd=!1,c$=null)}function dj(){d3.event.stopPropagation(),d3.event.preventDefault()}function dx(a){return[a[0]-dq[0],a[1]-dq[1],dq[2]]}function dy(){dk||(dk=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").sty
 le("height","2000px").node().parentNode);var a=d3.event,b;try{dk.scrollTop=1e3,dk.dispatchEvent(a),b=1e3-dk.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dz(){var a=d3.svg.touches(dt),b=-1,c=a.length,d;while(++b<c)dn[(d=a[b]).identifier]=dx(d);return a}function dA(){var a=d3.svg.touches(dt);switch(a.length){case 1:var b=a[0];dE(dq[2],b,dn[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dn[c.identifier],g=dn[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dE(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dB(){dm=null,dl&&(dv=!0,dE(dq[2],d3.svg.mouse(dt),dl))}function dC(){dl&&(dv&&ds===d3.event.target&&(dw=!0),dB(),dl=null)}function dD(){dw&&ds===d3.event.target&&(d3.event.stopPropagation(),d3.event.preventDefault(),dw=!1,ds=null)}function dE(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dq[2]=a)-c[2]),e
 =dq[0]=b[0]-d*c[0],f=dq[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dr.apply(dt,du)}finally{d3.event=g}g.preventDefault()}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.4.6"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(
 ++f<c)j(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)j(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(j),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=functio
 n(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,k),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m
 [k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=l);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(
 e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(n,"\\$&")};var n=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualF
 ragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=o(c);return b},d3.format=function(a){var b=p.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=q[i]||s,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h)
 ;a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=t(a)),a=b+a}else{g&&(a=t(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var p=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,q={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=r(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},u=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(v);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,r(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),u[8+c/3]};var w=E(2),x=E(3),y={linear:function(){return D},poly:E,quad:function(){return w},cubic:function(){return x},sin:function(){return F},exp:function(){return G},circle:function(){return H},elastic:I,back:J,bounce
 :function(){return K}},z={"in":function(a){return a},out:B,"in-out":C,"out-in":function(a){return C(B(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return A(z[d](y[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;L.lastIndex=0;for(d=0;c=L.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=L.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=L.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);fo
 r(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+S(Math.round(c+f*a))+S(Math.round(d+g*a))+S(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return $(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return 
 function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=N(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var L=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,M={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in W||/^(#|rgb\(|hsl\()/.test(b):b instanceof R||b instanceof Z)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof R?Q(a.r,a.g,a.b):T(""+a,Q,$):Q(~~a,~~b,~~c)},R.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?Q(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&
 &(d=e),Q(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},R.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),Q(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},R.prototype.hsl=function(){return U(this.r,this.g,this.b)},R.prototype.toString=function(){return"#"+S(this.r)+S(this.g)+S(this.b)};var W={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"
 #9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",l
 ightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#8
 7ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var X in W)W[X]=T(W[X],Q,$);d3.hsl=function(a,b,c){return arguments.length===1?a instanceof Z?Y(a.h,a.s,a.l):T(""+a,U,Y):Y(+a,+b,+c)},Z.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),Y(this.h,this.s,this.l/a)},Z.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),Y(this.h,this.s,a*this.l)},Z.prototype.rgb=function(){return $(this.h,this.s,this.l)},Z.prototype.toString=function(){return this.rgb().toString()};var ba=function(a,b){return b.querySelector(a)},bb=function(a,b){return b.querySelectorAll
-(a)};typeof Sizzle=="function"&&(ba=function(a,b){return Sizzle(a,b)[0]},bb=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var bc=[];d3.selection=function(){return bj},d3.selection.prototype=bc,bc.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bd(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return _(b)},bc.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=be(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return _(b)},bc.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):thi
 s.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bc.classed=function(a,b){var c=a.split(bf),d=c.length,e=-1;if(arguments.length>1){while(++e<d)bg.call(this,c[e],b);return this}while(++e<d)if(!bg.call(this,c[e]))return!1;return!0};var bf=/\s+/g;bc.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bc.property=function(a,b){function c(){delete this[a]}funct
 ion d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bc.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},bc.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},bc.append=function(a){function b(){return this.appendChild(document.createElement(a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bc.insert=function(a,b){function c(){return this.insertBefore(document.createElement(a),ba(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),ba(b,this))}return a=d3.ns.qualify(a),this.select
 (a.local?d:c)},bc.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bc.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bh(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bh(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bh(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=_(d);return j.enter=function(){return bk(c)},j.exit=function(
 ){return _(e)},j},bc.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return _(b)},bc.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},bc.sort=function(a){a=bi.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},bc.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bc.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e
 ];g&&a.call(g,g.__data__,e,b)}return this},bc.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bc.empty=function(){return!this.node()},bc.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bc.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bm(a,bs||++br,Date.now())};var bj=_([[document]]);bj[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bj.select(a):_([[a]])},d3.selectAll=function(a){return typeof a=="string"?bj.selectAll(a):_([d(a)])};var bl=[];bl.append=bc.append,bl.insert=bc.insert,bl.empty=bc.empty,bl.node=bc.node,bl.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a
 .call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return _(b)};var bn={},bq=[],br=0,bs=0,bt=d3.ease("cubic-in-out");bq.call=bc.call,d3.transition=function(){return bj.transition()},d3.transition.prototype=bq,bq.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bd(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bm(b,this.id,this.time).ease(this.ease())},bq.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=be(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bm(b,this.id,this.time).ease(this.ease())},bq.attr=function(a,b){return this.attrTween(a,bp(b))},bq.
 attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bn?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bn?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bq.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bp(b),c)},bq.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bn?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bq.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bq.remove=function(){return this.each("end",function(){var a;!this.__transition_
 _&&(a=this.parentNode)&&a.removeChild(this)})},bq.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bq.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bq.transition=function(){return this.select(i)};var bv=null,bw,bx;d3.timer=function(a,b,c){var d=!1,e,f=bv;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bv={callback:a,then:c,delay:b,next:bv}),bw||(bx=clearTimeout(bx),bw=1,bA(by))},d3.timer.flush=function(){var a,b=Date.now(),c=bv;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bz()};var bA=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window
 .msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bF([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bN(d3.scale.linear(),bP)};var bO=d3.format("e");bP.pow=function(a){return Math.pow(10,a)},bQ.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bR(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bT([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bU)},d3.scale.category20=function(){return d3.scale.ordinal().range(bV)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bW)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bX)};var bU=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bV=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#
 f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bW=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bX=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bY([],[])},d3.scale.quantize=function(){return bZ(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+b$,h=d.apply(this,arguments)+b$,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=b_?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+"
 ,"+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=ca,b=cb,c=cc,d=cd;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+b$;return[Math.cos(f)*e,Math.sin(f)*e]},e};var b$=-Math.PI/2,b_=2*Math.PI-1e-6;d3.svg.line=function(){return ce(Object)};var ci={linear:cj,"step-before":ck,"step-after":cl,basis:cr,"basis-open":cs,"basis-closed":ct,bundle:cu,cardinal:co,"cardinal-open":cm,"cardinal-closed":cn,monotone:cD},cw=[0,2/3,1/3,0],cx=[0,1
 /3,2/3,0],cy=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=ce(cE);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},ck.reverse=cl,cl.reverse=ck,d3.svg.area=function(){return cF(Object)},d3.svg.area.radial=function(){var a=cF(cE);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+b$,k=e.call(a,h,g)+b$;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cI,b=cJ,c=cK,d=cc,e=cd;return f.radius=function(a){return arguments.le
 ngth?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cI,b=cJ,c=cN;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cN,c=a.projection;return a.projection=function(a){return arguments.length?c(cO(b=a)):b},a},d3.svg.mouse=function(a){return cQ(a,d3.event)};var cP=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b
 =d3.event.touches;return b?d(b).map(function(b){var c=cQ(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(cT[a.call(this,c,d)]||cT.circle)(b.call(this,c,d))}var a=cS,b=cR;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var cT={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cV)),c=b*cV;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cU),c=b*cU/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.
 sqrt(a/cU),c=b*cU/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cT);var cU=Math.sqrt(3),cV=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bs;try{return bs=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bs=b}}:Object,p=a.ticks.apply(a,g),q=h==null?a.tickFormat.apply(a,g):h,r=cY(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("svg:g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bC(a.range()),C=n.selectAll(".domain").data([0]),D=C.enter().append("svg:path").attr("class","domain"),E=o(C),F=this.__chart__||a;this.__chart__=a.copy(),x.append("svg:line").attr("class","
 tick"),x.append("svg:text"),z.select("text").text(q);switch(b){case"bottom":A=cW,v.attr("x2",0).attr("y2",d),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[1]+"V"+e);break;case"top":A=cW,v.attr("x2",0).attr("y2",-d),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[1]+"V"+ -e);break;case"left":A=cX,v.attr("x2",-d).attr("y2",0),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[1]+"H"+ -e);break;case"right":A=cX,v.attr("x2",d).attr("y2",0),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d"
 ,"M"+e+","+B[0]+"H0V"+B[1]+"H"+e)}x.call(A,F),z.call(A,a),y.call(A,a),t.call(A,F),v.call(A,a),u.call(A,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.behavior={},d3.behavior.drag=function(){function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",dg).on("touchmove.drag",dg).on("mouseup.drag",dh,!0).on("touchend.drag",dh,!0).on("click.drag",di,!0)}function c(){cZ=a,c$=d3.event.target,db=df((c_=this).parentNode),dc=0,da=argum
 ents}function d(){c.apply(this,arguments),de("dragstart")}var a=d3.dispatch("drag","dragstart","dragend");return b.on=function(c,d){return a[c].add(d),b},b};var cZ,c$,c_,da,db,dc,dd;d3.behavior.zoom=function(){function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dB).on("mouseup.zoom",dC).on("touchmove.zoom",dA).on("touchend.zoom",dz).on("click.zoom",dD,!0)}function d(){dq=a,dr=b.zoom.dispatch,ds=d3.event.target,dt=this,du=arguments}function e(){d.apply(this,arguments),dl=dx(d3.svg.mouse(dt)),dv=!1,d3.event.preventDefault(),window.focus()}function f(){d.apply(this,arguments),dm||(dm=dx(d3.svg.mouse(dt))),dE(dy()+a[2],d3.svg.mouse(dt),dm)}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dt);dE(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dx(b))}function h(){d.apply(this,arguments);var b=dz(),c,e=Date.now();b.length===1&&e-dp<300&&dE(1+Math.floo
 r(a[2]),c=b[0],dn[c.identifier]),dp=e}var a=[0,0,0],b=d3.dispatch("zoom");return c.on=function(a,d){return b[a].add(d),c},c};var dk,dl,dm,dn={},dp=0,dq,dr,ds,dt,du,dv,dw})();
\ No newline at end of file


[18/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.js b/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.js
deleted file mode 100644
index 104d077..0000000
--- a/platform/marmotta-ldpath/src/main/resources/web/cm/codemirror.js
+++ /dev/null
@@ -1,3241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-
-// CodeMirror is the only global var we claim
-var CodeMirror = (function() {
-  "use strict";
-  // This is the function that produces an editor instance. Its
-  // closure is used to store the editor state.
-  function CodeMirror(place, givenOptions) {
-    // Determine effective options based on given values and defaults.
-    var options = {}, defaults = CodeMirror.defaults;
-    for (var opt in defaults)
-      if (defaults.hasOwnProperty(opt))
-        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
-
-    var input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em");
-    input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
-    // Wraps and hides input textarea
-    var inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
-    // The empty scrollbar content, used solely for managing the scrollbar thumb.
-    var scrollbarInner = elt("div", null, "CodeMirror-scrollbar-inner");
-    // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself.
-    var scrollbar = elt("div", [scrollbarInner], "CodeMirror-scrollbar");
-    // DIVs containing the selection and the actual code
-    var lineDiv = elt("div"), selectionDiv = elt("div", null, null, "position: relative; z-index: -1");
-    // Blinky cursor, and element used to ensure cursor fits at the end of a line
-    var cursor = elt("pre", "\u00a0", "CodeMirror-cursor"), widthForcer = elt("pre", "\u00a0", "CodeMirror-cursor", "visibility: hidden");
-    // Used to measure text size
-    var measure = elt("div", null, null, "position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;");
-    var lineSpace = elt("div", [measure, cursor, widthForcer, selectionDiv, lineDiv], null, "position: relative; z-index: 0");
-    var gutterText = elt("div", null, "CodeMirror-gutter-text"), gutter = elt("div", [gutterText], "CodeMirror-gutter");
-    // Moved around its parent to cover visible view
-    var mover = elt("div", [gutter, elt("div", [lineSpace], "CodeMirror-lines")], null, "position: relative");
-    // Set to the height of the text, causes scrolling
-    var sizer = elt("div", [mover], null, "position: relative");
-    // Provides scrolling
-    var scroller = elt("div", [sizer], "CodeMirror-scroll");
-    scroller.setAttribute("tabIndex", "-1");
-    // The element in which the editor lives.
-    var wrapper = elt("div", [inputDiv, scrollbar, scroller], "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : ""));
-    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
-
-    themeChanged(); keyMapChanged();
-    // Needed to hide big blue blinking cursor on Mobile Safari
-    if (ios) input.style.width = "0px";
-    if (!webkit) scroller.draggable = true;
-    lineSpace.style.outline = "none";
-    if (options.tabindex != null) input.tabIndex = options.tabindex;
-    if (options.autofocus) focusInput();
-    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
-    // Needed to handle Tab key in KHTML
-    if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
-
-    // Check for OS X >= 10.7. This has transparent scrollbars, so the
-    // overlaying of one scrollbar with another won't work. This is a
-    // temporary hack to simply turn off the overlay scrollbar. See
-    // issue #727.
-    if (mac_geLion) scrollbar.style.display = "none";
-    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
-    else if (ie_lt8) scrollbar.style.minWidth = "18px";
-
-    // Check for problem with IE innerHTML not working when we have a
-    // P (or similar) parent node.
-    try { charWidth(); }
-    catch (e) {
-      if (e.message.match(/runtime/i))
-        e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
-      throw e;
-    }
-
-    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
-    var poll = new Delayed(), highlight = new Delayed(), blinker;
-
-    // mode holds a mode API object. doc is the tree of Line objects,
-    // work an array of lines that should be parsed, and history the
-    // undo history (instance of History constructor).
-    var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;
-    loadMode();
-    // The selection. These are always maintained to point at valid
-    // positions. Inverted is used to remember that the user is
-    // selecting bottom-to-top.
-    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
-    // Selection-related flags. shiftSelecting obviously tracks
-    // whether the user is holding shift.
-    var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, draggingText,
-        overwrite = false, suppressEdits = false;
-    // Variables used by startOperation/endOperation to track what
-    // happened during the operation.
-    var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
-        gutterDirty, callbacks;
-    // Current visible range (may be bigger than the view window).
-    var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
-    // bracketHighlighted is used to remember that a bracket has been
-    // marked.
-    var bracketHighlighted;
-    // Tracks the maximum line length so that the horizontal scrollbar
-    // can be kept static when scrolling.
-    var maxLine = getLine(0), updateMaxLine = false, maxLineChanged = true;
-    var tabCache = {};
-    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
-    var goalColumn = null;
-
-    // Initialize the content.
-    operation(function(){setValue(options.value || ""); updateInput = false;})();
-    var history = new History();
-
-    // Register our event handlers.
-    connect(scroller, "mousedown", operation(onMouseDown));
-    connect(scroller, "dblclick", operation(onDoubleClick));
-    connect(lineSpace, "selectstart", e_preventDefault);
-    // Gecko browsers fire contextmenu *after* opening the menu, at
-    // which point we can't mess with it anymore. Context menu is
-    // handled in onMouseDown for Gecko.
-    if (!gecko) connect(scroller, "contextmenu", onContextMenu);
-    connect(scroller, "scroll", onScrollMain);
-    connect(scrollbar, "scroll", onScrollBar);
-    connect(scrollbar, "mousedown", function() {if (focused) setTimeout(focusInput, 0);});
-    var resizeHandler = connect(window, "resize", function() {
-      if (wrapper.parentNode) updateDisplay(true);
-      else resizeHandler();
-    }, true);
-    connect(input, "keyup", operation(onKeyUp));
-    connect(input, "input", fastPoll);
-    connect(input, "keydown", operation(onKeyDown));
-    connect(input, "keypress", operation(onKeyPress));
-    connect(input, "focus", onFocus);
-    connect(input, "blur", onBlur);
-
-    function drag_(e) {
-      if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
-      e_stop(e);
-    }
-    if (options.dragDrop) {
-      connect(scroller, "dragstart", onDragStart);
-      connect(scroller, "dragenter", drag_);
-      connect(scroller, "dragover", drag_);
-      connect(scroller, "drop", operation(onDrop));
-    }
-    connect(scroller, "paste", function(){focusInput(); fastPoll();});
-    connect(input, "paste", fastPoll);
-    connect(input, "cut", operation(function(){
-      if (!options.readOnly) replaceSelection("");
-    }));
-
-    // Needed to handle Tab key in KHTML
-    if (khtml) connect(sizer, "mouseup", function() {
-        if (document.activeElement == input) input.blur();
-        focusInput();
-    });
-
-    // IE throws unspecified error in certain cases, when
-    // trying to access activeElement before onload
-    var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
-    if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
-    else onBlur();
-
-    function isLine(l) {return l >= 0 && l < doc.size;}
-    // The instance object that we'll return. Mostly calls out to
-    // local functions in the CodeMirror function. Some do some extra
-    // range checking and/or clipping. operation is used to wrap the
-    // call so that changes it makes are tracked, and the display is
-    // updated afterwards.
-    var instance = wrapper.CodeMirror = {
-      getValue: getValue,
-      setValue: operation(setValue),
-      getSelection: getSelection,
-      replaceSelection: operation(replaceSelection),
-      focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},
-      setOption: function(option, value) {
-        var oldVal = options[option];
-        options[option] = value;
-        if (option == "mode" || option == "indentUnit") loadMode();
-        else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();}
-        else if (option == "readOnly" && !value) {resetInput(true);}
-        else if (option == "theme") themeChanged();
-        else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
-        else if (option == "tabSize") updateDisplay(true);
-        else if (option == "keyMap") keyMapChanged();
-        if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" ||
-            option == "theme" || option == "lineNumberFormatter") {
-          gutterChanged();
-          updateDisplay(true);
-        }
-      },
-      getOption: function(option) {return options[option];},
-      undo: operation(undo),
-      redo: operation(redo),
-      indentLine: operation(function(n, dir) {
-        if (typeof dir != "string") {
-          if (dir == null) dir = options.smartIndent ? "smart" : "prev";
-          else dir = dir ? "add" : "subtract";
-        }
-        if (isLine(n)) indentLine(n, dir);
-      }),
-      indentSelection: operation(indentSelected),
-      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
-      clearHistory: function() {history = new History();},
-      setHistory: function(histData) {
-        history = new History();
-        history.done = histData.done;
-        history.undone = histData.undone;
-      },
-      getHistory: function() {
-        history.time = 0;
-        return {done: history.done.concat([]), undone: history.undone.concat([])};
-      },
-      matchBrackets: operation(function(){matchBrackets(true);}),
-      getTokenAt: operation(function(pos) {
-        pos = clipPos(pos);
-        return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), options.tabSize, pos.ch);
-      }),
-      getStateAfter: function(line) {
-        line = clipLine(line == null ? doc.size - 1: line);
-        return getStateBefore(line + 1);
-      },
-      cursorCoords: function(start, mode) {
-        if (start == null) start = sel.inverted;
-        return this.charCoords(start ? sel.from : sel.to, mode);
-      },
-      charCoords: function(pos, mode) {
-        pos = clipPos(pos);
-        if (mode == "local") return localCoords(pos, false);
-        if (mode == "div") return localCoords(pos, true);
-        return pageCoords(pos);
-      },
-      coordsChar: function(coords) {
-        var off = eltOffset(lineSpace);
-        return coordsChar(coords.x - off.left, coords.y - off.top);
-      },
-      markText: operation(markText),
-      setBookmark: setBookmark,
-      findMarksAt: findMarksAt,
-      setMarker: operation(addGutterMarker),
-      clearMarker: operation(removeGutterMarker),
-      setLineClass: operation(setLineClass),
-      hideLine: operation(function(h) {return setLineHidden(h, true);}),
-      showLine: operation(function(h) {return setLineHidden(h, false);}),
-      onDeleteLine: function(line, f) {
-        if (typeof line == "number") {
-          if (!isLine(line)) return null;
-          line = getLine(line);
-        }
-        (line.handlers || (line.handlers = [])).push(f);
-        return line;
-      },
-      lineInfo: lineInfo,
-      getViewport: function() { return {from: showingFrom, to: showingTo};},
-      addWidget: function(pos, node, scroll, vert, horiz) {
-        pos = localCoords(clipPos(pos));
-        var top = pos.yBot, left = pos.x;
-        node.style.position = "absolute";
-        sizer.appendChild(node);
-        if (vert == "over") top = pos.y;
-        else if (vert == "near") {
-          var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),
-              hspace = Math.max(sizer.clientWidth, lineSpace.clientWidth) - paddingLeft();
-          if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
-            top = pos.y - node.offsetHeight;
-          if (left + node.offsetWidth > hspace)
-            left = hspace - node.offsetWidth;
-        }
-        node.style.top = (top + paddingTop()) + "px";
-        node.style.left = node.style.right = "";
-        if (horiz == "right") {
-          left = sizer.clientWidth - node.offsetWidth;
-          node.style.right = "0px";
-        } else {
-          if (horiz == "left") left = 0;
-          else if (horiz == "middle") left = (sizer.clientWidth - node.offsetWidth) / 2;
-          node.style.left = (left + paddingLeft()) + "px";
-        }
-        if (scroll)
-          scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
-      },
-
-      lineCount: function() {return doc.size;},
-      clipPos: clipPos,
-      getCursor: function(start) {
-        if (start == null) start = sel.inverted;
-        return copyPos(start ? sel.from : sel.to);
-      },
-      somethingSelected: function() {return !posEq(sel.from, sel.to);},
-      setCursor: operation(function(line, ch, user) {
-        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user);
-        else setCursor(line, ch, user);
-      }),
-      setSelection: operation(function(from, to, user) {
-        (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));
-      }),
-      getLine: function(line) {if (isLine(line)) return getLine(line).text;},
-      getLineHandle: function(line) {if (isLine(line)) return getLine(line);},
-      setLine: operation(function(line, text) {
-        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
-      }),
-      removeLine: operation(function(line) {
-        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
-      }),
-      replaceRange: operation(replaceRange),
-      getRange: function(from, to, lineSep) {return getRange(clipPos(from), clipPos(to), lineSep);},
-
-      triggerOnKeyDown: operation(onKeyDown),
-      execCommand: function(cmd) {return commands[cmd](instance);},
-      // Stuff used by commands, probably not much use to outside code.
-      moveH: operation(moveH),
-      deleteH: operation(deleteH),
-      moveV: operation(moveV),
-      toggleOverwrite: function() {
-        if(overwrite){
-          overwrite = false;
-          cursor.className = cursor.className.replace(" CodeMirror-overwrite", "");
-        } else {
-          overwrite = true;
-          cursor.className += " CodeMirror-overwrite";
-        }
-      },
-
-      posFromIndex: function(off) {
-        var lineNo = 0, ch;
-        doc.iter(0, doc.size, function(line) {
-          var sz = line.text.length + 1;
-          if (sz > off) { ch = off; return true; }
-          off -= sz;
-          ++lineNo;
-        });
-        return clipPos({line: lineNo, ch: ch});
-      },
-      indexFromPos: function (coords) {
-        if (coords.line < 0 || coords.ch < 0) return 0;
-        var index = coords.ch;
-        doc.iter(0, coords.line, function (line) {
-          index += line.text.length + 1;
-        });
-        return index;
-      },
-      scrollTo: function(x, y) {
-        if (x != null) scroller.scrollLeft = x;
-        if (y != null) scrollbar.scrollTop = scroller.scrollTop = y;
-        updateDisplay([]);
-      },
-      getScrollInfo: function() {
-        return {x: scroller.scrollLeft, y: scrollbar.scrollTop,
-                height: scrollbar.scrollHeight, width: scroller.scrollWidth};
-      },
-      setSize: function(width, height) {
-        function interpret(val) {
-          val = String(val);
-          return /^\d+$/.test(val) ? val + "px" : val;
-        }
-        if (width != null) wrapper.style.width = interpret(width);
-        if (height != null) scroller.style.height = interpret(height);
-        instance.refresh();
-      },
-
-      operation: function(f){return operation(f)();},
-      compoundChange: function(f){return compoundChange(f);},
-      refresh: function(){
-        updateDisplay(true, null, lastScrollTop);
-        if (scrollbar.scrollHeight > lastScrollTop)
-          scrollbar.scrollTop = lastScrollTop;
-      },
-      getInputField: function(){return input;},
-      getWrapperElement: function(){return wrapper;},
-      getScrollerElement: function(){return scroller;},
-      getGutterElement: function(){return gutter;}
-    };
-
-    function getLine(n) { return getLineAt(doc, n); }
-    function updateLineHeight(line, height) {
-      gutterDirty = true;
-      var diff = height - line.height;
-      for (var n = line; n; n = n.parent) n.height += diff;
-    }
-
-    function setValue(code) {
-      var top = {line: 0, ch: 0};
-      updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},
-                  splitLines(code), top, top);
-      updateInput = true;
-    }
-    function getValue(lineSep) {
-      var text = [];
-      doc.iter(0, doc.size, function(line) { text.push(line.text); });
-      return text.join(lineSep || "\n");
-    }
-
-    function onScrollBar(e) {
-      if (scrollbar.scrollTop != lastScrollTop) {
-        lastScrollTop = scroller.scrollTop = scrollbar.scrollTop;
-        updateDisplay([]);
-      }
-    }
-
-    function onScrollMain(e) {
-      if (options.fixedGutter && gutter.style.left != scroller.scrollLeft + "px")
-        gutter.style.left = scroller.scrollLeft + "px";
-      if (scroller.scrollTop != lastScrollTop) {
-        lastScrollTop = scroller.scrollTop;
-        if (scrollbar.scrollTop != lastScrollTop)
-          scrollbar.scrollTop = lastScrollTop;
-        updateDisplay([]);
-      }
-      if (options.onScroll) options.onScroll(instance);
-    }
-
-    function onMouseDown(e) {
-      setShift(e_prop(e, "shiftKey"));
-      // Check whether this is a click in a widget
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == sizer && n != mover) return;
-
-      // See if this is a click in the gutter
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == gutterText) {
-          if (options.onGutterClick)
-            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
-          return e_preventDefault(e);
-        }
-
-      var start = posFromMouse(e);
-
-      switch (e_button(e)) {
-      case 3:
-        if (gecko) onContextMenu(e);
-        return;
-      case 2:
-        if (start) setCursor(start.line, start.ch, true);
-        setTimeout(focusInput, 20);
-        e_preventDefault(e);
-        return;
-      }
-      // For button 1, if it was clicked inside the editor
-      // (posFromMouse returning non-null), we have to adjust the
-      // selection.
-      if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
-
-      if (!focused) onFocus();
-
-      var now = +new Date, type = "single";
-      if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
-        type = "triple";
-        e_preventDefault(e);
-        setTimeout(focusInput, 20);
-        selectLine(start.line);
-      } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
-        type = "double";
-        lastDoubleClick = {time: now, pos: start};
-        e_preventDefault(e);
-        var word = findWordAt(start);
-        setSelectionUser(word.from, word.to);
-      } else { lastClick = {time: now, pos: start}; }
-
-      function dragEnd(e2) {
-        if (webkit) scroller.draggable = false;
-        draggingText = false;
-        up(); drop();
-        if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
-          e_preventDefault(e2);
-          setCursor(start.line, start.ch, true);
-          focusInput();
-        }
-      }
-      var last = start, going;
-      if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&
-          !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
-        // Let the drag handler handle this.
-        if (webkit) scroller.draggable = true;
-        var up = connect(document, "mouseup", operation(dragEnd), true);
-        var drop = connect(scroller, "drop", operation(dragEnd), true);
-        draggingText = true;
-        // IE's approach to draggable
-        if (scroller.dragDrop) scroller.dragDrop();
-        return;
-      }
-      e_preventDefault(e);
-      if (type == "single") setCursor(start.line, start.ch, true);
-
-      var startstart = sel.from, startend = sel.to;
-
-      function doSelect(cur) {
-        if (type == "single") {
-          setSelectionUser(start, cur);
-        } else if (type == "double") {
-          var word = findWordAt(cur);
-          if (posLess(cur, startstart)) setSelectionUser(word.from, startend);
-          else setSelectionUser(startstart, word.to);
-        } else if (type == "triple") {
-          if (posLess(cur, startstart)) setSelectionUser(startend, clipPos({line: cur.line, ch: 0}));
-          else setSelectionUser(startstart, clipPos({line: cur.line + 1, ch: 0}));
-        }
-      }
-
-      function extend(e) {
-        var cur = posFromMouse(e, true);
-        if (cur && !posEq(cur, last)) {
-          if (!focused) onFocus();
-          last = cur;
-          doSelect(cur);
-          updateInput = false;
-          var visible = visibleLines();
-          if (cur.line >= visible.to || cur.line < visible.from)
-            going = setTimeout(operation(function(){extend(e);}), 150);
-        }
-      }
-
-      function done(e) {
-        clearTimeout(going);
-        var cur = posFromMouse(e);
-        if (cur) doSelect(cur);
-        e_preventDefault(e);
-        focusInput();
-        updateInput = true;
-        move(); up();
-      }
-      var move = connect(document, "mousemove", operation(function(e) {
-        clearTimeout(going);
-        e_preventDefault(e);
-        if (!ie && !e_button(e)) done(e);
-        else extend(e);
-      }), true);
-      var up = connect(document, "mouseup", operation(done), true);
-    }
-    function onDoubleClick(e) {
-      for (var n = e_target(e); n != wrapper; n = n.parentNode)
-        if (n.parentNode == gutterText) return e_preventDefault(e);
-      e_preventDefault(e);
-    }
-    function onDrop(e) {
-      if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
-      e_preventDefault(e);
-      var pos = posFromMouse(e, true), files = e.dataTransfer.files;
-      if (!pos || options.readOnly) return;
-      if (files && files.length && window.FileReader && window.File) {
-        var n = files.length, text = Array(n), read = 0;
-        var loadFile = function(file, i) {
-          var reader = new FileReader;
-          reader.onload = function() {
-            text[i] = reader.result;
-            if (++read == n) {
-              pos = clipPos(pos);
-              operation(function() {
-                var end = replaceRange(text.join(""), pos, pos);
-                setSelectionUser(pos, end);
-              })();
-            }
-          };
-          reader.readAsText(file);
-        };
-        for (var i = 0; i < n; ++i) loadFile(files[i], i);
-      } else {
-        // Don't do a replace if the drop happened inside of the selected text.
-        if (draggingText && !(posLess(pos, sel.from) || posLess(sel.to, pos))) return;
-        try {
-          var text = e.dataTransfer.getData("Text");
-          if (text) {
-            compoundChange(function() {
-              var curFrom = sel.from, curTo = sel.to;
-              setSelectionUser(pos, pos);
-              if (draggingText) replaceRange("", curFrom, curTo);
-              replaceSelection(text);
-              focusInput();
-            });
-          }
-        }
-        catch(e){}
-      }
-    }
-    function onDragStart(e) {
-      var txt = getSelection();
-      e.dataTransfer.setData("Text", txt);
-
-      // Use dummy image instead of default browsers image.
-      if (gecko || chrome || opera) {
-        var img = elt('img');
-        img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image
-        e.dataTransfer.setDragImage(img, 0, 0);
-      }
-    }
-
-    function doHandleBinding(bound, dropShift) {
-      if (typeof bound == "string") {
-        bound = commands[bound];
-        if (!bound) return false;
-      }
-      var prevShift = shiftSelecting;
-      try {
-        if (options.readOnly) suppressEdits = true;
-        if (dropShift) shiftSelecting = null;
-        bound(instance);
-      } catch(e) {
-        if (e != Pass) throw e;
-        return false;
-      } finally {
-        shiftSelecting = prevShift;
-        suppressEdits = false;
-      }
-      return true;
-    }
-    var maybeTransition;
-    function handleKeyBinding(e) {
-      // Handle auto keymap transitions
-      var startMap = getKeyMap(options.keyMap), next = startMap.auto;
-      clearTimeout(maybeTransition);
-      if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
-        if (getKeyMap(options.keyMap) == startMap) {
-          options.keyMap = (next.call ? next.call(null, instance) : next);
-        }
-      }, 50);
-
-      var name = keyNames[e_prop(e, "keyCode")], handled = false;
-      if (name == null || e.altGraphKey) return false;
-      if (e_prop(e, "altKey")) name = "Alt-" + name;
-      if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
-      if (e_prop(e, "metaKey")) name = "Cmd-" + name;
-
-      var stopped = false;
-      function stop() { stopped = true; }
-
-      if (e_prop(e, "shiftKey")) {
-        handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
-                            function(b) {return doHandleBinding(b, true);}, stop)
-               || lookupKey(name, options.extraKeys, options.keyMap, function(b) {
-                 if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
-               }, stop);
-      } else {
-        handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);
-      }
-      if (stopped) handled = false;
-      if (handled) {
-        e_preventDefault(e);
-        restartBlink();
-        if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
-      }
-      return handled;
-    }
-    function handleCharBinding(e, ch) {
-      var handled = lookupKey("'" + ch + "'", options.extraKeys,
-                              options.keyMap, function(b) { return doHandleBinding(b, true); });
-      if (handled) {
-        e_preventDefault(e);
-        restartBlink();
-      }
-      return handled;
-    }
-
-    var lastStoppedKey = null;
-    function onKeyDown(e) {
-      if (!focused) onFocus();
-      if (ie && e.keyCode == 27) { e.returnValue = false; }
-      if (pollingFast) { if (readInput()) pollingFast = false; }
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      var code = e_prop(e, "keyCode");
-      // IE does strange things with escape.
-      setShift(code == 16 || e_prop(e, "shiftKey"));
-      // First give onKeyEvent option a chance to handle this.
-      var handled = handleKeyBinding(e);
-      if (opera) {
-        lastStoppedKey = handled ? code : null;
-        // Opera has no cut event... we try to at least catch the key combo
-        if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
-          replaceSelection("");
-      }
-    }
-    function onKeyPress(e) {
-      if (pollingFast) readInput();
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
-      if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
-      if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;
-      var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
-      if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
-        if (mode.electricChars.indexOf(ch) > -1)
-          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);
-      }
-      if (handleCharBinding(e, ch)) return;
-      fastPoll();
-    }
-    function onKeyUp(e) {
-      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-      if (e_prop(e, "keyCode") == 16) shiftSelecting = null;
-    }
-
-    function onFocus() {
-      if (options.readOnly == "nocursor") return;
-      if (!focused) {
-        if (options.onFocus) options.onFocus(instance);
-        focused = true;
-        if (scroller.className.search(/\bCodeMirror-focused\b/) == -1)
-          scroller.className += " CodeMirror-focused";
-        if (!leaveInputAlone) resetInput(true);
-      }
-      slowPoll();
-      restartBlink();
-    }
-    function onBlur() {
-      if (focused) {
-        if (options.onBlur) options.onBlur(instance);
-        focused = false;
-        if (bracketHighlighted)
-          operation(function(){
-            if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }
-          })();
-        scroller.className = scroller.className.replace(" CodeMirror-focused", "");
-      }
-      clearInterval(blinker);
-      setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
-    }
-
-    // Replace the range from from to to by the strings in newText.
-    // Afterwards, set the selection to selFrom, selTo.
-    function updateLines(from, to, newText, selFrom, selTo) {
-      if (suppressEdits) return;
-      if (history) {
-        var old = [];
-        doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });
-        history.addChange(from.line, newText.length, old);
-        while (history.done.length > options.undoDepth) history.done.shift();
-      }
-      updateLinesNoUndo(from, to, newText, selFrom, selTo);
-    }
-    function unredoHelper(from, to) {
-      if (!from.length) return;
-      var set = from.pop(), out = [];
-      for (var i = set.length - 1; i >= 0; i -= 1) {
-        var change = set[i];
-        var replaced = [], end = change.start + change.added;
-        doc.iter(change.start, end, function(line) { replaced.push(line.text); });
-        out.push({start: change.start, added: change.old.length, old: replaced});
-        var pos = {line: change.start + change.old.length - 1,
-                   ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])};
-        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
-      }
-      updateInput = true;
-      to.push(out);
-    }
-    function undo() {unredoHelper(history.done, history.undone);}
-    function redo() {unredoHelper(history.undone, history.done);}
-
-    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
-      if (suppressEdits) return;
-      var recomputeMaxLength = false, maxLineLength = maxLine.text.length;
-      if (!options.lineWrapping)
-        doc.iter(from.line, to.line + 1, function(line) {
-          if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
-        });
-      if (from.line != to.line || newText.length > 1) gutterDirty = true;
-
-      var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
-      // First adjust the line structure, taking some care to leave highlighting intact.
-      if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {
-        // This is a whole-line replace. Treated specially to make
-        // sure line objects move the way they are supposed to.
-        var added = [], prevLine = null;
-        if (from.line) {
-          prevLine = getLine(from.line - 1);
-          prevLine.fixMarkEnds(lastLine);
-        } else lastLine.fixMarkStarts();
-        for (var i = 0, e = newText.length - 1; i < e; ++i)
-          added.push(Line.inheritMarks(newText[i], prevLine));
-        if (nlines) doc.remove(from.line, nlines, callbacks);
-        if (added.length) doc.insert(from.line, added);
-      } else if (firstLine == lastLine) {
-        if (newText.length == 1)
-          firstLine.replace(from.ch, to.ch, newText[0]);
-        else {
-          lastLine = firstLine.split(to.ch, newText[newText.length-1]);
-          firstLine.replace(from.ch, null, newText[0]);
-          firstLine.fixMarkEnds(lastLine);
-          var added = [];
-          for (var i = 1, e = newText.length - 1; i < e; ++i)
-            added.push(Line.inheritMarks(newText[i], firstLine));
-          added.push(lastLine);
-          doc.insert(from.line + 1, added);
-        }
-      } else if (newText.length == 1) {
-        firstLine.replace(from.ch, null, newText[0]);
-        lastLine.replace(null, to.ch, "");
-        firstLine.append(lastLine);
-        doc.remove(from.line + 1, nlines, callbacks);
-      } else {
-        var added = [];
-        firstLine.replace(from.ch, null, newText[0]);
-        lastLine.replace(null, to.ch, newText[newText.length-1]);
-        firstLine.fixMarkEnds(lastLine);
-        for (var i = 1, e = newText.length - 1; i < e; ++i)
-          added.push(Line.inheritMarks(newText[i], firstLine));
-        if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);
-        doc.insert(from.line + 1, added);
-      }
-      if (options.lineWrapping) {
-        var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);
-        doc.iter(from.line, from.line + newText.length, function(line) {
-          if (line.hidden) return;
-          var guess = Math.ceil(line.text.length / perLine) || 1;
-          if (guess != line.height) updateLineHeight(line, guess);
-        });
-      } else {
-        doc.iter(from.line, from.line + newText.length, function(line) {
-          var l = line.text;
-          if (!line.hidden && l.length > maxLineLength) {
-            maxLine = line; maxLineLength = l.length; maxLineChanged = true;
-            recomputeMaxLength = false;
-          }
-        });
-        if (recomputeMaxLength) updateMaxLine = true;
-      }
-
-      // Add these lines to the work array, so that they will be
-      // highlighted. Adjust work lines if lines were added/removed.
-      var newWork = [], lendiff = newText.length - nlines - 1;
-      for (var i = 0, l = work.length; i < l; ++i) {
-        var task = work[i];
-        if (task < from.line) newWork.push(task);
-        else if (task > to.line) newWork.push(task + lendiff);
-      }
-      var hlEnd = from.line + Math.min(newText.length, 500);
-      highlightLines(from.line, hlEnd);
-      newWork.push(hlEnd);
-      work = newWork;
-      startWorker(100);
-      // Remember that these lines changed, for updating the display
-      changes.push({from: from.line, to: to.line + 1, diff: lendiff});
-      var changeObj = {from: from, to: to, text: newText};
-      if (textChanged) {
-        for (var cur = textChanged; cur.next; cur = cur.next) {}
-        cur.next = changeObj;
-      } else textChanged = changeObj;
-
-      // Update the selection
-      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
-      setSelection(clipPos(selFrom), clipPos(selTo),
-                   updateLine(sel.from.line), updateLine(sel.to.line));
-    }
-
-    function needsScrollbar() {
-      var realHeight = doc.height * textHeight() + 2 * paddingTop();
-      return realHeight - 1 > scroller.offsetHeight ? realHeight : false;
-    }
-
-    function updateVerticalScroll(scrollTop) {
-      var scrollHeight = needsScrollbar();
-      scrollbar.style.display = scrollHeight ? "block" : "none";
-      if (scrollHeight) {
-        scrollbarInner.style.height = sizer.style.minHeight = scrollHeight + "px";
-        scrollbar.style.height = scroller.clientHeight + "px";
-        if (scrollTop != null) {
-          scrollbar.scrollTop = scroller.scrollTop = scrollTop;
-          // 'Nudge' the scrollbar to work around a Webkit bug where,
-          // in some situations, we'd end up with a scrollbar that
-          // reported its scrollTop (and looked) as expected, but
-          // *behaved* as if it was still in a previous state (i.e.
-          // couldn't scroll up, even though it appeared to be at the
-          // bottom).
-          if (webkit) setTimeout(function() {
-            if (scrollbar.scrollTop != scrollTop) return;
-            scrollbar.scrollTop = scrollTop + (scrollTop ? -1 : 1);
-            scrollbar.scrollTop = scrollTop;
-          }, 0);
-        }
-      } else {
-        sizer.style.minHeight = "";
-      }
-      // Position the mover div to align with the current virtual scroll position
-      mover.style.top = displayOffset * textHeight() + "px";
-    }
-
-    function computeMaxLength() {
-      maxLine = getLine(0); maxLineChanged = true;
-      var maxLineLength = maxLine.text.length;
-      doc.iter(1, doc.size, function(line) {
-        var l = line.text;
-        if (!line.hidden && l.length > maxLineLength) {
-          maxLineLength = l.length; maxLine = line;
-        }
-      });
-      updateMaxLine = false;
-    }
-
-    function replaceRange(code, from, to) {
-      from = clipPos(from);
-      if (!to) to = from; else to = clipPos(to);
-      code = splitLines(code);
-      function adjustPos(pos) {
-        if (posLess(pos, from)) return pos;
-        if (!posLess(to, pos)) return end;
-        var line = pos.line + code.length - (to.line - from.line) - 1;
-        var ch = pos.ch;
-        if (pos.line == to.line)
-          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
-        return {line: line, ch: ch};
-      }
-      var end;
-      replaceRange1(code, from, to, function(end1) {
-        end = end1;
-        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
-      });
-      return end;
-    }
-    function replaceSelection(code, collapse) {
-      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
-        if (collapse == "end") return {from: end, to: end};
-        else if (collapse == "start") return {from: sel.from, to: sel.from};
-        else return {from: sel.from, to: end};
-      });
-    }
-    function replaceRange1(code, from, to, computeSel) {
-      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
-      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
-      updateLines(from, to, code, newSel.from, newSel.to);
-    }
-
-    function getRange(from, to, lineSep) {
-      var l1 = from.line, l2 = to.line;
-      if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
-      var code = [getLine(l1).text.slice(from.ch)];
-      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
-      code.push(getLine(l2).text.slice(0, to.ch));
-      return code.join(lineSep || "\n");
-    }
-    function getSelection(lineSep) {
-      return getRange(sel.from, sel.to, lineSep);
-    }
-
-    function slowPoll() {
-      if (pollingFast) return;
-      poll.set(options.pollInterval, function() {
-        startOperation();
-        readInput();
-        if (focused) slowPoll();
-        endOperation();
-      });
-    }
-    function fastPoll() {
-      var missed = false;
-      pollingFast = true;
-      function p() {
-        startOperation();
-        var changed = readInput();
-        if (!changed && !missed) {missed = true; poll.set(60, p);}
-        else {pollingFast = false; slowPoll();}
-        endOperation();
-      }
-      poll.set(20, p);
-    }
-
-    // Previnput is a hack to work with IME. If we reset the textarea
-    // on every change, that breaks IME. So we look for changes
-    // compared to the previous content instead. (Modern browsers have
-    // events that indicate IME taking place, but these are not widely
-    // supported or compatible enough yet to rely on.)
-    var prevInput = "";
-    function readInput() {
-      if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;
-      var text = input.value;
-      if (text == prevInput) return false;
-      shiftSelecting = null;
-      var same = 0, l = Math.min(prevInput.length, text.length);
-      while (same < l && prevInput[same] == text[same]) ++same;
-      if (same < prevInput.length)
-        sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
-      else if (overwrite && posEq(sel.from, sel.to))
-        sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
-      replaceSelection(text.slice(same), "end");
-      if (text.length > 1000) { input.value = prevInput = ""; }
-      else prevInput = text;
-      return true;
-    }
-    function resetInput(user) {
-      if (!posEq(sel.from, sel.to)) {
-        prevInput = "";
-        input.value = getSelection();
-        selectInput(input);
-      } else if (user) prevInput = input.value = "";
-    }
-
-    function focusInput() {
-      if (options.readOnly != "nocursor") input.focus();
-    }
-
-    function scrollCursorIntoView() {
-      var coords = calculateCursorCoords();
-      scrollIntoView(coords.x, coords.y, coords.x, coords.yBot);
-    }
-    function calculateCursorCoords() {
-      var cursor = localCoords(sel.inverted ? sel.from : sel.to);
-      var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
-      return {x: x, y: cursor.y, yBot: cursor.yBot};
-    }
-    function scrollIntoView(x1, y1, x2, y2) {
-      var scrollPos = calculateScrollPos(x1, y1, x2, y2);
-      if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft;}
-      if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scroller.scrollTop = scrollPos.scrollTop;}
-    }
-    function calculateScrollPos(x1, y1, x2, y2) {
-      var pl = paddingLeft(), pt = paddingTop();
-      y1 += pt; y2 += pt; x1 += pl; x2 += pl;
-      var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {};
-      var docBottom = needsScrollbar() || Infinity;
-      var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;
-      if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);
-      else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;
-
-      var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
-      var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
-      var atLeft = x1 < gutterw + pl + 10;
-      if (x1 < screenleft + gutterw || atLeft) {
-        if (atLeft) x1 = 0;
-        result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
-      } else if (x2 > screenw + screenleft - 3) {
-        result.scrollLeft = x2 + 10 - screenw;
-      }
-      return result;
-    }
-
-    function visibleLines(scrollTop) {
-      var lh = textHeight(), top = (scrollTop != null ? scrollTop : scrollbar.scrollTop) - paddingTop();
-      var fromHeight = Math.max(0, Math.floor(top / lh));
-      var toHeight = Math.ceil((top + scroller.clientHeight) / lh);
-      return {from: lineAtHeight(doc, fromHeight),
-              to: lineAtHeight(doc, toHeight)};
-    }
-    // Uses a set of changes plus the current scroll position to
-    // determine which DOM updates have to be made, and makes the
-    // updates.
-    function updateDisplay(changes, suppressCallback, scrollTop) {
-      if (!scroller.clientWidth) {
-        showingFrom = showingTo = displayOffset = 0;
-        return;
-      }
-      // Compute the new visible window
-      // If scrollTop is specified, use that to determine which lines
-      // to render instead of the current scrollbar position.
-      var visible = visibleLines(scrollTop);
-      // Bail out if the visible area is already rendered and nothing changed.
-      if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) {
-        updateVerticalScroll(scrollTop);
-        return;
-      }
-      var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
-      if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
-      if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);
-
-      // Create a range of theoretically intact lines, and punch holes
-      // in that using the change info.
-      var intact = changes === true ? [] :
-        computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
-      // Clip off the parts that won't be visible
-      var intactLines = 0;
-      for (var i = 0; i < intact.length; ++i) {
-        var range = intact[i];
-        if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
-        if (range.to > to) range.to = to;
-        if (range.from >= range.to) intact.splice(i--, 1);
-        else intactLines += range.to - range.from;
-      }
-      if (intactLines == to - from && from == showingFrom && to == showingTo) {
-        updateVerticalScroll(scrollTop);
-        return;
-      }
-      intact.sort(function(a, b) {return a.domStart - b.domStart;});
-
-      var th = textHeight(), gutterDisplay = gutter.style.display;
-      lineDiv.style.display = "none";
-      patchDisplay(from, to, intact);
-      lineDiv.style.display = gutter.style.display = "";
-
-      var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;
-      // This is just a bogus formula that detects when the editor is
-      // resized or the font size changes.
-      if (different) lastSizeC = scroller.clientHeight + th;
-      if (from != showingFrom || to != showingTo && options.onViewportChange)
-        setTimeout(function(){
-          if (options.onViewportChange) options.onViewportChange(instance, from, to);
-        });
-      showingFrom = from; showingTo = to;
-      displayOffset = heightAtLine(doc, from);
-
-      // Since this is all rather error prone, it is honoured with the
-      // only assertion in the whole file.
-      if (lineDiv.childNodes.length != showingTo - showingFrom)
-        throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
-                        " nodes=" + lineDiv.childNodes.length);
-
-      function checkHeights() {
-        var curNode = lineDiv.firstChild, heightChanged = false;
-        doc.iter(showingFrom, showingTo, function(line) {
-          // Work around bizarro IE7 bug where, sometimes, our curNode
-          // is magically replaced with a new node in the DOM, leaving
-          // us with a reference to an orphan (nextSibling-less) node.
-          if (!curNode) return;
-          if (!line.hidden) {
-            var height = Math.round(curNode.offsetHeight / th) || 1;
-            if (line.height != height) {
-              updateLineHeight(line, height);
-              gutterDirty = heightChanged = true;
-            }
-          }
-          curNode = curNode.nextSibling;
-        });
-        return heightChanged;
-      }
-
-      if (options.lineWrapping) {
-        checkHeights();
-        var scrollHeight = needsScrollbar();
-        var shouldHaveScrollbar = scrollHeight ? "block" : "none";
-        if (scrollbar.style.display != shouldHaveScrollbar) {
-          scrollbar.style.display = shouldHaveScrollbar;
-          if (scrollHeight) scrollbarInner.style.height = scrollHeight + "px";
-          checkHeights();
-        }
-      }
-
-      gutter.style.display = gutterDisplay;
-      if (different || gutterDirty) {
-        // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
-        updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
-      }
-      updateVerticalScroll(scrollTop);
-      updateSelection();
-      if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
-      return true;
-    }
-
-    function computeIntact(intact, changes) {
-      for (var i = 0, l = changes.length || 0; i < l; ++i) {
-        var change = changes[i], intact2 = [], diff = change.diff || 0;
-        for (var j = 0, l2 = intact.length; j < l2; ++j) {
-          var range = intact[j];
-          if (change.to <= range.from && change.diff)
-            intact2.push({from: range.from + diff, to: range.to + diff,
-                          domStart: range.domStart});
-          else if (change.to <= range.from || change.from >= range.to)
-            intact2.push(range);
-          else {
-            if (change.from > range.from)
-              intact2.push({from: range.from, to: change.from, domStart: range.domStart});
-            if (change.to < range.to)
-              intact2.push({from: change.to + diff, to: range.to + diff,
-                            domStart: range.domStart + (change.to - range.from)});
-          }
-        }
-        intact = intact2;
-      }
-      return intact;
-    }
-
-    function patchDisplay(from, to, intact) {
-      function killNode(node) {
-        var tmp = node.nextSibling;
-        node.parentNode.removeChild(node);
-        return tmp;
-      }
-      // The first pass removes the DOM nodes that aren't intact.
-      if (!intact.length) removeChildren(lineDiv);
-      else {
-        var domPos = 0, curNode = lineDiv.firstChild, n;
-        for (var i = 0; i < intact.length; ++i) {
-          var cur = intact[i];
-          while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}
-          for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}
-        }
-        while (curNode) curNode = killNode(curNode);
-      }
-      // This pass fills in the lines that actually changed.
-      var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
-      doc.iter(from, to, function(line) {
-        if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
-        if (!nextIntact || nextIntact.from > j) {
-          if (line.hidden) var lineElement = elt("pre");
-          else {
-            var lineElement = line.getElement(makeTab);
-            if (line.className) lineElement.className = line.className;
-            // Kludge to make sure the styled element lies behind the selection (by z-index)
-            if (line.bgClassName) {
-              var pre = elt("pre", "\u00a0", line.bgClassName, "position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2");
-              lineElement = elt("div", [pre, lineElement], null, "position: relative");
-            }
-          }
-          lineDiv.insertBefore(lineElement, curNode);
-        } else {
-          curNode = curNode.nextSibling;
-        }
-        ++j;
-      });
-    }
-
-    function updateGutter() {
-      if (!options.gutter && !options.lineNumbers) return;
-      var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
-      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
-      var fragment = document.createDocumentFragment(), i = showingFrom, normalNode;
-      doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
-        if (line.hidden) {
-          fragment.appendChild(elt("pre"));
-        } else {
-          var marker = line.gutterMarker;
-          var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;
-          if (marker && marker.text)
-            text = marker.text.replace("%N%", text != null ? text : "");
-          else if (text == null)
-            text = "\u00a0";
-          var markerElement = fragment.appendChild(elt("pre", null, marker && marker.style));
-          markerElement.innerHTML = text;
-          for (var j = 1; j < line.height; ++j) {
-            markerElement.appendChild(elt("br"));
-            markerElement.appendChild(document.createTextNode("\u00a0"));
-          }
-          if (!marker) normalNode = i;
-        }
-        ++i;
-      });
-      gutter.style.display = "none";
-      removeChildrenAndAdd(gutterText, fragment);
-      // Make sure scrolling doesn't cause number gutter size to pop
-      if (normalNode != null && options.lineNumbers) {
-        var node = gutterText.childNodes[normalNode - showingFrom];
-        var minwidth = String(doc.size).length, val = eltText(node.firstChild), pad = "";
-        while (val.length + pad.length < minwidth) pad += "\u00a0";
-        if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);
-      }
-      gutter.style.display = "";
-      var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;
-      lineSpace.style.marginLeft = gutter.offsetWidth + "px";
-      gutterDirty = false;
-      return resized;
-    }
-    function updateSelection() {
-      var collapsed = posEq(sel.from, sel.to);
-      var fromPos = localCoords(sel.from, true);
-      var toPos = collapsed ? fromPos : localCoords(sel.to, true);
-      var headPos = sel.inverted ? fromPos : toPos, th = textHeight();
-      var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);
-      inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";
-      inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";
-      if (collapsed) {
-        cursor.style.top = headPos.y + "px";
-        cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";
-        cursor.style.display = "";
-        selectionDiv.style.display = "none";
-      } else {
-        var sameLine = fromPos.y == toPos.y, fragment = document.createDocumentFragment();
-        var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
-        var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
-        var add = function(left, top, right, height) {
-          var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"
-                                  : "right: " + right + "px";
-          fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
-                                   "px; top: " + top + "px; " + rstyle + "; height: " + height + "px"));
-        };
-        if (sel.from.ch && fromPos.y >= 0) {
-          var right = sameLine ? clientWidth - toPos.x : 0;
-          add(fromPos.x, fromPos.y, right, th);
-        }
-        var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));
-        var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;
-        if (middleHeight > 0.2 * th)
-          add(0, middleStart, 0, middleHeight);
-        if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
-          add(0, toPos.y, clientWidth - toPos.x, th);
-        removeChildrenAndAdd(selectionDiv, fragment);
-        cursor.style.display = "none";
-        selectionDiv.style.display = "";
-      }
-    }
-
-    function setShift(val) {
-      if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
-      else shiftSelecting = null;
-    }
-    function setSelectionUser(from, to) {
-      var sh = shiftSelecting && clipPos(shiftSelecting);
-      if (sh) {
-        if (posLess(sh, from)) from = sh;
-        else if (posLess(to, sh)) to = sh;
-      }
-      setSelection(from, to);
-      userSelChange = true;
-    }
-    // Update the selection. Last two args are only used by
-    // updateLines, since they have to be expressed in the line
-    // numbers before the update.
-    function setSelection(from, to, oldFrom, oldTo) {
-      goalColumn = null;
-      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
-      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
-      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
-
-      // Skip over hidden lines.
-      if (from.line != oldFrom) {
-        var from1 = skipHidden(from, oldFrom, sel.from.ch);
-        // If there is no non-hidden line left, force visibility on current line
-        if (!from1) setLineHidden(from.line, false);
-        else from = from1;
-      }
-      if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
-
-      if (posEq(from, to)) sel.inverted = false;
-      else if (posEq(from, sel.to)) sel.inverted = false;
-      else if (posEq(to, sel.from)) sel.inverted = true;
-
-      if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
-        var head = sel.inverted ? from : to;
-        if (head.line != sel.from.line && sel.from.line < doc.size) {
-          var oldLine = getLine(sel.from.line);
-          if (/^\s+$/.test(oldLine.text))
-            setTimeout(operation(function() {
-              if (oldLine.parent && /^\s+$/.test(oldLine.text)) {
-                var no = lineNo(oldLine);
-                replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});
-              }
-            }, 10));
-        }
-      }
-
-      sel.from = from; sel.to = to;
-      selectionChanged = true;
-    }
-    function skipHidden(pos, oldLine, oldCh) {
-      function getNonHidden(dir) {
-        var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;
-        while (lNo != end) {
-          var line = getLine(lNo);
-          if (!line.hidden) {
-            var ch = pos.ch;
-            if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;
-            return {line: lNo, ch: ch};
-          }
-          lNo += dir;
-        }
-      }
-      var line = getLine(pos.line);
-      var toEnd = pos.ch == line.text.length && pos.ch != oldCh;
-      if (!line.hidden) return pos;
-      if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);
-      else return getNonHidden(-1) || getNonHidden(1);
-    }
-    function setCursor(line, ch, user) {
-      var pos = clipPos({line: line, ch: ch || 0});
-      (user ? setSelectionUser : setSelection)(pos, pos);
-    }
-
-    function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}
-    function clipPos(pos) {
-      if (pos.line < 0) return {line: 0, ch: 0};
-      if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};
-      var ch = pos.ch, linelen = getLine(pos.line).text.length;
-      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
-      else if (ch < 0) return {line: pos.line, ch: 0};
-      else return pos;
-    }
-
-    function findPosH(dir, unit) {
-      var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;
-      var lineObj = getLine(line);
-      function findNextLine() {
-        for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {
-          var lo = getLine(l);
-          if (!lo.hidden) { line = l; lineObj = lo; return true; }
-        }
-      }
-      function moveOnce(boundToLine) {
-        if (ch == (dir < 0 ? 0 : lineObj.text.length)) {
-          if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;
-          else return false;
-        } else ch += dir;
-        return true;
-      }
-      if (unit == "char") moveOnce();
-      else if (unit == "column") moveOnce(true);
-      else if (unit == "word") {
-        var sawWord = false;
-        for (;;) {
-          if (dir < 0) if (!moveOnce()) break;
-          if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
-          else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
-          if (dir > 0) if (!moveOnce()) break;
-        }
-      }
-      return {line: line, ch: ch};
-    }
-    function moveH(dir, unit) {
-      var pos = dir < 0 ? sel.from : sel.to;
-      if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);
-      setCursor(pos.line, pos.ch, true);
-    }
-    function deleteH(dir, unit) {
-      if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to);
-      else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to);
-      else replaceRange("", sel.from, findPosH(dir, unit));
-      userSelChange = true;
-    }
-    function moveV(dir, unit) {
-      var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);
-      if (goalColumn != null) pos.x = goalColumn;
-      if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);
-      else if (unit == "line") dist = textHeight();
-      var target = coordsChar(pos.x, pos.y + dist * dir + 2);
-      if (unit == "page") scrollbar.scrollTop += localCoords(target, true).y - pos.y;
-      setCursor(target.line, target.ch, true);
-      goalColumn = pos.x;
-    }
-
-    function findWordAt(pos) {
-      var line = getLine(pos.line).text;
-      var start = pos.ch, end = pos.ch;
-      if (line) {
-        if (pos.after === false || end == line.length) --start; else ++end;
-        var startChar = line.charAt(start);
-        var check = isWordChar(startChar) ? isWordChar :
-                    /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
-                    function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
-        while (start > 0 && check(line.charAt(start - 1))) --start;
-        while (end < line.length && check(line.charAt(end))) ++end;
-      }
-      return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};
-    }
-    function selectLine(line) {
-      setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));
-    }
-    function indentSelected(mode) {
-      if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
-      var e = sel.to.line - (sel.to.ch ? 0 : 1);
-      for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
-    }
-
-    function indentLine(n, how) {
-      if (!how) how = "add";
-      if (how == "smart") {
-        if (!mode.indent) how = "prev";
-        else var state = getStateBefore(n);
-      }
-
-      var line = getLine(n), curSpace = line.indentation(options.tabSize),
-          curSpaceString = line.text.match(/^\s*/)[0], indentation;
-      if (how == "smart") {
-        indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
-        if (indentation == Pass) how = "prev";
-      }
-      if (how == "prev") {
-        if (n) indentation = getLine(n-1).indentation(options.tabSize);
-        else indentation = 0;
-      }
-      else if (how == "add") indentation = curSpace + options.indentUnit;
-      else if (how == "subtract") indentation = curSpace - options.indentUnit;
-      indentation = Math.max(0, indentation);
-      var diff = indentation - curSpace;
-
-      var indentString = "", pos = 0;
-      if (options.indentWithTabs)
-        for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";}
-      while (pos < indentation) {++pos; indentString += " ";}
-
-      if (indentString != curSpaceString)
-        replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
-    }
-
-    function loadMode() {
-      mode = CodeMirror.getMode(options, options.mode);
-      doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
-      work = [0];
-      startWorker();
-    }
-    function gutterChanged() {
-      var visible = options.gutter || options.lineNumbers;
-      gutter.style.display = visible ? "" : "none";
-      if (visible) gutterDirty = true;
-      else lineDiv.parentNode.style.marginLeft = 0;
-    }
-    function wrappingChanged(from, to) {
-      if (options.lineWrapping) {
-        wrapper.className += " CodeMirror-wrap";
-        var perLine = scroller.clientWidth / charWidth() - 3;
-        doc.iter(0, doc.size, function(line) {
-          if (line.hidden) return;
-          var guess = Math.ceil(line.text.length / perLine) || 1;
-          if (guess != 1) updateLineHeight(line, guess);
-        });
-        lineSpace.style.minWidth = widthForcer.style.left = "";
-      } else {
-        wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
-        computeMaxLength();
-        doc.iter(0, doc.size, function(line) {
-          if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
-        });
-      }
-      changes.push({from: 0, to: doc.size});
-    }
-    function makeTab(col) {
-      var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
-      if (cached) return cached;
-      for (var str = "", i = 0; i < w; ++i) str += " ";
-      var span = elt("span", str, "cm-tab");
-      return (tabCache[w] = {element: span, width: w});
-    }
-    function themeChanged() {
-      scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") +
-        options.theme.replace(/(^|\s)\s*/g, " cm-s-");
-    }
-    function keyMapChanged() {
-      var style = keyMap[options.keyMap].style;
-      wrapper.className = wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
-        (style ? " cm-keymap-" + style : "");
-    }
-
-    function TextMarker() { this.set = []; }
-    TextMarker.prototype.clear = operation(function() {
-      var min = Infinity, max = -Infinity;
-      for (var i = 0, e = this.set.length; i < e; ++i) {
-        var line = this.set[i], mk = line.marked;
-        if (!mk || !line.parent) continue;
-        var lineN = lineNo(line);
-        min = Math.min(min, lineN); max = Math.max(max, lineN);
-        for (var j = 0; j < mk.length; ++j)
-          if (mk[j].marker == this) mk.splice(j--, 1);
-      }
-      if (min != Infinity)
-        changes.push({from: min, to: max + 1});
-    });
-    TextMarker.prototype.find = function() {
-      var from, to;
-      for (var i = 0, e = this.set.length; i < e; ++i) {
-        var line = this.set[i], mk = line.marked;
-        for (var j = 0; j < mk.length; ++j) {
-          var mark = mk[j];
-          if (mark.marker == this) {
-            if (mark.from != null || mark.to != null) {
-              var found = lineNo(line);
-              if (found != null) {
-                if (mark.from != null) from = {line: found, ch: mark.from};
-                if (mark.to != null) to = {line: found, ch: mark.to};
-              }
-            }
-          }
-        }
-      }
-      return {from: from, to: to};
-    };
-
-    function markText(from, to, className) {
-      from = clipPos(from); to = clipPos(to);
-      var tm = new TextMarker();
-      if (!posLess(from, to)) return tm;
-      function add(line, from, to, className) {
-        getLine(line).addMark(new MarkedText(from, to, className, tm));
-      }
-      if (from.line == to.line) add(from.line, from.ch, to.ch, className);
-      else {
-        add(from.line, from.ch, null, className);
-        for (var i = from.line + 1, e = to.line; i < e; ++i)
-          add(i, null, null, className);
-        add(to.line, null, to.ch, className);
-      }
-      changes.push({from: from.line, to: to.line + 1});
-      return tm;
-    }
-
-    function setBookmark(pos) {
-      pos = clipPos(pos);
-      var bm = new Bookmark(pos.ch);
-      getLine(pos.line).addMark(bm);
-      return bm;
-    }
-
-    function findMarksAt(pos) {
-      pos = clipPos(pos);
-      var markers = [], marked = getLine(pos.line).marked;
-      if (!marked) return markers;
-      for (var i = 0, e = marked.length; i < e; ++i) {
-        var m = marked[i];
-        if ((m.from == null || m.from <= pos.ch) &&
-            (m.to == null || m.to >= pos.ch))
-          markers.push(m.marker || m);
-      }
-      return markers;
-    }
-
-    function addGutterMarker(line, text, className) {
-      if (typeof line == "number") line = getLine(clipLine(line));
-      line.gutterMarker = {text: text, style: className};
-      gutterDirty = true;
-      return line;
-    }
-    function removeGutterMarker(line) {
-      if (typeof line == "number") line = getLine(clipLine(line));
-      line.gutterMarker = null;
-      gutterDirty = true;
-    }
-
-    function changeLine(handle, op) {
-      var no = handle, line = handle;
-      if (typeof handle == "number") line = getLine(clipLine(handle));
-      else no = lineNo(handle);
-      if (no == null) return null;
-      if (op(line, no)) changes.push({from: no, to: no + 1});
-      else return null;
-      return line;
-    }
-    function setLineClass(handle, className, bgClassName) {
-      return changeLine(handle, function(line) {
-        if (line.className != className || line.bgClassName != bgClassName) {
-          line.className = className;
-          line.bgClassName = bgClassName;
-          return true;
-        }
-      });
-    }
-    function setLineHidden(handle, hidden) {
-      return changeLine(handle, function(line, no) {
-        if (line.hidden != hidden) {
-          line.hidden = hidden;
-          if (!options.lineWrapping) {
-            if (hidden && line.text.length == maxLine.text.length) {
-              updateMaxLine = true;
-            } else if (!hidden && line.text.length > maxLine.text.length) {
-              maxLine = line; updateMaxLine = false;
-            }
-          }
-          updateLineHeight(line, hidden ? 0 : 1);
-          var fline = sel.from.line, tline = sel.to.line;
-          if (hidden && (fline == no || tline == no)) {
-            var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;
-            var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;
-            // Can't hide the last visible line, we'd have no place to put the cursor
-            if (!to) return;
-            setSelection(from, to);
-          }
-          return (gutterDirty = true);
-        }
-      });
-    }
-
-    function lineInfo(line) {
-      if (typeof line == "number") {
-        if (!isLine(line)) return null;
-        var n = line;
-        line = getLine(line);
-        if (!line) return null;
-      } else {
-        var n = lineNo(line);
-        if (n == null) return null;
-      }
-      var marker = line.gutterMarker;
-      return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
-              markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};
-    }
-
-    // These are used to go from pixel positions to character
-    // positions, taking varying character widths into account.
-    function charFromX(line, x) {
-      if (x <= 0) return 0;
-      var lineObj = getLine(line), text = lineObj.text;
-      function getX(len) {
-        return measureLine(lineObj, len).left;
-      }
-      var from = 0, fromX = 0, to = text.length, toX;
-      // Guess a suitable upper bound for our search.
-      var estimated = Math.min(to, Math.ceil(x / charWidth()));
-      for (;;) {
-        var estX = getX(estimated);
-        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
-        else {toX = estX; to = estimated; break;}
-      }
-      if (x > toX) return to;
-      // Try to guess a suitable lower bound as well.
-      estimated = Math.floor(to * 0.8); estX = getX(estimated);
-      if (estX < x) {from = estimated; fromX = estX;}
-      // Do a binary search between these bounds.
-      for (;;) {
-        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
-        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
-        if (middleX > x) {to = middle; toX = middleX;}
-        else {from = middle; fromX = middleX;}
-      }
-    }
-
-    function measureLine(line, ch) {
-      if (ch == 0) return {top: 0, left: 0};
-      var wbr = options.lineWrapping && ch < line.text.length &&
-                spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
-      var pre = line.getElement(makeTab, ch, wbr);
-      removeChildrenAndAdd(measure, pre);
-      var anchor = pre.anchor;
-      var top = anchor.offsetTop, left = anchor.offsetLeft;
-      // Older IEs report zero offsets for spans directly after a wrap
-      if (ie && top == 0 && left == 0) {
-        var backup = elt("span", "x");
-        anchor.parentNode.insertBefore(backup, anchor.nextSibling);
-        top = backup.offsetTop;
-      }
-      return {top: top, left: left};
-    }
-    function localCoords(pos, inLineWrap) {
-      var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
-      if (pos.ch == 0) x = 0;
-      else {
-        var sp = measureLine(getLine(pos.line), pos.ch);
-        x = sp.left;
-        if (options.lineWrapping) y += Math.max(0, sp.top);
-      }
-      return {x: x, y: y, yBot: y + lh};
-    }
-    // Coords must be lineSpace-local
-    function coordsChar(x, y) {
-      var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
-      if (heightPos < 0) return {line: 0, ch: 0};
-      var lineNo = lineAtHeight(doc, heightPos);
-      if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
-      var lineObj = getLine(lineNo), text = lineObj.text;
-      var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;
-      if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};
-      var wrongLine = false;
-      function getX(len) {
-        var sp = measureLine(lineObj, len);
-        if (tw) {
-          var off = Math.round(sp.top / th);
-          wrongLine = off != innerOff;
-          return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);
-        }
-        return sp.left;
-      }
-      var from = 0, fromX = 0, to = text.length, toX;
-      // Guess a suitable upper bound for our search.
-      var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));
-      for (;;) {
-        var estX = getX(estimated);
-        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
-        else {toX = estX; to = estimated; break;}
-      }
-      if (x > toX) return {line: lineNo, ch: to};
-      // Try to guess a suitable lower bound as well.
-      estimated = Math.floor(to * 0.8); estX = getX(estimated);
-      if (estX < x) {from = estimated; fromX = estX;}
-      // Do a binary search between these bounds.
-      for (;;) {
-        if (to - from <= 1) {
-          var after = x - fromX < toX - x;
-          return {line: lineNo, ch: after ? from : to, after: after};
-        }
-        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
-        if (middleX > x) {to = middle; toX = middleX; if (wrongLine) toX += 1000; }
-        else {from = middle; fromX = middleX;}
-      }
-    }
-    function pageCoords(pos) {
-      var local = localCoords(pos, true), off = eltOffset(lineSpace);
-      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
-    }
-
-    var cachedHeight, cachedHeightFor, measurePre;
-    function textHeight() {
-      if (measurePre == null) {
-        measurePre = elt("pre");
-        for (var i = 0; i < 49; ++i) {
-          measurePre.appendChild(document.createTextNode("x"));
-          measurePre.appendChild(elt("br"));
-        }
-        measurePre.appendChild(document.createTextNode("x"));
-      }
-      var offsetHeight = lineDiv.clientHeight;
-      if (offsetHeight == cachedHeightFor) return cachedHeight;
-      cachedHeightFor = offsetHeight;
-      removeChildrenAndAdd(measure, measurePre.cloneNode(true));
-      cachedHeight = measure.firstChild.offsetHeight / 50 || 1;
-      removeChildren(measure);
-      return cachedHeight;
-    }
-    var cachedWidth, cachedWidthFor = 0;
-    function charWidth() {
-      if (scroller.clientWidth == cachedWidthFor) return cachedWidth;
-      cachedWidthFor = scroller.clientWidth;
-      var anchor = elt("span", "x");
-      var pre = elt("pre", [anchor]);
-      removeChildrenAndAdd(measure, pre);
-      return (cachedWidth = anchor.offsetWidth || 10);
-    }
-    function paddingTop() {return lineSpace.offsetTop;}
-    function paddingLeft() {return lineSpace.offsetLeft;}
-
-    function posFromMouse(e, liberal) {
-      var offW = eltOffset(scroller, true), x, y;
-      // Fails unpredictably on IE[67] when mouse is dragged around quickly.
-      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
-      // This is a mess of a heuristic to try and determine whether a
-      // scroll-bar was clicked or not, and to return null if one was
-      // (and !liberal).
-      if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
-        return null;
-      var offL = eltOffset(lineSpace, true);
-      return coordsChar(x - offL.left, y - offL.top);
-    }
-    function onContextMenu(e) {
-      var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop;
-      if (!pos || opera) return; // Opera is difficult.
-      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
-        operation(setCursor)(pos.line, pos.ch);
-
-      var oldCSS = input.style.cssText;
-      inputDiv.style.position = "absolute";
-      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
-        "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
-        "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
-      leaveInputAlone = true;
-      var val = input.value = getSelection();
-      focusInput();
-      selectInput(input);
-      function rehide() {
-        var newVal = splitLines(input.value).join("\n");
-        if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, "end");
-        inputDiv.style.position = "relative";
-        input.style.cssText = oldCSS;
-        if (ie_lt9) scrollbar.scrollTop = scrollPos;
-        leaveInputAlone = false;
-        resetInput(true);
-        slowPoll();
-      }
-
-      if (gecko) {
-        e_stop(e);
-        var mouseup = connect(window, "mouseup", function() {
-          mouseup();
-          setTimeout(rehide, 20);
-        }, true);
-      } else {
-        setTimeout(rehide, 50);
-      }
-    }
-
-    // Cursor-blinking
-    function restartBlink() {
-      clearInterval(blinker);
-      var on = true;
-      cursor.style.visibility = "";
-      blinker = setInterval(function() {
-        cursor.style.visibility = (on = !on) ? "" : "hidden";
-      }, options.cursorBlinkRate);
-    }
-
-    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
-    function matchBrackets(autoclear) {
-      var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
-      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
-      if (!match) return;
-      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
-      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
-        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
-
-      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
-      function scan(line, from, to) {
-        if (!line.text) return;
-        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
-        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
-          var text = st[i];
-          if (st[i+1] != style) {pos += d * text.length; continue;}
-          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
-            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
-              var match = matching[cur];
-              if (match.charAt(1) == ">" == forward) stack.push(cur);
-              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
-              else if (!stack.length) return {pos: pos, match: true};
-            }
-          }
-        }
-      }
-      for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {
-        var line = getLine(i), first = i == head.line;
-        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
-        if (found) break;
-      }
-      if (!found) found = {pos: null, match: false};
-      var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
-      var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
-          two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
-      var clear = operation(function(){one.clear(); two && two.clear();});
-      if (autoclear) setTimeout(clear, 800);
-      else bracketHighlighted = clear;
-    }
-
-    // Finds the line to start with when starting a parse. Tries to
-    // find a line with a stateAfter, so that it can start with a
-    // valid state. If that fails, it returns the line with the
-    // smallest indentation, which tends to need the least context to
-    // parse correctly.
-    function findStartLine(n) {
-      var minindent, minline;
-      for (var search = n, lim = n - 40; search > lim; --search) {
-        if (search == 0) return 0;
-        var line = getLine(search-1);
-        if (line.stateAfter) return search;
-        var indented = line.indentation(options.tabSize);
-        if (minline == null || minindent > indented) {
-          minline = search - 1;
-          minindent = indented;
-        }
-      }
-      return minline;
-    }
-    function getStateBefore(n) {
-      var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
-      if (!state) state = startState(mode);
-      else state = copyState(mode, state);
-      doc.iter(start, n, function(line) {
-        line.highlight(mode, state, options.tabSize);
-        line.stateAfter = copyState(mode, state);
-      });
-      if (start < n) changes.push({from: start, to: n});
-      if (n < doc.size && !getLine(n).stateAfter) work.push(n);
-      return state;
-    }
-    function highlightLines(start, end) {
-      var state = getStateBefore(start);
-      doc.iter(start, end, function(line) {
-        line.highlight(mode, state, options.tabSize);
-        line.stateAfter = copyState(mode, state);
-      });
-    }
-    function highlightWorker() {
-      var end = +new Date + options.workTime;
-      var foundWork = work.length;
-      while (work.length) {
-        if (!getLine(showingFrom).stateAfter) var task = showingFrom;
-        else var task = work.pop();
-        if (task >= doc.size) continue;
-        var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
-        if (state) state = copyState(mode, state);
-        else state = startState(mode);
-
-        var unchanged = 0, compare = mode.compareStates, realChange = false,
-            i = start, bail = false;
-        doc.iter(i, doc.size, function(line) {
-          var hadState = line.stateAfter;
-          if (+new Date > end) {
-            work.push(i);
-            startWorker(options.workDelay);
-            if (realChange) changes.push({from: task, to: i + 1});
-            return (bail = true);
-          }
-          var changed = line.highlight(mode, state, options.tabSize);
-          if (changed) realChange = true;
-          line.stateAfter = copyState(mode, state);
-          var done = null;
-          if (compare) {
-            var same = hadState && compare(hadState, state);
-            if (same != Pass) done = !!same;
-          }
-          if (done == null) {
-            if (changed !== false || !hadState) unchanged = 0;
-            else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))
-              done = true;
-          }
-          if (done) return true;
-          ++i;
-        });
-        if (bail) return;
-        if (realChange) changes.push({from: task, to: i + 1});
-      }
-      if (foundWork && options.onHighlightComplete)
-        options.onHighlightComplete(instance);
-    }
-    function startWorker(time) {
-      if (!work.length) return;
-      highlight.set(time, operation(highlightWorker));
-    }
-
-    // Operations are used to wrap changes in such a way that each
-    // change won't have to update the cursor and display (which would
-    // be awkward, slow, and error-prone), but instead updates are
-    // batched and then all combined and executed at once.
-    function startOperation() {
-      updateInput = userSelChange = textChanged = null;
-      changes = []; selectionChanged = false; callbacks = [];
-    }
-    function endOperation() {
-      if (updateMaxLine) computeMaxLength();
-      if (maxLineChanged && !options.lineWrapping) {
-        var cursorWidth = widthForcer.offsetWidth, left = measureLine(maxLine, maxLine.text.length).left;
-        widthForcer.style.left = left + "px";
-        lineSpace.style.minWidth = (left + cursorWidth) + "px";
-        maxLineChanged = false;
-      }
-      var newScrollPos, updated;
-      if (selectionChanged) {
-        var coords = calculateCursorCoords();
-        newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot);
-      }
-      if (changes.length || newScrollPos && newScrollPos.scrollTop != null)
-        updated = updateDisplay(changes, true, newScrollPos && newScrollPos.scrollTop);
-      if (!updated) {
-        if (selectionChanged) updateSelection();
-        if (gutterDirty) updateGutter();
-      }
-      if (newScrollPos) scrollCursorIntoView();
-      if (selectionChanged) restartBlink();
-
-      if (focused && !leaveInputAlone &&
-          (updateInput === true || (updateInput !== false && selectionChanged)))
-        resetInput(userSelChange);
-
-      if (selectionChanged && options.matchBrackets)
-        setTimeout(operation(function() {
-          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
-          if (posEq(sel.from, sel.to)) matchBrackets(false);
-        }), 20);
-      var sc = selectionChanged, cbs = callbacks; // these can be reset by callbacks
-      if (textChanged && options.onChange && instance)
-        options.onChange(instance, textChanged);
-      if (sc && options.onCursorActivity)
-        options.onCursorActivity(instance);
-      for (var i = 0; i < cbs.length; ++i) cbs[i](instance);
-      if (updated && options.onUpdate) options.onUpdate(instance);
-    }
-    var nestedOperation = 0;
-    function operation(f) {
-      return function() {
-        if (!nestedOperation++) startOperation();
-        try {var result = f.apply(this, arguments);}
-        finally {if (!--nestedOperation) endOperation();}
-        return result;
-      };
-    }
-
-    function compoundChange(f) {
-      history.startCompou

<TRUNCATED>

[14/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/jquery-1.5.2.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/jquery-1.5.2.min.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/jquery-1.5.2.min.js
deleted file mode 100644
index f78f96a..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/jquery-1.5.2.min.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.5.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Thu Mar 31 15:28:23 2011 -0400
- */
-(function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No con
 version from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bR(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bQ(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bs.test(a)?e(a,f):bQ(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bQ(a+"["+f+"]",b[f],c,e)}function bP(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bJ,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bP(a,c,d,e,l,g)));(k||!l)&&!g["*"
 ]&&(l=bP(a,c,d,e,"*",g));return l}function bO(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bD),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bq(a,b,c){var e=b==="width"?bk:bl,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function bc(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bb(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function ba(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML
 =a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function _(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function $(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Q(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(L
 .test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(r,"")===a.type?q.push(g.selector):t.splice(i--,1);f=d(a.target).closest(q,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&p.push({elem:h,handleObj:
 g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){f=p[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init
 (a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k
 =e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(t
 his,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b)
 {a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainOb
 ject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.append
 Child(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:D?function(a){return a==null?"":D.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?B.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++
 ]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a
 .fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){F["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),E&&(d.inArray=function(a,b){return E.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?y=function(){c.removeEventListener("DOMContentLoaded",y,!1),d.ready()}:c.attachEvent&&(y=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",y),d.ready())});return d}(),e="then done fail isResolved isRejected promise".split(" "),f=[].slice;d.extend({_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=a
 rguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(d,f)}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),f;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(f)return f;f=a={}}var c=e.length;while(c--)a[e[c]]=b[e[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&
 &a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c<e;c++)b[c]&&d.isFunction(b[c].promise)?b[c].promise().then(i(c),h.reject):--g;g||h.resolveWith(h,b)}else h!==a&&h.resolveWith(h,e?[a]:[]);return h.promise()}}),function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!
 1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChi
 ld.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=nu
 ll}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i
 [g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i<j;i++)g=f[i].name,g.indexOf("data-")===0&&(g=g.substr(5),h(this[0],g,e[g]))}}return e}if(typeof a==="object")return this.each(func
 tion(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=h(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]
 !=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var j=/[\n\t\r]/g,k=/\s+/,l=/\r/g,m=/^(?:href|src|style)$/,n=/^(?:button|input)$/i,o=/^(?:button|input|object|select|textarea)$/i,p=/^a(?:rea)?$/i,q=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("clas
 s")))});if(a&&typeof a==="string"){var b=(a||"").split(k);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(k);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(j," ");for(var i=0,l=c.length;i<l;i++)h=h.replace(" "+c[i]+" "," ");g.className=d.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),i=b,j=a.s
 plit(k);while(f=j[g++])i=e?i:!h.hasClass(f),h[i?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(j," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j<k;j++){var m=h[j];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(q.test(c.type)&&!d.support.checkOn)r
 eturn c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(l,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&q.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNod
 e.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else
  if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.ty
 pe);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.ind
 exOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=
 d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;va
 r e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,H(a.origType,a.selector),d.extend({},a,{handler:G,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,H(a.origType,a.s
 elector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?y:x):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=y;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=y;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=y,this.stopP
 ropagation()},isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x};var z=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},A=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?A:z,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?A:z)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&E("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&E
 ("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var B,C=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radi
 o")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f
 .apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){re
 turn this.mouseenter(a).mouseleave(b||a)}});var F={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=r.exec(h),k="",j&&(k=j[0],h=h.replace(r,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(F[h]+k),h=h+k):h=(F[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)d.event.add(n[p],"live."+H(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+H(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){
 d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)ret
 urn[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else f
 or(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")c
 ontinue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)
 ]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:funct
 ion(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]
 =b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.
 type;return"text"===c&&(b===c||b===null)},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||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="no
 t"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f===
 "~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocument
 Position||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getEle
 mentById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML
 (e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div")
 ,e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML
 =function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var I=/Until$/,J=/^(?:parents|prevUntil|prevAll)/,K=/,/,L=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,N=d.expr.match.POS,O={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.
 pushStack(Q(this,a,!1),"not",a)},filter:function(a){return this.pushStack(Q(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get
 (),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string
 "&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/<tbody/i,W=/<|&#?\w+;/,X=/<(?:script|object|embed|option|style)/i,Y=/checked\s*(?:[^=]|=\s*.checked.)/i,Z={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2
 ,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(
 b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(
 this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cl
 eanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.length?this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&Y.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment
 (a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?$(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,bc)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!X.test(a[0])&&(d.support.checkClone||!Y.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):
 this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1></$2>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody"
 )&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\
 ([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.se
 t(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c
 =a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&
 d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(thi
 s,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess 
 ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.
 parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase
 ().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=
 !by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}
 else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.tes
 t(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.inser
 tBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&
 &(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cf(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ce("hide",3),
 a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(ce("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){
 b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cf(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(ca.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=cb.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.d
 equeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.
 fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.
 curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(cc),cc=null},speeds:{slow:600,fast:200,_def
 ault:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var cg=/^t(?:able|d|h)$/i,ch=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=ci(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxMode
 l&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!cg.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeft
 Width)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position=
 "fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(
 a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,
 c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.css b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.css
deleted file mode 100644
index 67d19b7..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib/codemirror.css
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.CodeMirror {
-  overflow: auto;
-  height: 300px;
-  line-height: 1em;
-  font-family: monospace;
-  _position: relative; /* IE6 hack */
-}
-
-.CodeMirror-gutter {
-  position: absolute; left: 0; top: 0;
-  background-color: #f7f7f7;
-  border-right: 1px solid #eee;
-  min-width: 2em;
-  height: 100%;
-}
-.CodeMirror-gutter-text {
-  color: #aaa;
-  text-align: right;
-  padding: .4em .2em .4em .4em;
-}
-.CodeMirror-lines {
-  padding: .4em;
-}
-
-.CodeMirror pre {
-  -moz-border-radius: 0;
-  -webkit-border-radius: 0;
-  -o-border-radius: 0;
-  border-radius: 0;
-  border-width: 0; margin: 0; padding: 0; background: transparent;
-  font-family: inherit;
-}
-
-.CodeMirror-cursor {
-  z-index: 10;
-  position: absolute;
-  visibility: hidden;
-  border-left: 1px solid black !important;
-}
-.CodeMirror-focused .CodeMirror-cursor {
-  visibility: visible;
-}
-
-span.CodeMirror-selected {
-  background: #ccc !important;
-  color: HighlightText !important;
-}
-.CodeMirror-focused span.CodeMirror-selected {
-  background: Highlight !important;
-}
-
-.CodeMirror-matchingbracket {color: #0f0 !important;}
-.CodeMirror-nonmatchingbracket {color: #f22 !important;}


[37/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld7.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld7.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld7.html
deleted file mode 100644
index 1bd729e..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/exWorld7.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="https://www.google.com/jsapi"></script><script type="text/javascript" id="sgvzlr_script" src="../sgvizler.js"></script><script type="text/javascript">sgvizler.option.namespace.wd = 'http://sws.ifi.uio.no/d2rq/resource/';
-      sgvizler.option.namespace.w = 'http://sws.ifi.uio.no/ont/world.owl#';
-      
-	$(document).ready(sgvizler.go());
-      </script></head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h3><code>dForceGraph</code>: The population of South America per country
-      </h3>
-      <p>The graph (well, it's a tree.) draws the structure Asia -&gt; part of continent -&gt; country.
-         The colors represents the different continents, the size the population of the country.
-         The animation is very snappy in Chrome, and not so snappy in other browsers.
-      </p>
-      <div id="sgvzl_example_query" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?node ?parent ?size ?color WHERE{ { [rdfs:label ?node ] w:isCountryInRegion [rdfs:label ?parent] ; w:isCountryInRegion ?color ; w:isCountryInContinent [rdfs:label &#34;Asia&#34;] ; w:hasCountryPopulation ?size } UNION { [rdfs:label ?node] w:isRegionInContinent [rdfs:label &#34;Asia&#34;,?parent] ; w:isRegionInContinent ?color } } ORDER BY ?size" data-sgvizler-chart="dForceGraph" data-sgvizler-loglevel="2" style="width:800px; height:400px;"></div>
-      <p>The element which draws the above chart:</p><pre id="sgvzl_example_pre">&lt;div id="sgvzl_example_query" 
-   data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" 
-   data-sgvizler-query="SELECT ?node ?parent ?size ?color WHERE{ { [rdfs:label ?node ] w:isCountryInRegion [rdfs:label ?parent] ; w:isCountryInRegion ?color ; w:isCountryInContinent [rdfs:label &amp;quot;Asia&amp;quot;] ; w:hasCountryPopulation ?size } UNION { [rdfs:label ?node] w:isRegionInContinent [rdfs:label &amp;quot;Asia&amp;quot;,?parent] ; w:isRegionInContinent ?color } } ORDER BY ?size" 
-   data-sgvizler-chart="dForceGraph" 
-   data-sgvizler-loglevel="2" 
-   style="width:800px; height:400px;"/&gt;</pre><h3>The results of the query in <code>gTable</code></h3>
-      <div id="sgvzl_example_table" data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/world" data-sgvizler-query="SELECT ?node ?parent ?size ?color WHERE{ { [rdfs:label ?node ] w:isCountryInRegion [rdfs:label ?parent] ; w:isCountryInRegion ?color ; w:isCountryInContinent [rdfs:label &#34;Asia&#34;] ; w:hasCountryPopulation ?size } UNION { [rdfs:label ?node] w:isRegionInContinent [rdfs:label &#34;Asia&#34;,?parent] ; w:isRegionInContinent ?color } } ORDER BY ?size" data-sgvizler-chart="gTable" data-sgvizler-loglevel="2" style="width:800px; height:200px;"></div>
-      <div id="footer">
-         <!--Please leave a link to the Sgvizler homepage.-->
-         <p>
-            	Sgvizler visualizes the result of SPARQL SELECT queries using
-            	javascript and the Google Visualization API. For more
-            	information, see the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-            	homepage. (c) 2011--2012 Martin G. Skjæveland.
-            
-         </p>
-      </div>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/examples.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/examples.css b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/examples.css
deleted file mode 100644
index 362b04f..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/examples.css
+++ /dev/null
@@ -1,50 +0,0 @@
-
-a:link{
-    color: #335;
-}
-a:visited{
-    color: #135;
-}
-a:hover{
-    color: #531;
-}
-
-dd{
-    margin-bottom: 8px;
-}
-
-div#logo img{
-    width: 59px;
-    height: 55px;
-}
-
-div#logo{
-    font-size: 50%;
-}
-
-body#menu{
-    font-size: 75%;
-}
-
-body#menu ul{
-    padding: 0;
-    margin: 0;
-    margin-left: 15px;
-}
-
-
-#sgvzl_example_pre{
-    margin: 10px;
-    padding: 20px;
-    border: 1px solid #ccc;
-    background-color: #eee;
-    
-    white-space: pre-wrap; /* CSS2.1 compliant */
-    white-space: -moz-pre-wrap; /* Mozilla-based browsers */
-    white-space: o-pre-wrap; /* Opera 7+ */
-}
-
-#sgvzl_example_table{
-    width: 800px;
-    height: 200px;
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/index.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/index.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/index.html
deleted file mode 100644
index 56f5964..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html
-  PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler Examples</title>
-   </head>
-   <frameset cols="20%,80%" id="frames">
-      <frame src="menuframe.html" name="menu" frameborder="0">
-      <frame src="mainframe.html" name="main" frameborder="0">
-   </frameset>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/mainframe.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/mainframe.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/mainframe.html
deleted file mode 100644
index bfe16ec..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/mainframe.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css">
-   </head>
-   <body>
-      <div id="logo"><a href="http://code.google.com/p/sgvizler/"><img src="http://sgvizler.googlecode.com/svn/www/mr.sgvizler.png" alt="mr.sgvizler.png"></a><br>Mr. Sgvizler
-         
-      </div>
-      <h1>Sgvizler Examples</h1>
-      <p>
-         	    Many live examples of using <a href="http://code.google.com/p/sgvizler/">Sgvizler</a> are
-         	    gathered here. Each example page contains a chart drawn by
-         	    Sgvizler on page load (some can take a while, so be
-         	    patient, i.e, a few seconds), a listing of the
-         	    <code>&lt;div&gt;</code> element which specifies the
-         	    chart, and the query results in a table. Additionally,
-         	    some pages may also contain other charts visualizing the
-         	    exact same query results.
-         	  
-      </p>
-      <p>
-         	    If you're not seeing this page as frames there is a <a href="index.html" target="frames">frames version</a> which
-         	    might be more handy.
-         	  
-      </p>
-      <h2>Examples</h2>
-      <h3>NPD</h3>
-      <ul>
-         <li><a href="exNPD1.html" target="main">gColumnChart, gBarChart, gLineChart, gAreaChart, gSteppedAreaChart</a></li>
-         <li><a href="exNPD2.html" target="main">gColumnChart, gBarChart, gLineChart, gAreaChart, gSteppedAreaChart</a></li>
-         <li><a href="exNPD3.html" target="main">gPieChart, gBarChart, gColumnChart</a></li>
-         <li><a href="exNPD4.html" target="main">gGeoChart, gGeoMap</a></li>
-         <li><a href="exNPD5.html" target="main">gMotionChart</a></li>
-         <li><a href="exNPD6.html" target="main">gTreeMap</a></li>
-         <li><a href="exNPD7.html" target="main">gOrgChart</a></li>
-         <li><a href="exNPD8.html" target="main">gTimeline</a></li>
-         <li><a href="exNPD9.html" target="main">sMap</a></li>
-         <li><a href="exNPD10.html" target="main">gSparkline</a></li>
-      </ul>
-      <h3>DBpedia</h3>
-      <ul>
-         <li><a href="exDBpedia1.html" target="main">sMap</a></li>
-      </ul>
-      <h3>World</h3>
-      <ul>
-         <li><a href="exWorld1.html" target="main">gBarChart, gColumnChart, gLineChart, gGeoChart, sList</a></li>
-         <li><a href="exWorld2.html" target="main">gMap</a></li>
-         <li><a href="exWorld3.html" target="main">gScatterChart</a></li>
-         <li><a href="exWorld4.html" target="main">gBubbleChart</a></li>
-         <li><a href="exWorld5.html" target="main">gTreeMap</a></li>
-         <li><a href="exWorld6.html" target="main">gGeoMap, gGeoChart, gPieChart</a></li>
-         <li><a href="exWorld7.html" target="main">dForceGraph</a></li>
-      </ul>
-      <h3>FROM</h3>
-      <ul>
-         <li><a href="exFROM1.html" target="main">dForceGraph, sList</a></li>
-      </ul>
-      <h2>Endpoints</h2>
-      <dl>
-         <dt>NPD</dt>
-         <dd>
-            <description>
-               	<a href="http://sws.ifi.uio.no/project/npd">Linked Open NPD
-                  	Fact-pages</a>
-               	(endpoint <a href="http://sws.ifi.uio.no/sparql/world"><code>http://sws.ifi.uio.no/sparql/world</code></a>)
-               	contains data collected from the Norwegian Petroleum
-               	Directorate's (NPD) "FactPages", which is a database about the
-               	activity on the Norwegian Continental Shelf, e.g. oil fields,
-               	wellbores, drilling and production.
-               
-            </description>
-         </dd>
-         <dt>DBpedia</dt>
-         <dd>
-            <description>
-               	<a href="http://dbpedia.org">dbpedia.org</a> (endpoint <a href="http://dbpedia.org/sparql"><code>http://dbpedia.org/sparql</code></a>)
-               	is probably well-known to you since you read this. Sometimes
-               	the dbpedia endpoint is slow to respond.
-               
-            </description>
-         </dd>
-         <dt>World</dt>
-         <dd>
-            <description>
-               	The "world" database (endpoint <a href="http://sws.ifi.uio.no/sparql/world"><code>http://sws.ifi.uio.no/sparql/world</code></a>)
-               	contains data about the cities, countries, continents, and so
-               	on, of the world. The data is not up do date, but it serves
-               	well as an example database for this purpose. The data source
-               	for this dataset is a world database which ships with <a href="http://mysql.com">MySQL</a>.
-               
-            </description>
-         </dd>
-         <dt>FROM</dt>
-         <dd>
-            <description>
-               	The "FROM" section queries RDF files listed in the same html
-               	element as the query. The RDF files may wary from query to
-               	query.
-               
-            </description>
-         </dd>
-      </dl>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/menuframe.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/menuframe.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/menuframe.html
deleted file mode 100644
index 3d12b8d..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/example/menuframe.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-      <title>Sgvizler</title>
-      <meta charset="UTF-8">
-      <link rel="shortcut icon" href="http://sgvizler.googlecode.com/svn/www/favicon.ico">
-      <link rel="stylesheet" type="text/css" href="http://sgvizler.googlecode.com/svn/www/sgvizler.css">
-      <link rel="stylesheet" type="text/css" href="examples.css">
-   </head>
-   <body id="menu">
-      <p><a href="mainframe.html" target="main">Overview</a></p>
-      <h2>Examples</h2>
-      <h3>NPD</h3>
-      <ul>
-         <li><a href="exNPD1.html" target="main">gColumnChart, gBarChart, gLineChart, gAreaChart, gSteppedAreaChart</a></li>
-         <li><a href="exNPD2.html" target="main">gColumnChart, gBarChart, gLineChart, gAreaChart, gSteppedAreaChart</a></li>
-         <li><a href="exNPD3.html" target="main">gPieChart, gBarChart, gColumnChart</a></li>
-         <li><a href="exNPD4.html" target="main">gGeoChart, gGeoMap</a></li>
-         <li><a href="exNPD5.html" target="main">gMotionChart</a></li>
-         <li><a href="exNPD6.html" target="main">gTreeMap</a></li>
-         <li><a href="exNPD7.html" target="main">gOrgChart</a></li>
-         <li><a href="exNPD8.html" target="main">gTimeline</a></li>
-         <li><a href="exNPD9.html" target="main">sMap</a></li>
-         <li><a href="exNPD10.html" target="main">gSparkline</a></li>
-      </ul>
-      <h3>DBpedia</h3>
-      <ul>
-         <li><a href="exDBpedia1.html" target="main">sMap</a></li>
-      </ul>
-      <h3>World</h3>
-      <ul>
-         <li><a href="exWorld1.html" target="main">gBarChart, gColumnChart, gLineChart, gGeoChart, sList</a></li>
-         <li><a href="exWorld2.html" target="main">gMap</a></li>
-         <li><a href="exWorld3.html" target="main">gScatterChart</a></li>
-         <li><a href="exWorld4.html" target="main">gBubbleChart</a></li>
-         <li><a href="exWorld5.html" target="main">gTreeMap</a></li>
-         <li><a href="exWorld6.html" target="main">gGeoMap, gGeoChart, gPieChart</a></li>
-         <li><a href="exWorld7.html" target="main">dForceGraph</a></li>
-      </ul>
-      <h3>FROM</h3>
-      <ul>
-         <li><a href="exFROM1.html" target="main">dForceGraph, sList</a></li>
-      </ul>
-   </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.geom.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.geom.min.js b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.geom.min.js
deleted file mode 100644
index 2dc6395..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.geom.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){function c(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b===0?(b=c+1,c=0):(b-=1,c+=1)}}function d(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function e(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function f(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function h(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){va
 r b=d.leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l,b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[g[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y<i.y||h.y==i.y&&h.x<i.x?(j=a,k=c):(j=b,k=d);var l=f>=k.region.r.x;return l&&j.side==="l"||!l&&j.side==="r"?null:{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side==="l")return 1;if(!e&&a.side=
 =="r")return 0;if(c.a===1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)<j*f*(1+2*g/j+c.b*c.b),c.b<0&&(i=!i)}}else{var k=c.c-c.a*b.x,l=b.y-k,m=b.x-d.x,n=k-d.y;i=l*l>m*m+n*n}return a.side==="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;if(!a.ep[g[c]])return;b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;d<g;d++){var h=e[d];if(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return f.list.length===0},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=
 c.list.shift();var h=c.list.shift(),i,j,k,l,m,n,o,p,q,r,s,t,u;for(;;){f.empty()||(i=f.min());if(h&&(f.empty()||h.y<i.y||h.y==i.y&&h.x<i.x))j=d.leftBound(h),k=d.right(j),o=d.rightRegion(j),t=e.bisect(o,h),n=d.createHalfEdge(t,"l"),d.insert(j,n),r=e.intersect(j,n),r&&(f.del(j),f.insert(j,r,e.distance(r,h))),j=n,n=d.createHalfEdge(t,"r"),d.insert(j,n),r=e.intersect(n,k),r&&f.insert(n,r,e.distance(r,h)),h=c.list.shift();else if(!f.empty())j=f.extractMin(),l=d.left(j),k=d.right(j),m=d.right(k),o=d.leftRegion(j),p=d.rightRegion(k),s=j.vertex,e.endPoint(j.edge,j.side,s),e.endPoint(k.edge,k.side,s),d.del(j),f.del(k),d.del(k),u="l",o.y>p.y&&(q=o,o=p,p=q,u="r"),t=e.bisect(o,p),n=d.createHalfEdge(t,u),d.insert(l,n),e.endPoint(t,g[u],s),r=e.intersect(l,n),r&&(f.del(l),f.insert(l,r,e.distance(r,o))),r=e.intersect(n,m),r&&f.insert(n,r,e.distance(r,o));else break}for(j=d.right(d.leftEnd);j!=d.rightEnd;j=d.right(j))b(j.edge)}function i(){return{leaf:!0,nodes:[],point:null}}function j(a,b,c,d,e,f){i
 f(!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&j(a,i[0],c,d,g,h),i[1]&&j(a,i[1],g,d,e,h),i[2]&&j(a,i[2],c,h,g,f),i[3]&&j(a,i[3],g,h,e,f)}}function k(a){return{x:a[0],y:a[1]}}d3.geom={},d3.geom.contour=function(d,e){var f=e||c(d),g=[],h=f[0],i=f[1],j=0,k=0,l=NaN,m=NaN,n=0;do n=0,d(h-1,i-1)&&(n+=1),d(h,i-1)&&(n+=2),d(h-1,i)&&(n+=4),d(h,i)&&(n+=8),n===6?(j=m===-1?-1:1,k=0):n===9?(j=0,k=l===1?-1:1):(j=a[n],k=b[n]),j!=l&&k!=m&&(g.push([h,i]),l=j,m=k),h+=j,i+=k;while(f[0]!=h||f[1]!=i);return g};var a=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],b=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(a){if(a.length<3)return[];var b=a.length,c=b-1,e=[],f=[],g,h,i=0,j,k,l,m,n,o,p,q;for(g=1;g<b;++g)a[g][1]<a[i][1]?i=g:a[g][1]==a[i][1]&&(i=a[g][0]<a[i][0]?g:i);for(g=0;g<b;++g){if(g===i)continue;k=a[g][1]-a[i][1],j=a[g][0]-a[i][0],e.push({angle:Math.atan2(k,j),index:g})}e.sort(function(a,b){return a.angle-b.angle}),p=e[0].angle,o=e[0].index,n=0;for(g=1;g<c;++g)h=e[g].index,p==e[g
 ].angle?(j=a[o][0]-a[i][0],k=a[o][1]-a[i][1],l=a[h][0]-a[i][0],m=a[h][1]-a[i][1],j*j+k*k>=l*l+m*m?e[g].index=-1:(e[n].index=-1,p=e[g].angle,n=g,o=h)):(p=e[g].angle,n=g,o=h);f.push(i);for(g=0,h=0;g<2;++h)e[h].index!==-1&&(f.push(e[h].index),g++);q=f.length;for(;h<c;++h){if(e[h].index===-1)continue;while(!d(f[q-2],f[q-1],e[h].index,a))--q;f[q++]=e[h].index}var r=[];for(g=0;g<q;++g)r.push(a[f[g]]);return r},d3.geom.polygon=function(a){return a.area=function(){var b=0,c=a.length,d=a[c-1][0]*a[0][1],e=a[c-1][1]*a[0][0];while(++b<c)d+=a[b-1][0]*a[b][1],e+=a[b-1][1]*a[b][0];return(e-d)*.5},a.centroid=function(b){var c=-1,d=a.length-1,e=0,f=0,g,h,i;arguments.length||(b=-1/(6*a.area()));while(++c<d)g=a[c],h=a[c+1],i=g[0]*h[1]-h[0]*g[1],e+=(g[0]+h[0])*i,f+=(g[1]+h[1])*i;return[e*b,f*b]},a.clip=function(b){var c,d=-1,g=a.length,h,i,j=a[g-1],k,l,m;while(++d<g){c=b.slice(),b.length=0,k=a[d],l=c[(i=c.length)-1],h=-1;while(++h<i)m=c[h],e(m,j,k)?(e(l,j,k)||b.push(f(l,m,j,k)),b.push(m)):e(l,j,k)&&b.
 push(f(l,m,j,k)),l=m;j=k}return b},a},d3.geom.voronoi=function(a){var b=a.map(function(){return[]});return h(a,function(a){var c,d,e,f,g,h;a.a===1&&a.b>=0?(c=a.ep.r,d=a.ep.l):(c=a.ep.l,d=a.ep.r),a.a===1?(g=c?c.y:-1e6,e=a.c-a.b*g,h=d?d.y:1e6,f=a.c-a.b*h):(e=c?c.x:-1e6,g=a.c-a.a*e,f=d?d.x:1e6,h=a.c-a.a*f);var i=[e,g],j=[f,h];b[a.region.l.index].push(i,j),b[a.region.r.index].push(i,j)}),b.map(function(b,c){var d=a[c][0],e=a[c][1];return b.forEach(function(a){a.angle=Math.atan2(a[0]-d,a[1]-e)}),b.sort(function(a,b){return a.angle-b.angle}).filter(function(a,c){return!c||a.angle-b[c-1].angle>1e-10})})};var g={l:"r",r:"l"};d3.geom.delaunay=function(a){var b=a.map(function(){return[]}),c=[];return h(a,function(c){b[c.region.l.index].push(a[c.region.r.index])}),b.forEach(function(b,d){var e=a[d],f=e[0],g=e[1];b.forEach(function(a){a.angle=Math.atan2(a[0]-f,a[1]-g)}),b.sort(function(a,b){return a.angle-b.angle});for(var h=0,i=b.length-1;h<i;h++)c.push([e,b[h],b[h+1]])}),c},d3.geom.quadtree=f
 unction(a,b,c,d,e){function n(a,b,c,d,e,f){if(isNaN(b.x)||isNaN(b.y))return;if(a.leaf){var g=a.point;g?Math.abs(g.x-b.x)+Math.abs(g.y-b.y)<.01?o(a,b,c,d,e,f):(a.point=null,o(a,g,c,d,e,f),o(a,b,c,d,e,f)):a.point=b}else o(a,b,c,d,e,f)}function o(a,b,c,d,e,f){var g=(c+e)*.5,h=(d+f)*.5,j=b.x>=g,k=b.y>=h,l=(k<<1)+j;a.leaf=!1,a=a.nodes[l]||(a.nodes[l]=i()),j?c=g:e=g,k?d=h:f=h,n(a,b,c,d,e,f)}var f,g=-1,h=a.length;h&&isNaN(a[0].x)&&(a=a.map(k));if(arguments.length<5)if(arguments.length===3)e=d=c,c=b;else{b=c=Infinity,d=e=-Infinity;while(++g<h)f=a[g],f.x<b&&(b=f.x),f.y<c&&(c=f.y),f.x>d&&(d=f.x),f.y>e&&(e=f.y);var l=d-b,m=e-c;l>m?e=c+l:d=b+m}var p=i();return p.add=function(a){n(p,a,b,c,d,e)},p.visit=function(a){j(a,p,b,c,d,e)},a.forEach(p.add),p}})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f14c7b0b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.layout.min.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.layout.min.js b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.layout.min.js
deleted file mode 100644
index d5fc1ba..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/d3.layout.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;return b.push(a),b}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function g(a){a.fixed|=2}function h(a){a!==f&&(a.fixed&=1)}function i(){j(),f.fixed&=1,e=f=null}function j(){f.px+=d3.event.dx,f.py+=d3.event.dy,e.resume()}function k(a,b,c){var d=0,e=0;a.charge=0;if(!a.leaf){var f=a.nodes,g=f.length,h=-1,i;while(++h<g){i=f[h];if(i==null)continue;k(i,b,c),a.charge+=i.charge,d+=i.charge*i.cx,e+=i.charge*i.cy}}if(a.point){a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5);var j=b*c[a.point.index];a.charge+=a.pointCharge=j,d+=j*a.point.x,e+=j*a.point.y}a.cx=d/a.charge,a.cy=e/a.charge}function l(a){return 20}function m(a){return 1}function n(a){return a.x}function o(
 a){return a.y}function p(a,b,c){a.y0=b,a.y=c}function s(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function t(a){return a.reduce(u,0)}function u(a,b){return a+b[1]}function v(a,b){return w(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function w(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function x(a){return[d3.min(a),d3.max(a)]}function y(a,b){return a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=C,a.value=d3.rebind(a,b.value),a.nodes=function(b){return D=!0,(a.nodes=a)(b)},a}function z(a){return a.children}function A(a){return a.value}function B(a,b){return b.value-a.value}function C(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function E(a,b){return a.value-b.value}function F(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function G(a,b){a._pack_next=b,b._pack_prev=a}function H(a,b){var c=b.
 x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function I(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(J),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],N(g,h,i),l(i),F(g,i),g._pack_prev=i,F(i,h),h=g._pack_next;for(var m=3;m<f;m++){N(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(H(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(H(k,i)){p<o&&(n=-1,j=k);break}n==0?(F(g,i),h=i,l(i)):n>0?(G(g,j),h=j,m--):(G(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}return a.forEach(K),s}function J(a){a._pack_next=a._pack_prev=a}function K(a){delete a._pack_next,delete a._pack_prev}function L(a){var b=a.children;b&&b.length?(b.forEach(L),a.r=I(b)):a.r=Math.sqrt(a.value)}function M(
 a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)M(e[f],b,c,d)}}function N(a,b,c){var d=a.r+c.r,e=b.x-a.x,f=b.y-a.y;if(d&&(e||f)){var g=b.r+c.r,h=Math.sqrt(e*e+f*f),i=Math.max(-1,Math.min(1,(d*d+h*h-g*g)/(2*d*h))),j=Math.acos(i),k=i*(d/=h),l=Math.sin(j)*d;c.x=a.x+k*e+l*f,c.y=a.y+k*f-l*e}else c.x=a.x+d,c.y=a.y}function O(a){return 1+d3.max(a,function(a){return a.y})}function P(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function Q(a){var b=a.children;return b&&b.length?Q(b[0]):a}function R(a){var b=a.children,c;return b&&(c=b.length)?R(b[c-1]):a}function S(a,b){return a.parent==b.parent?1:2}function T(a){var b=a.children;return b&&b.length?b[0]:a._tree.thread}function U(a){var b=a.children,c;return b&&(c=b.length)?b[c-1]:a._tree.thread}function V(a,b){var c=a.children;if(c&&(e=c.length)){var d,e,f=-1;while(++f<e)b(d=V(c[f],b),a)>0&&(a=d)}return a}function W(a,b){return a.x-b.x}function X(a,b){return b.x-a.x}function Y(a,b
 ){return a.depth-b.depth}function Z(a,b){function c(a,d){var e=a.children;if(e&&(i=e.length)){var f,g=null,h=-1,i;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function $(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function _(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function ba(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bb(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function bc(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];return e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0),{x:c,y:d,dx:e,dy:f}}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(func
 tion(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[s][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}function k(){b.sort(function(a,b){return i((a.source.value+a.target.value)/2,(b.source.value+b.target.value)/2)})}var a={},b,c,d,e,f=0,g,h,i;return a.matrix=function(f){return arguments.length?(e=(d=f)&&d.length,b=c=null,a):d},a.padding=function(d){return arguments.length?(f=d,b=c=null,a):f},a.sortGroups=function(d){return arguments.length?(g=d,b=c=null,a):g},a.sortSubgroups=function(c){return arguments.length?(h=c,b=null,a):h},a.sortChords=function(c){return arguments.length?(i=c,b&&k(),a):i},a.ch
 ords=function(){return b||j(),b},a.groups=function(){return c||j(),c},a},d3.layout.force=function(){function A(a){return function(b,c,d,e,f){if(b.point!==a){var g=b.cx-a.x,h=b.cy-a.y,i=1/Math.sqrt(g*g+h*h);if((e-c)*i<t){var j=b.charge*i*i;return a.px-=g*j,a.py-=h*j,!0}if(b.point&&isFinite(i)){var j=b.pointCharge*i*i;a.px-=g*j,a.py-=h*j}}return!b.charge}}function B(){var a=v.length,d=w.length,e,f,g,h,i,j,l,m,p;for(f=0;f<d;++f){g=w[f],h=g.source,i=g.target,m=i.x-h.x,p=i.y-h.y;if(j=m*m+p*p)j=n*y[f]*((j=Math.sqrt(j))-x[f])/j,m*=j,p*=j,i.x-=m*(l=h.weight/(i.weight+h.weight)),i.y-=p*l,h.x+=m*(l=1-l),h.y+=p*l}if(l=n*s){m=c[0]/2,p=c[1]/2,f=-1;if(l)while(++f<a)g=v[f],g.x+=(m-g.x)*l,g.y+=(p-g.y)*l}if(r){k(e=d3.geom.quadtree(v),n,z),f=-1;while(++f<a)(g=v[f]).fixed||e.visit(A(g))}f=-1;while(++f<a)g=v[f],g.fixed?(g.x=g.px,g.y=g.py):(g.x-=(g.px-(g.px=g.x))*o,g.y-=(g.py-(g.py=g.y))*o);return b.tick.dispatch({type:"tick",alpha:n}),(n*=.99)<.005}function C(b){g(f=b),e=a}var a={},b=d3.dispatch("tick"
 ),c=[1,1],d,n,o=.9,p=l,q=m,r=-30,s=.1,t=.8,u,v=[],w=[],x,y,z;return a.on=function(c,d){return b[c].add(d),a},a.nodes=function(b){return arguments.length?(v=b,a):v},a.links=function(b){return arguments.length?(w=b,a):w},a.size=function(b){return arguments.length?(c=b,a):c},a.linkDistance=function(b){return arguments.length?(p=d3.functor(b),a):p},a.distance=a.linkDistance,a.linkStrength=function(b){return arguments.length?(q=d3.functor(b),a):q},a.friction=function(b){return arguments.length?(o=b,a):o},a.charge=function(b){return arguments.length?(r=typeof b=="function"?b:+b,a):r},a.gravity=function(b){return arguments.length?(s=b,a):s},a.theta=function(b){return arguments.length?(t=b,a):t},a.start=function(){function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=w[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}var b,d,e=v.len
 gth,f=w.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=v[b]).index=b,j.weight=0;x=[],y=[];for(b=0;b<f;++b)j=w[b],typeof j.source=="number"&&(j.source=v[j.source]),typeof j.target=="number"&&(j.target=v[j.target]),x[b]=p.call(this,j,b),y[b]=q.call(this,j,b),++j.source.weight,++j.target.weight;for(b=0;b<e;++b)j=v[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);z=[];if(typeof r=="function")for(b=0;b<e;++b)z[b]=+r.call(this,v[b],b);else for(b=0;b<e;++b)z[b]=r;return a.resume()},a.resume=function(){return n=.1,d3.timer(B),a},a.stop=function(){return n=0,a},a.drag=function(){d||(d=d3.behavior.drag().on("dragstart",C).on("drag",j).on("dragend",i)),this.on("mouseover.force",g).on("mouseout.force",h).call(d)},a};var e,f;d3.layout.partition=function(){function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f&&(h=f.length)){var g=-1,h,i,j;d=a.value?d/a.value:0;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}function d(a){var b
 =a.children,c=0;if(b&&(f=b.length)){var e=-1,f;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function e(e,f){var g=a.call(this,e,f);return c(g[0],0,b[0],b[1]/d(g[0])),g}var a=d3.layout.hierarchy(),b=[1,1];return e.size=function(a){return arguments.length?(b=a,e):b},y(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;return f.value=function(b){return arguments.length?(a=b,f):a},f.sort=function(a){return arguments.length?(b=a,f):b},f.startAngle=function(a){return arguments.length?(c=a,f):c},f.endAngle=function(a){return arguments.length?(e=a,f):e},f},d3.layout.stack=function(){function g(h,i)
 {var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=q["default"],c=r.zero,d=p,e=n,f=o;return g.values=function(b){return arguments.length?(a=b,g):a},g.order=function(a){return arguments.length?(b=typeof a=="function"?a:q[a],g):b},g.offset=function(a){return arguments.length?(c=typeof a=="function"?a:r[a],g):c},g.x=function(a){return arguments.length?(e=a,g):e},g.y=function(a){return arguments.length?(f=a,g):f},g.out=function(a){return arguments.length?(d=a,g):d},g};var q={"inside-out":function(a){var b=a.length,c,d,e=a.map(s),f=a.map(t),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],
 k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},r={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=funct
 ion(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]));return g}var a=!0,b=Number,c=x,d=v;return e.value=function(a){return arguments.length?(b=a,e):b},e.range=function(a){return arguments.length?(c=d3.functor(a),e):c},e.bins=function(a){return arguments.length?(d=typeof a=="number"?function(b){return w(b,a)}:d3.functor(a),e):d},e.frequency=function(b){return arguments.length?(a=!!b,e):a},e},d3.layout.hierarchy=function(){function e(f,h,i){var j=b.call(g,f,h),k=D?f:{data:f};k.depth=h,i.push(k);if(j&&(m=j.length)){var l=-1,m,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=+c.call(g,f,h)||0);return k}function f(a,b){var d=a.children,e=0;if(d&&(i=d.length)){var h=-1,i,j=b+1;while(++h<i)e+=f(d[h
 ],j)}else c&&(e=+c.call(g,D?a:a.data,b)||0);return c&&(a.value=e),e}function g(a){var b=[];return e(a,0,b),b}var a=B,b=z,c=A;return g.sort=function(b){return arguments.length?(a=b,g):a},g.children=function(a){return arguments.length?(b=a,g):b},g.value=function(a){return arguments.length?(c=a,g):c},g.revalue=function(a){return f(a,0),a},g};var D=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,L(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);return M(f,g/2,h/2,i),e}var a=d3.layout.hierarchy().sort(E),b=[1,1];return c.size=function(a){return arguments.length?(b=a,c):b},y(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;Z(g,function(a){var c=a.children;c&&c.length?(a.x=P(c),a.y=O(c)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=Q(g),m=R(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;return Z(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-a.y/g.y)*c[1]}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=S,c=[1,1];return d.
 separation=function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},y(d,a)},d3.layout.tree=function(){function d(d,e){function h(a,c){var d=a.children,e=a._tree;if(d&&(f=d.length)){var f,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;$(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c&&(e=c.length)){var d=-1,e;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=U(g),e=T(e),g&&e)h=T(h),f=U(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(_(ba(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!U(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!T(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}var f=a.cal
 l(this,d,e),g=f[0];Z(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=V(g,X),l=V(g,W),m=V(g,Y),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;return Z(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=S,c=[1,1];return d.separation=function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},y(d,a)},d3.layout.treemap=function(){function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}function j(a){var b=a.children;if(b&&b.length){var c=e(a),d=[],f=b.slice(),g,h=Infinity,k,n=Math.min(c.dx,c.dy),o;i(f,c.dx*c.dy/a.value),d.area=0;while((o=f.length)>0)d.push(g=f[o-1]),d.area+=g.area,(k=l(d,n))<=h?(f.pop(),h=k):(d.area-=d.pop().area,m(d,n,c,!1),n=Math.min(c.dx,c.dy),d.length=d.area=0,h=Infinity);d.length&&(m(d,n,c,!0),d.length=d.area=0),b.forEach(j)
 }}function k(a){var b=a.children;if(b&&b.length){var c=e(a),d=b.slice(),f,g=[];i(d,c.dx*c.dy/a.value),g.area=0;while(f=d.pop())g.push(f),g.area+=f.area,f.z!=null&&(m(g,f.z?c.dx:c.dy,c,!d.length),g.length=g.area=0);b.forEach(k)}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){if(!(d=a[g].area))continue;d<f&&(f=d),d>e&&(e=d)}return c*=c,b*=b,c?Math.max(b*e*h/c,c/(b*f*h)):Infinity}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=j?d.dy:0;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=j?b(k.area/j):0;k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=j?d.dx:0;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=j?b(k.area/j):0;k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function n(b){var d=g||a(b),e=d[0];return e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d),d}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=null,e=bb,f=!1,g,h=.5*(1+Math.sqrt(5));return n.size=function
 (a){return arguments.length?(c=a,n):c},n.padding=function(a){function b(b){var c=a.call(n,b,b.depth);return c==null?bb(b):bc(b,typeof c=="number"?[c,c,c,c]:c)}function c(b){return bc(b,a)}if(!arguments.length)return d;var f;return e=(d=a)==null?bb:(f=typeof a)==="function"?b:f==="number"?(a=[a,a,a,a],c):c,n},n.round=function(a){return arguments.length?(b=a?Math.round:Number,n):b!=Number},n.sticky=function(a){return arguments.length?(f=a,g=null,n):f},n.ratio=function(a){return arguments.length?(h=a,n):h},y(n,a)}})();
\ No newline at end of file


[33/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/index.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/index.html b/extras/webjars/codemirror/src/main/resources/index.html
new file mode 100644
index 0000000..3fef19a
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/index.html
@@ -0,0 +1,242 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!doctype html>
+<html>
+<head>
+<title>CodeMirror: LDPath Demo</title>
+<link rel="stylesheet" href="codemirror.css">
+<link rel="stylesheet" href="simple-hint.css">
+
+    <script type="text/javascript" src="../../../webjars/jquery/1.8.2/jquery.min.js"></script>
+
+<script src="codemirror.js"></script>
+<script src="simple-hint.js"></script>
+<script src="ldpath.js"></script>
+
+<link rel="stylesheet" href="ldpath.css">
+
+<style type="text/css">
+.CodeMirror {
+    border: 1px solid #eee;
+}
+
+td {
+    padding-right: 20px;
+}
+body {
+  font-family: Droid Sans, Arial, sans-serif;
+  line-height: 1.5;
+  max-width: 64.3em;
+  margin: 3em auto;
+  padding: 0 1em;
+}
+
+h1 {
+  letter-spacing: -3px;
+  font-size: 3.23em;
+  font-weight: bold;
+  margin: 0;
+}
+
+h2 {
+  font-size: 1.23em;
+  font-weight: bold;
+  margin: .5em 0;
+  letter-spacing: -1px;
+}
+
+h3 {
+  font-size: 1em;
+  font-weight: bold;
+  margin: .4em 0;
+}
+
+pre {
+  background-color: #eee;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: 1em;
+}
+
+pre.code {
+  margin: 0 1em;
+}
+
+.grey {
+  font-size: 2.2em;
+  padding: .5em 1em;
+  line-height: 1.2em;
+  margin-top: .5em;
+  position: relative;
+}
+
+img.logo {
+  position: absolute;
+  right: -25px;
+  bottom: 4px;
+}
+
+a:link, a:visited, .quasilink {
+  color: #df0019;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+a:hover, .quasilink:hover {
+  color: #800004;
+}
+
+h1 a:link, h1 a:visited, h1 a:hover {
+  color: black;
+}
+
+ul {
+  margin: 0;
+  padding-left: 1.2em;
+}
+
+a.download {
+  color: white;
+  background-color: #df0019;
+  width: 100%;
+  display: block;
+  text-align: center;
+  font-size: 1.23em;
+  font-weight: bold;
+  text-decoration: none;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: .5em 0;
+  margin-bottom: 1em;
+}
+
+a.download:hover {
+  background-color: #bb0010;
+}
+
+.rel {
+  margin-bottom: 0;
+}
+
+.rel-note {
+  color: #777;
+  font-size: .9em;
+  margin-top: .1em;
+}
+
+.logo-braces {
+  color: #df0019;
+  position: relative;
+  top: -4px;
+}
+
+.blk {
+  float: left;
+}
+
+.left {
+  width: 37em;
+  padding-right: 6.53em;
+  padding-bottom: 1em;
+}
+
+.left1 {
+  width: 15.24em;
+  padding-right: 6.45em;
+}
+
+.left2 {
+  width: 15.24em;
+}
+
+.right {
+  width: 20.68em;
+}
+
+.leftbig {
+  width: 42.44em;
+  padding-right: 6.53em;
+}
+
+.rightsmall {
+  width: 15.24em;
+}
+
+.clear:after {
+  visibility: hidden;
+  display: block;
+  font-size: 0;
+  content: " ";
+  clear: both;
+  height: 0;
+}
+.clear { display: inline-block; }
+/* start commented backslash hack \*/
+* html .clear { height: 1%; }
+.clear { display: block; }
+/* close commented backslash hack */
+</style>
+</head>
+<body>
+  <h1>CodeMirror: LDPath demo</h1>
+  <div>
+    <button onclick="javascript:createEditor()">Editor</button>
+    <button onclick="javascript:removeEditor()">Plain</button>
+  </div>
+  <form>
+    <textarea id="code" name="code">
+@prefix iptc : <http://iptc.org/std/nar/2006-10-01/> ;
+@prefix foaf ;
+@prefix rss: ;
+@prefix sioc: ;
+@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
+  date = dc:date :: xsd:date(multiValued="false") ;
+  desc = dc:description[@de] :: lmf:text_en ;
+  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
+  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
+  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
+  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
+  user = dc:creator :: xsd:string(multiValue="false") ;
+</textarea>
+  </form>
+  <script>
+            var editor = null;
+            function createEditor() {
+                if (editor === null) {
+                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                        lineNumbers : true,
+                        matchBrackets : true,
+						extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
+                        mode : "ldpath"
+                    });
+                }
+            }
+            function removeEditor() {
+                if (editor) {
+                    editor.toTextArea();
+                    editor = null;
+                }
+            }
+            createEditor();
+        </script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/ldpath.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/ldpath.js b/extras/webjars/codemirror/src/main/resources/ldpath.js
new file mode 100644
index 0000000..016142f
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/ldpath.js
@@ -0,0 +1,445 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+if (CodeMirror && CodeMirror.defineMode) {
+CodeMirror.defineMode("ldpath", function(config, parserConfig) {
+    var token = {
+        OP: "operator",
+        KWD: "keyword",
+        PREFIX: "qualifier",
+        IDENT: "atom",
+        DEF: "builtin",
+        TEST: "meta",
+        URL: "link",
+        STR: "string",
+        INT: "number",
+        BRACKET: "bracket",
+        WARNING: "string-2",
+        ERROR: "error"
+    },
+        predefinedNamespaces = parserConfig.namespaces || {},
+        baseURL = parserConfig.baseURL || null;
+    
+    function log(stream, status, result) {
+        return;
+        if (console && console.log) {
+            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
+        }
+    }
+    
+    function getInitialState() {
+        return {
+            tmp: {},
+            namespaces: {},
+            predefinedNamespaces: predefinedNamespaces,
+            lmfBaseURL: baseURL,
+            stack: ['default'],
+            /* STACKING */
+            push: function(next) {
+                this.stack.unshift(next);
+            },
+            pop: function() {
+                if (this.stack.length <= 1) {
+                    return this.current();
+                } else {
+                    return this.stack.shift();
+                }
+            },
+            current: function() {
+                return this.stack[0];
+            },
+            reset: function() {
+                this.stack = ['default'];
+                this.tmp = {};
+            },
+            height: function() {
+                return this.stack.length;
+            },
+            /* PARSING */
+            parser: function(stream, state) {
+                var parser = parsers[this.current()] || parsers['default'];
+                return parser(stream, state);
+            },
+            /* NAMESPACES */
+            addPrefix: function(prefix, namespace) {
+                if (prefix && namespace)
+                    this.namespaces[prefix] = namespace;
+            },
+            getNamespace: function(prefix) {
+                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
+            }
+        };
+    }
+
+    function tokenError(stream, state) {
+        if (state.current() !== 'error') state.push('error');
+        stream.skipToEnd();
+        return token.ERROR;
+    }
+    
+    function tokenDefault(stream, state) {
+        // @...
+        var kw = stream.match(/^@(\w+)/, true);
+        if (kw) {
+            state.push(kw[1]);
+            return token.KWD;
+        }
+
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        }
+        if (stream.eat('[')) {
+            state.push('test');
+            return token.BRACKET;
+        }
+        if (stream.eat('(')) {
+            if (state.current() == "transformer") {
+                state.push('config');
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(')')) {
+            if (state.current() == "config") {
+                state.pop();
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(/[\]>\{\}]/)) {
+            return token.BRACKET;
+        }
+
+        // prefix:label
+        if (stream.match(/^\w+:\w*/, false)) {
+            stream.skipTo(":")
+            if (state.current() == 'prefix') {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            } else {
+                px = stream.current();
+                stream.eat(':');
+                if (state.getNamespace(px))
+                return token.PREFIX;
+                else return token.WARNING;
+            }
+        }
+
+        if (stream.match("=", true)) {
+            if (state.current() == "default") {
+                state.push("path");
+            }
+            return token.DEF;
+        }
+        if (stream.match("::", true)) {
+            state.push("transformer");
+            return token.DEF;
+        }
+        // OPERATORS
+        if (stream.eat(/[:,&\|\/^\+\*.]/)) {
+            return token.OP;
+        }
+
+        if (stream.eat('"')) {
+            if (stream.skipTo('"') && stream.eat('"'))
+                return token.STR;
+            return tokenError(stream, state);
+        }
+        
+        // NUMBERS
+        if (stream.match(/^\d+/, true)) {
+            return token.INT;
+        }
+
+        // IDENT
+        if (state.current() == "prefix") {
+            if (stream.match(/^\w+/, true)) {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            }
+        } else {
+            if (stream.match(/^[\w.-]+/, true)) {
+                return token.IDENT;
+            }
+        }
+
+        return tokenError(stream, state);
+    }
+
+    function tokenURL(stream, state) {
+        if (stream.eat('>')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.skipTo('>')) {
+            //state.pop();
+            var url = stream.current();
+            if (url.search(/^https?:\/\//) < 0 || url.search(/\s/) >= 0) {
+                return token.ERROR;
+            }
+            if (state.stack.indexOf("prefix") >= 0) {
+                state.tmp["ns"] = url;
+            }
+            return token.URL;
+        }
+        return tokenError(stream, state);
+    }
+
+    function tokenTest(stream, state) {
+        if (stream.eat(']')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.match(/@\w+/, true) || stream.match("^^", true)) {
+            return token.TEST;
+        }
+        if (stream.match("is ", false)) {
+            stream.match("is", true);
+            return token.TEST;
+        }
+        if (stream.eat(/[&\|]/)) {
+            return token.TEST;
+        }
+        return tokenDefault(stream, state);
+    }
+
+    var parsers = {
+        'default': tokenDefault,
+        filter: tokenTest,
+        url: tokenURL,
+        test: tokenTest,
+        error: tokenError
+    }
+
+
+    return {
+        startState: getInitialState,
+        compareStates: function(state1, state2) {
+            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
+        },
+        token: function(stream, state) {
+            // ignore spaces
+            if (stream.eatSpace()) return null;
+            if (stream.eat(';')) {
+                if (state.current() == "prefix") {
+                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
+                }
+                log(stream, state, "RESET");
+                state.reset(); 
+                return token.OP;
+            }
+            var result = state.parser(stream, state);
+            log(stream, state, result);
+            return result;
+        },
+        electricChars: "@=[];",
+        indent: function(state, textAfter) {
+            switch (state.current()) {
+            case 'test':
+            case 'filter':
+                return 2 * config.indentUnit;
+                break;
+            case 'default':
+                // no indent for @prefix etc...
+                if (textAfter.search(/^\s*@/) == 0) {
+                    return 0;
+                }
+                return config.indentUnit;
+                break;
+            }
+            return 0;
+        }
+    }
+});
+
+// Autocompletion
+if (CodeMirror.simpleHint && jQuery) {
+    function completePrefix(editor, cur, token) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|;)\s*@prefix\s+(\w+)\s*(:\s*<?)?(;|$)/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+                    async: false,
+                    data: {prefix: prefix},
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">;" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    function completeURI(editor, cur, token) {
+        var bC = token.string.substr(0, cur.ch - token.start),
+        aC = token.string.substr(cur.ch - token.start),
+        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['uri'] = bC;
+            
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    suggestions[i] = "<" + suggestions[i] + "> ";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: token.start - 1},
+              to: {line: cur.line, ch: replUntil}
+            };
+        }
+        return false;
+    }
+    function completeCUIE(editor, cur, token) {
+        var from = token.start, 
+            to = token.end, 
+            req = token.string.substr(0, cur.ch - token.start);
+        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
+        if (token.className == 'atom' && prevToken.className == 'qualifier') {
+            from = prevToken.start;
+            req = prevToken.string + req;
+        }
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['prefix'] = req;
+
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    // prefix only
+                    suggestions[i] = suggestions[i] + ":";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: from},
+              to: {line: cur.line, ch: to}
+            };
+        }
+        
+        return false;
+    }
+    function insertPrefixDef(editor, cur, token) {
+        var prefix = token.string.replace(/:?$/, ""), result;
+        try {
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+//            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                async: false,
+                data: {prefix: prefix},
+                success: function(data) {
+                    result = data[prefix];
+                },
+                dataType: "json"
+            });
+        } catch (e) {}
+        if (result !== undefined) {
+            // check if this url is already prefixed
+            var px;
+            for (var i in token.state.namespaces) {
+                if (token.state.namespaces[i] == result) {
+                    px = i;
+                    break;
+                }
+            } 
+            if (px) {
+                return {
+                    list: [ px + ":" ],
+                    from: { line: cur.line, ch: token.start },
+                    to: { line: cur.line, ch: token.end }
+                };
+            } else {
+            return {
+                list: [ "@prefix " + prefix + ": <" + result + "> ;\n" ],
+                from: {line: 0, ch: 0},
+                to: {line: 0, ch: 0}
+            };
+            } 
+        }
+    }
+    CodeMirror.commands.ldpathAutocomplete = function(cm) {
+        CodeMirror.simpleHint(cm, function(editor) {
+            var cur = editor.getCursor();
+            var line = editor.getLine(cur.line);
+            var token = editor.getTokenAt(cur);
+        
+            if (token.state.stack.indexOf('prefix') >= 0) {
+                return completePrefix(editor, cur, token);
+            } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
+                return completeURI(editor, cur, token);
+            } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
+                return completeCUIE(editor, cur, token);
+            } else if (token.className == "string-2") {
+                return insertPrefixDef(editor, cur, token);
+            } else {
+                if (console && console.log) {
+                    console.log("State: " + token.state.stack);
+                }
+            }
+        });
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/simple-hint.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.css b/extras/webjars/codemirror/src/main/resources/simple-hint.css
new file mode 100644
index 0000000..c7a040c
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/simple-hint.css
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#center .CodeMirror-completions, .CodeMirror-completions {
+  position: absolute;
+  z-index: 10;
+  overflow: hidden;
+  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+}
+#center .CodeMirror-completions select, .CodeMirror-completions select {
+  background: #fafafa;
+  outline: none;
+  border: none;
+  padding: 0;
+  margin: 0;
+  font-family: monospace;
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/simple-hint.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.js b/extras/webjars/codemirror/src/main/resources/simple-hint.js
new file mode 100644
index 0000000..27f8ead
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/simple-hint.js
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+  CodeMirror.simpleHint = function(editor, getHints) {
+    // We want a single cursor position.
+    if (editor.somethingSelected()) return;
+    var result = getHints(editor);
+    if (!result || !result.list.length) return;
+    var completions = result.list;
+    function insert(str) {
+      editor.replaceRange(str, result.from, result.to);
+    }
+    // When there is only one completion, use it directly.
+    if (completions.length == 1) {insert(completions[0]); return true;}
+
+    // Build the select widget
+    var complete = document.createElement("div");
+    complete.className = "CodeMirror-completions";
+    var sel = complete.appendChild(document.createElement("select"));
+    // Opera doesn't move the selection when pressing up/down in a
+    // multi-select, but it does properly support the size property on
+    // single-selects, so no multi-select is necessary.
+    if (!window.opera) sel.multiple = true;
+    for (var i = 0; i < completions.length; ++i) {
+      var opt = sel.appendChild(document.createElement("option"));
+      opt.appendChild(document.createTextNode(completions[i]));
+    }
+    sel.firstChild.selected = true;
+    sel.size = Math.min(10, completions.length);
+    var pos = editor.cursorCoords();
+    complete.style.left = pos.x + "px";
+    complete.style.top = pos.yBot + "px";
+    document.body.appendChild(complete);
+    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
+    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
+    if(winW - pos.x < sel.clientWidth)
+      complete.style.left = (pos.x - sel.clientWidth) + "px";
+    // Hack to hide the scrollbar.
+    if (completions.length <= 10)
+      complete.style.width = (sel.clientWidth - 1) + "px";
+
+    var done = false;
+    function close() {
+      if (done) return;
+      done = true;
+      complete.parentNode.removeChild(complete);
+    }
+    function pick() {
+      insert(completions[sel.selectedIndex]);
+      close();
+      setTimeout(function(){editor.focus();}, 50);
+    }
+    CodeMirror.connect(sel, "blur", close);
+    CodeMirror.connect(sel, "keydown", function(event) {
+      var code = event.keyCode;
+      // Enter
+      if (code == 13) {CodeMirror.e_stop(event); pick();}
+      // Escape
+      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
+      else if (code != 38 && code != 40) {
+        close(); editor.focus();
+        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
+        editor.triggerOnKeyDown(event);
+        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
+      }
+    });
+    CodeMirror.connect(sel, "dblclick", pick);
+
+    sel.focus();
+    // Opera sometimes ignores focusing a freshly created node
+    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
+    return true;
+  };
+})();

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/sparql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/sparql.js b/extras/webjars/codemirror/src/main/resources/sparql.js
new file mode 100644
index 0000000..ff3ad70
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/sparql.js
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+CodeMirror.defineMode("sparql", function(config) {
+  var indentUnit = config.indentUnit;
+  var curPunc;
+
+  function wordRegexp(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  }
+  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
+                        "isblank", "isliteral", "union", "a"]);
+  var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
+                             "ask", "from", "named", "where", "group", "order", "limit", "offset", "filter", 
+                             "optional", "graph", "by", "asc", "desc", "insert", "data", "delete"]);
+  var operatorChars = /[*+\-<>=&|]/;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    curPunc = null;
+    if (ch == "$" || ch == "?") {
+      stream.match(/^[\w\d]*/);
+      return "variable-2";
+    }
+    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
+      stream.match(/^[^\s\u00a0>]*>?/);
+      return "atom";
+    }
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenLiteral(ch);
+      return state.tokenize(stream, state);
+    }
+    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    else if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    else if (operatorChars.test(ch)) {
+      stream.eatWhile(operatorChars);
+      return null;
+    }
+    else if (ch == ":") {
+      stream.eatWhile(/[\w\d\._\-]/);
+      return "atom";
+    }
+    else {
+      stream.eatWhile(/[_\w\d]/);
+      if (stream.eat(":")) {
+        stream.eatWhile(/[\w\d_\-]/);
+        return "atom";
+      }
+      var word = stream.current(), type;
+      if (ops.test(word))
+        return null;
+      else if (keywords.test(word))
+        return "keyword";
+      else
+        return "variable";
+    }
+  }
+
+  function tokenLiteral(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return "string";
+    };
+  }
+
+  function pushContext(state, type, col) {
+    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
+  }
+  function popContext(state) {
+    state.indent = state.context.indent;
+    state.context = state.context.prev;
+  }
+
+  return {
+    startState: function(base) {
+      return {tokenize: tokenBase,
+              context: null,
+              indent: 0,
+              col: 0};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (state.context && state.context.align == null) state.context.align = false;
+        state.indent = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+
+      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
+        state.context.align = true;
+      }
+
+      if (curPunc == "(") pushContext(state, ")", stream.column());
+      else if (curPunc == "[") pushContext(state, "]", stream.column());
+      else if (curPunc == "{") pushContext(state, "}", stream.column());
+      else if (/[\]\}\)]/.test(curPunc)) {
+        while (state.context && state.context.type == "pattern") popContext(state);
+        if (state.context && curPunc == state.context.type) popContext(state);
+      }
+      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
+      else if (/atom|string|variable/.test(style) && state.context) {
+        if (/[\}\]]/.test(state.context.type))
+          pushContext(state, "pattern", stream.column());
+        else if (state.context.type == "pattern" && !state.context.align) {
+          state.context.align = true;
+          state.context.col = stream.column();
+        }
+      }
+      
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var firstChar = textAfter && textAfter.charAt(0);
+      var context = state.context;
+      if (/[\]\}]/.test(firstChar))
+        while (context && context.type == "pattern") context = context.prev;
+
+      var closing = context && firstChar == context.type;
+      if (!context)
+        return 0;
+      else if (context.type == "pattern")
+        return context.col;
+      else if (context.align)
+        return context.col + (closing ? 0 : 1);
+      else
+        return context.indent + (closing ? 0 : indentUnit);
+    }
+  };
+});
+
+if (CodeMirror.simpleHint && jQuery) {
+    function completePrefix(editor, cur, token, prevToken) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|;)\s*PREFIX\s+(\w+)\s*(:\s*<?)?(;|$)/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                    async: false,
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    CodeMirror.commands.sparqlAutocomplete = function(cm) {
+        CodeMirror.simpleHint(cm, function(editor) {
+            var cur = editor.getCursor();
+            var line = editor.getLine(cur.line);
+
+            // search for the last prefix
+            for(i = cur.ch; i >= 0; i--) {
+                var token = editor.getTokenAt({line: cur.line, ch: i});
+                if(token.className == "keyword" && token.string == "PREFIX") {
+                    break;
+                }
+            }
+            console.dir(token);
+
+            // search for the next atom
+            for(i = token.end + 1; i <= cur.ch; i++) {
+                var atomToken = editor.getTokenAt({line: cur.line, ch: i});
+                if(atomToken.className == "atom") {
+                    break;
+                }
+            }
+            console.dir(atomToken);
+
+
+            if (atomToken.className == "atom") {
+                return completePrefix(editor, cur, atomToken, token);
+            }
+        });
+    }
+}
+
+
+CodeMirror.defineMIME("application/x-sparql-query", "sparql");

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/pom.xml b/extras/webjars/pom.xml
new file mode 100644
index 0000000..a37c28b
--- /dev/null
+++ b/extras/webjars/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>webjars</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>snorql</module>
+        <module>codemirror</module>
+        <module>sgvizler</module>
+    </modules>
+    
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/pom.xml b/extras/webjars/sgvizler/pom.xml
new file mode 100644
index 0000000..73ef370
--- /dev/null
+++ b/extras/webjars/sgvizler/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>sgvizler</artifactId>
+    <version>0.5.1</version>
+    <packaging>jar</packaging>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <nomunge>true</nomunge>
+                    <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                    <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/sgvizler.js</output>
+                </configuration>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>**/*.js</exclude>
+                </excludes>
+                <filtering>false</filtering>
+                <targetPath>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</targetPath>
+            </resource>
+        </resources>
+     </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/LICENSE
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/LICENSE b/extras/webjars/sgvizler/src/main/resources/LICENSE
new file mode 100644
index 0000000..0e50dba
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/LICENSE
@@ -0,0 +1,16 @@
+Copyright (c) 2011 Martin G. Skjæveland
+
+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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/REVISION
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/REVISION b/extras/webjars/sgvizler/src/main/resources/REVISION
new file mode 100644
index 0000000..4dc1283
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/REVISION
@@ -0,0 +1 @@
+172:173


[41/41] git commit: - updated copyright of contributed files

Posted by ss...@apache.org.
- updated copyright of contributed files


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/fb577642
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/fb577642
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/fb577642

Branch: refs/heads/develop
Commit: fb57764271179adba07f1bed5c1c4ebf026a0ba2
Parents: 75e6832
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Jul 9 11:46:57 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Jul 9 11:46:57 2013 +0200

----------------------------------------------------------------------
 .../platform/core/jaxrs/CDIExceptionMapper.java | 17 +++++++++++++++++
 .../core/jaxrs/IllegalStateExceptionMapper.java | 18 +++++++++++++++++-
 .../core/jaxrs/MarmottaExceptionMapper.java     | 20 +++++++++++++++++---
 .../jaxrs/MarmottaImportExceptionMapper.java    | 18 +++++++++++++++++-
 .../core/jaxrs/RepositoryExceptionMapper.java   | 18 +++++++++++++++++-
 .../core/jaxrs/URISyntaxExceptionMapper.java    | 18 +++++++++++++++++-
 .../UnsupportedOperationExceptionMapper.java    | 18 +++++++++++++++++-
 7 files changed, 119 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
index 7d7bf4f..c2eba6e 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import javax.ws.rs.ext.ExceptionMapper;

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
index 983d07e..8af0c0a 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
@@ -1,8 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
index 1dadc6e..1a84e70 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
@@ -1,12 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
 import org.apache.marmotta.platform.core.exception.MarmottaException;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
index 2bda331..665ae9b 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
@@ -1,10 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
index 80dfd71..32aeb78 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
@@ -1,10 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import org.openrdf.repository.RepositoryException;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
index 858ccaa..98d643e 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
@@ -1,7 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 import java.net.URISyntaxException;
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fb577642/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
index e62e5b5..a2c88e8 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
@@ -1,8 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.marmotta.platform.core.jaxrs;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
 /**


[27/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/effects.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/effects.js b/extras/webjars/snorql/src/main/resources/scriptaculous/effects.js
new file mode 100755
index 0000000..113aff6
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/effects.js
@@ -0,0 +1,1130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable  
+String.prototype.parseColor = function() {  
+  var color = '#';
+  if (this.slice(0,4) == 'rgb(') {  
+    var cols = this.slice(4,this.length-1).split(',');  
+    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
+  } else {  
+    if (this.slice(0,1) == '#') {  
+      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
+      if (this.length==7) color = this.toLowerCase();  
+    }  
+  }  
+  return (color.length==7 ? color : (arguments[0] || this));  
+};
+
+/*--------------------------------------------------------------------------*/
+
+Element.collectTextNodes = function(element) {  
+  return $A($(element).childNodes).collect( function(node) {
+    return (node.nodeType==3 ? node.nodeValue : 
+      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
+  }).flatten().join('');
+};
+
+Element.collectTextNodesIgnoreClass = function(element, className) {  
+  return $A($(element).childNodes).collect( function(node) {
+    return (node.nodeType==3 ? node.nodeValue : 
+      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
+        Element.collectTextNodesIgnoreClass(node, className) : ''));
+  }).flatten().join('');
+};
+
+Element.setContentZoom = function(element, percent) {
+  element = $(element);  
+  element.setStyle({fontSize: (percent/100) + 'em'});   
+  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
+  return element;
+};
+
+Element.getInlineOpacity = function(element){
+  return $(element).style.opacity || '';
+};
+
+Element.forceRerendering = function(element) {
+  try {
+    element = $(element);
+    var n = document.createTextNode(' ');
+    element.appendChild(n);
+    element.removeChild(n);
+  } catch(e) { }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Effect = {
+  _elementDoesNotExistError: {
+    name: 'ElementDoesNotExistError',
+    message: 'The specified DOM element does not exist, but is required for this effect to operate'
+  },
+  Transitions: {
+    linear: Prototype.K,
+    sinoidal: function(pos) {
+      return (-Math.cos(pos*Math.PI)/2) + 0.5;
+    },
+    reverse: function(pos) {
+      return 1-pos;
+    },
+    flicker: function(pos) {
+      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+      return pos > 1 ? 1 : pos;
+    },
+    wobble: function(pos) {
+      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+    },
+    pulse: function(pos, pulses) { 
+      pulses = pulses || 5; 
+      return (
+        ((pos % (1/pulses)) * pulses).round() == 0 ? 
+              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
+          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
+        );
+    },
+    spring: function(pos) { 
+      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
+    },
+    none: function(pos) {
+      return 0;
+    },
+    full: function(pos) {
+      return 1;
+    }
+  },
+  DefaultOptions: {
+    duration:   1.0,   // seconds
+    fps:        100,   // 100= assume 66fps max.
+    sync:       false, // true for combining
+    from:       0.0,
+    to:         1.0,
+    delay:      0.0,
+    queue:      'parallel'
+  },
+  tagifyText: function(element) {
+    var tagifyStyle = 'position:relative';
+    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
+    
+    element = $(element);
+    $A(element.childNodes).each( function(child) {
+      if (child.nodeType==3) {
+        child.nodeValue.toArray().each( function(character) {
+          element.insertBefore(
+            new Element('span', {style: tagifyStyle}).update(
+              character == ' ' ? String.fromCharCode(160) : character), 
+              child);
+        });
+        Element.remove(child);
+      }
+    });
+  },
+  multiple: function(element, effect) {
+    var elements;
+    if (((typeof element == 'object') || 
+        Object.isFunction(element)) && 
+       (element.length))
+      elements = element;
+    else
+      elements = $(element).childNodes;
+      
+    var options = Object.extend({
+      speed: 0.1,
+      delay: 0.0
+    }, arguments[2] || { });
+    var masterDelay = options.delay;
+
+    $A(elements).each( function(element, index) {
+      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+    });
+  },
+  PAIRS: {
+    'slide':  ['SlideDown','SlideUp'],
+    'blind':  ['BlindDown','BlindUp'],
+    'appear': ['Appear','Fade']
+  },
+  toggle: function(element, effect) {
+    element = $(element);
+    effect = (effect || 'appear').toLowerCase();
+    var options = Object.extend({
+      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
+    }, arguments[2] || { });
+    Effect[element.visible() ? 
+      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+  }
+};
+
+Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create(Enumerable, {
+  initialize: function() {
+    this.effects  = [];
+    this.interval = null;    
+  },
+  _each: function(iterator) {
+    this.effects._each(iterator);
+  },
+  add: function(effect) {
+    var timestamp = new Date().getTime();
+    
+    var position = Object.isString(effect.options.queue) ? 
+      effect.options.queue : effect.options.queue.position;
+    
+    switch(position) {
+      case 'front':
+        // move unstarted effects after this effect  
+        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
+            e.startOn  += effect.finishOn;
+            e.finishOn += effect.finishOn;
+          });
+        break;
+      case 'with-last':
+        timestamp = this.effects.pluck('startOn').max() || timestamp;
+        break;
+      case 'end':
+        // start effect after last queued effect has finished
+        timestamp = this.effects.pluck('finishOn').max() || timestamp;
+        break;
+    }
+    
+    effect.startOn  += timestamp;
+    effect.finishOn += timestamp;
+
+    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
+      this.effects.push(effect);
+    
+    if (!this.interval)
+      this.interval = setInterval(this.loop.bind(this), 15);
+  },
+  remove: function(effect) {
+    this.effects = this.effects.reject(function(e) { return e==effect });
+    if (this.effects.length == 0) {
+      clearInterval(this.interval);
+      this.interval = null;
+    }
+  },
+  loop: function() {
+    var timePos = new Date().getTime();
+    for(var i=0, len=this.effects.length;i<len;i++) 
+      this.effects[i] && this.effects[i].loop(timePos);
+  }
+});
+
+Effect.Queues = {
+  instances: $H(),
+  get: function(queueName) {
+    if (!Object.isString(queueName)) return queueName;
+    
+    return this.instances.get(queueName) ||
+      this.instances.set(queueName, new Effect.ScopedQueue());
+  }
+};
+Effect.Queue = Effect.Queues.get('global');
+
+Effect.Base = Class.create({
+  position: null,
+  start: function(options) {
+    function codeForEvent(options,eventName){
+      return (
+        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
+        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
+      );
+    }
+    if (options && options.transition === false) options.transition = Effect.Transitions.linear;
+    this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
+    this.currentFrame = 0;
+    this.state        = 'idle';
+    this.startOn      = this.options.delay*1000;
+    this.finishOn     = this.startOn+(this.options.duration*1000);
+    this.fromToDelta  = this.options.to-this.options.from;
+    this.totalTime    = this.finishOn-this.startOn;
+    this.totalFrames  = this.options.fps*this.options.duration;
+    
+    eval('this.render = function(pos){ '+
+      'if (this.state=="idle"){this.state="running";'+
+      codeForEvent(this.options,'beforeSetup')+
+      (this.setup ? 'this.setup();':'')+ 
+      codeForEvent(this.options,'afterSetup')+
+      '};if (this.state=="running"){'+
+      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
+      'this.position=pos;'+
+      codeForEvent(this.options,'beforeUpdate')+
+      (this.update ? 'this.update(pos);':'')+
+      codeForEvent(this.options,'afterUpdate')+
+      '}}');
+    
+    this.event('beforeStart');
+    if (!this.options.sync)
+      Effect.Queues.get(Object.isString(this.options.queue) ? 
+        'global' : this.options.queue.scope).add(this);
+  },
+  loop: function(timePos) {
+    if (timePos >= this.startOn) {
+      if (timePos >= this.finishOn) {
+        this.render(1.0);
+        this.cancel();
+        this.event('beforeFinish');
+        if (this.finish) this.finish(); 
+        this.event('afterFinish');
+        return;  
+      }
+      var pos   = (timePos - this.startOn) / this.totalTime,
+          frame = (pos * this.totalFrames).round();
+      if (frame > this.currentFrame) {
+        this.render(pos);
+        this.currentFrame = frame;
+      }
+    }
+  },
+  cancel: function() {
+    if (!this.options.sync)
+      Effect.Queues.get(Object.isString(this.options.queue) ? 
+        'global' : this.options.queue.scope).remove(this);
+    this.state = 'finished';
+  },
+  event: function(eventName) {
+    if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+    if (this.options[eventName]) this.options[eventName](this);
+  },
+  inspect: function() {
+    var data = $H();
+    for(property in this)
+      if (!Object.isFunction(this[property])) data.set(property, this[property]);
+    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
+  }
+});
+
+Effect.Parallel = Class.create(Effect.Base, {
+  initialize: function(effects) {
+    this.effects = effects || [];
+    this.start(arguments[1]);
+  },
+  update: function(position) {
+    this.effects.invoke('render', position);
+  },
+  finish: function(position) {
+    this.effects.each( function(effect) {
+      effect.render(1.0);
+      effect.cancel();
+      effect.event('beforeFinish');
+      if (effect.finish) effect.finish(position);
+      effect.event('afterFinish');
+    });
+  }
+});
+
+Effect.Tween = Class.create(Effect.Base, {
+  initialize: function(object, from, to) {
+    object = Object.isString(object) ? $(object) : object;
+    var args = $A(arguments), method = args.last(), 
+      options = args.length == 5 ? args[3] : null;
+    this.method = Object.isFunction(method) ? method.bind(object) :
+      Object.isFunction(object[method]) ? object[method].bind(object) : 
+      function(value) { object[method] = value };
+    this.start(Object.extend({ from: from, to: to }, options || { }));
+  },
+  update: function(position) {
+    this.method(position);
+  }
+});
+
+Effect.Event = Class.create(Effect.Base, {
+  initialize: function() {
+    this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
+  },
+  update: Prototype.emptyFunction
+});
+
+Effect.Opacity = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    // make this work on IE on elements without 'layout'
+    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+      this.element.setStyle({zoom: 1});
+    var options = Object.extend({
+      from: this.element.getOpacity() || 0.0,
+      to:   1.0
+    }, arguments[1] || { });
+    this.start(options);
+  },
+  update: function(position) {
+    this.element.setOpacity(position);
+  }
+});
+
+Effect.Move = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      x:    0,
+      y:    0,
+      mode: 'relative'
+    }, arguments[1] || { });
+    this.start(options);
+  },
+  setup: function() {
+    this.element.makePositioned();
+    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
+    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
+    if (this.options.mode == 'absolute') {
+      this.options.x = this.options.x - this.originalLeft;
+      this.options.y = this.options.y - this.originalTop;
+    }
+  },
+  update: function(position) {
+    this.element.setStyle({
+      left: (this.options.x  * position + this.originalLeft).round() + 'px',
+      top:  (this.options.y  * position + this.originalTop).round()  + 'px'
+    });
+  }
+});
+
+// for backwards compatibility
+Effect.MoveBy = function(element, toTop, toLeft) {
+  return new Effect.Move(element, 
+    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
+};
+
+Effect.Scale = Class.create(Effect.Base, {
+  initialize: function(element, percent) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      scaleX: true,
+      scaleY: true,
+      scaleContent: true,
+      scaleFromCenter: false,
+      scaleMode: 'box',        // 'box' or 'contents' or { } with provided values
+      scaleFrom: 100.0,
+      scaleTo:   percent
+    }, arguments[2] || { });
+    this.start(options);
+  },
+  setup: function() {
+    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+    this.elementPositioning = this.element.getStyle('position');
+    
+    this.originalStyle = { };
+    ['top','left','width','height','fontSize'].each( function(k) {
+      this.originalStyle[k] = this.element.style[k];
+    }.bind(this));
+      
+    this.originalTop  = this.element.offsetTop;
+    this.originalLeft = this.element.offsetLeft;
+    
+    var fontSize = this.element.getStyle('font-size') || '100%';
+    ['em','px','%','pt'].each( function(fontSizeType) {
+      if (fontSize.indexOf(fontSizeType)>0) {
+        this.fontSize     = parseFloat(fontSize);
+        this.fontSizeType = fontSizeType;
+      }
+    }.bind(this));
+    
+    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+    
+    this.dims = null;
+    if (this.options.scaleMode=='box')
+      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+    if (/^content/.test(this.options.scaleMode))
+      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+    if (!this.dims)
+      this.dims = [this.options.scaleMode.originalHeight,
+                   this.options.scaleMode.originalWidth];
+  },
+  update: function(position) {
+    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+    if (this.options.scaleContent && this.fontSize)
+      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
+    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
+  },
+  finish: function(position) {
+    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
+  },
+  setDimensions: function(height, width) {
+    var d = { };
+    if (this.options.scaleX) d.width = width.round() + 'px';
+    if (this.options.scaleY) d.height = height.round() + 'px';
+    if (this.options.scaleFromCenter) {
+      var topd  = (height - this.dims[0])/2;
+      var leftd = (width  - this.dims[1])/2;
+      if (this.elementPositioning == 'absolute') {
+        if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
+        if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
+      } else {
+        if (this.options.scaleY) d.top = -topd + 'px';
+        if (this.options.scaleX) d.left = -leftd + 'px';
+      }
+    }
+    this.element.setStyle(d);
+  }
+});
+
+Effect.Highlight = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
+    this.start(options);
+  },
+  setup: function() {
+    // Prevent executing on elements not in the layout flow
+    if (this.element.getStyle('display')=='none') { this.cancel(); return; }
+    // Disable background image during the effect
+    this.oldStyle = { };
+    if (!this.options.keepBackgroundImage) {
+      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
+      this.element.setStyle({backgroundImage: 'none'});
+    }
+    if (!this.options.endcolor)
+      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
+    if (!this.options.restorecolor)
+      this.options.restorecolor = this.element.getStyle('background-color');
+    // init color calculations
+    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
+    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
+  },
+  update: function(position) {
+    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
+      return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
+  },
+  finish: function() {
+    this.element.setStyle(Object.extend(this.oldStyle, {
+      backgroundColor: this.options.restorecolor
+    }));
+  }
+});
+
+Effect.ScrollTo = function(element) {
+  var options = arguments[1] || { },
+    scrollOffsets = document.viewport.getScrollOffsets(),
+    elementOffsets = $(element).cumulativeOffset(),
+    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  
+
+  if (options.offset) elementOffsets[1] += options.offset;
+
+  return new Effect.Tween(null,
+    scrollOffsets.top,
+    elementOffsets[1] > max ? max : elementOffsets[1],
+    options,
+    function(p){ scrollTo(scrollOffsets.left, p.round()) }
+  );
+};
+
+/* ------------- combination effects ------------- */
+
+Effect.Fade = function(element) {
+  element = $(element);
+  var oldOpacity = element.getInlineOpacity();
+  var options = Object.extend({
+    from: element.getOpacity() || 1.0,
+    to:   0.0,
+    afterFinishInternal: function(effect) { 
+      if (effect.options.to!=0) return;
+      effect.element.hide().setStyle({opacity: oldOpacity}); 
+    }
+  }, arguments[1] || { });
+  return new Effect.Opacity(element,options);
+};
+
+Effect.Appear = function(element) {
+  element = $(element);
+  var options = Object.extend({
+  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
+  to:   1.0,
+  // force Safari to render floated elements properly
+  afterFinishInternal: function(effect) {
+    effect.element.forceRerendering();
+  },
+  beforeSetup: function(effect) {
+    effect.element.setOpacity(effect.options.from).show(); 
+  }}, arguments[1] || { });
+  return new Effect.Opacity(element,options);
+};
+
+Effect.Puff = function(element) {
+  element = $(element);
+  var oldStyle = { 
+    opacity: element.getInlineOpacity(), 
+    position: element.getStyle('position'),
+    top:  element.style.top,
+    left: element.style.left,
+    width: element.style.width,
+    height: element.style.height
+  };
+  return new Effect.Parallel(
+   [ new Effect.Scale(element, 200, 
+      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
+     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
+     Object.extend({ duration: 1.0, 
+      beforeSetupInternal: function(effect) {
+        Position.absolutize(effect.effects[0].element)
+      },
+      afterFinishInternal: function(effect) {
+         effect.effects[0].element.hide().setStyle(oldStyle); }
+     }, arguments[1] || { })
+   );
+};
+
+Effect.BlindUp = function(element) {
+  element = $(element);
+  element.makeClipping();
+  return new Effect.Scale(element, 0,
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      restoreAfterFinish: true,
+      afterFinishInternal: function(effect) {
+        effect.element.hide().undoClipping();
+      } 
+    }, arguments[1] || { })
+  );
+};
+
+Effect.BlindDown = function(element) {
+  element = $(element);
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, 100, Object.extend({ 
+    scaleContent: false, 
+    scaleX: false,
+    scaleFrom: 0,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
+    },  
+    afterFinishInternal: function(effect) {
+      effect.element.undoClipping();
+    }
+  }, arguments[1] || { }));
+};
+
+Effect.SwitchOff = function(element) {
+  element = $(element);
+  var oldOpacity = element.getInlineOpacity();
+  return new Effect.Appear(element, Object.extend({
+    duration: 0.4,
+    from: 0,
+    transition: Effect.Transitions.flicker,
+    afterFinishInternal: function(effect) {
+      new Effect.Scale(effect.element, 1, { 
+        duration: 0.3, scaleFromCenter: true,
+        scaleX: false, scaleContent: false, restoreAfterFinish: true,
+        beforeSetup: function(effect) { 
+          effect.element.makePositioned().makeClipping();
+        },
+        afterFinishInternal: function(effect) {
+          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
+        }
+      })
+    }
+  }, arguments[1] || { }));
+};
+
+Effect.DropOut = function(element) {
+  element = $(element);
+  var oldStyle = {
+    top: element.getStyle('top'),
+    left: element.getStyle('left'),
+    opacity: element.getInlineOpacity() };
+  return new Effect.Parallel(
+    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
+      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
+    Object.extend(
+      { duration: 0.5,
+        beforeSetup: function(effect) {
+          effect.effects[0].element.makePositioned(); 
+        },
+        afterFinishInternal: function(effect) {
+          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
+        } 
+      }, arguments[1] || { }));
+};
+
+Effect.Shake = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    distance: 20,
+    duration: 0.5
+  }, arguments[1] || {});
+  var distance = parseFloat(options.distance);
+  var split = parseFloat(options.duration) / 10.0;
+  var oldStyle = {
+    top: element.getStyle('top'),
+    left: element.getStyle('left') };
+    return new Effect.Move(element,
+      { x:  distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+        effect.element.undoPositioned().setStyle(oldStyle);
+  }}) }}) }}) }}) }}) }});
+};
+
+Effect.SlideDown = function(element) {
+  element = $(element).cleanWhitespace();
+  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
+  var oldInnerBottom = element.down().getStyle('bottom');
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, 100, Object.extend({ 
+    scaleContent: false, 
+    scaleX: false, 
+    scaleFrom: window.opera ? 0 : 1,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makePositioned();
+      effect.element.down().makePositioned();
+      if (window.opera) effect.element.setStyle({top: ''});
+      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
+    },
+    afterUpdateInternal: function(effect) {
+      effect.element.down().setStyle({bottom:
+        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
+    },
+    afterFinishInternal: function(effect) {
+      effect.element.undoClipping().undoPositioned();
+      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
+    }, arguments[1] || { })
+  );
+};
+
+Effect.SlideUp = function(element) {
+  element = $(element).cleanWhitespace();
+  var oldInnerBottom = element.down().getStyle('bottom');
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, window.opera ? 0 : 1,
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    scaleMode: 'box',
+    scaleFrom: 100,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makePositioned();
+      effect.element.down().makePositioned();
+      if (window.opera) effect.element.setStyle({top: ''});
+      effect.element.makeClipping().show();
+    },  
+    afterUpdateInternal: function(effect) {
+      effect.element.down().setStyle({bottom:
+        (effect.dims[0] - effect.element.clientHeight) + 'px' });
+    },
+    afterFinishInternal: function(effect) {
+      effect.element.hide().undoClipping().undoPositioned();
+      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
+    }
+   }, arguments[1] || { })
+  );
+};
+
+// Bug in opera makes the TD containing this element expand for a instance after finish 
+Effect.Squish = function(element) {
+  return new Effect.Scale(element, window.opera ? 1 : 0, { 
+    restoreAfterFinish: true,
+    beforeSetup: function(effect) {
+      effect.element.makeClipping(); 
+    },  
+    afterFinishInternal: function(effect) {
+      effect.element.hide().undoClipping(); 
+    }
+  });
+};
+
+Effect.Grow = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    direction: 'center',
+    moveTransition: Effect.Transitions.sinoidal,
+    scaleTransition: Effect.Transitions.sinoidal,
+    opacityTransition: Effect.Transitions.full
+  }, arguments[1] || { });
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    height: element.style.height,
+    width: element.style.width,
+    opacity: element.getInlineOpacity() };
+
+  var dims = element.getDimensions();    
+  var initialMoveX, initialMoveY;
+  var moveX, moveY;
+  
+  switch (options.direction) {
+    case 'top-left':
+      initialMoveX = initialMoveY = moveX = moveY = 0; 
+      break;
+    case 'top-right':
+      initialMoveX = dims.width;
+      initialMoveY = moveY = 0;
+      moveX = -dims.width;
+      break;
+    case 'bottom-left':
+      initialMoveX = moveX = 0;
+      initialMoveY = dims.height;
+      moveY = -dims.height;
+      break;
+    case 'bottom-right':
+      initialMoveX = dims.width;
+      initialMoveY = dims.height;
+      moveX = -dims.width;
+      moveY = -dims.height;
+      break;
+    case 'center':
+      initialMoveX = dims.width / 2;
+      initialMoveY = dims.height / 2;
+      moveX = -dims.width / 2;
+      moveY = -dims.height / 2;
+      break;
+  }
+  
+  return new Effect.Move(element, {
+    x: initialMoveX,
+    y: initialMoveY,
+    duration: 0.01, 
+    beforeSetup: function(effect) {
+      effect.element.hide().makeClipping().makePositioned();
+    },
+    afterFinishInternal: function(effect) {
+      new Effect.Parallel(
+        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
+          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
+          new Effect.Scale(effect.element, 100, {
+            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
+            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
+        ], Object.extend({
+             beforeSetup: function(effect) {
+               effect.effects[0].element.setStyle({height: '0px'}).show(); 
+             },
+             afterFinishInternal: function(effect) {
+               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
+             }
+           }, options)
+      )
+    }
+  });
+};
+
+Effect.Shrink = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    direction: 'center',
+    moveTransition: Effect.Transitions.sinoidal,
+    scaleTransition: Effect.Transitions.sinoidal,
+    opacityTransition: Effect.Transitions.none
+  }, arguments[1] || { });
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    height: element.style.height,
+    width: element.style.width,
+    opacity: element.getInlineOpacity() };
+
+  var dims = element.getDimensions();
+  var moveX, moveY;
+  
+  switch (options.direction) {
+    case 'top-left':
+      moveX = moveY = 0;
+      break;
+    case 'top-right':
+      moveX = dims.width;
+      moveY = 0;
+      break;
+    case 'bottom-left':
+      moveX = 0;
+      moveY = dims.height;
+      break;
+    case 'bottom-right':
+      moveX = dims.width;
+      moveY = dims.height;
+      break;
+    case 'center':  
+      moveX = dims.width / 2;
+      moveY = dims.height / 2;
+      break;
+  }
+  
+  return new Effect.Parallel(
+    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
+      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
+      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
+    ], Object.extend({            
+         beforeStartInternal: function(effect) {
+           effect.effects[0].element.makePositioned().makeClipping(); 
+         },
+         afterFinishInternal: function(effect) {
+           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
+       }, options)
+  );
+};
+
+Effect.Pulsate = function(element) {
+  element = $(element);
+  var options    = arguments[1] || { };
+  var oldOpacity = element.getInlineOpacity();
+  var transition = options.transition || Effect.Transitions.sinoidal;
+  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
+  reverser.bind(transition);
+  return new Effect.Opacity(element, 
+    Object.extend(Object.extend({  duration: 2.0, from: 0,
+      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
+    }, options), {transition: reverser}));
+};
+
+Effect.Fold = function(element) {
+  element = $(element);
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    width: element.style.width,
+    height: element.style.height };
+  element.makeClipping();
+  return new Effect.Scale(element, 5, Object.extend({   
+    scaleContent: false,
+    scaleX: false,
+    afterFinishInternal: function(effect) {
+    new Effect.Scale(element, 1, { 
+      scaleContent: false, 
+      scaleY: false,
+      afterFinishInternal: function(effect) {
+        effect.element.hide().undoClipping().setStyle(oldStyle);
+      } });
+  }}, arguments[1] || { }));
+};
+
+Effect.Morph = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      style: { }
+    }, arguments[1] || { });
+    
+    if (!Object.isString(options.style)) this.style = $H(options.style);
+    else {
+      if (options.style.include(':'))
+        this.style = options.style.parseStyle();
+      else {
+        this.element.addClassName(options.style);
+        this.style = $H(this.element.getStyles());
+        this.element.removeClassName(options.style);
+        var css = this.element.getStyles();
+        this.style = this.style.reject(function(style) {
+          return style.value == css[style.key];
+        });
+        options.afterFinishInternal = function(effect) {
+          effect.element.addClassName(effect.options.style);
+          effect.transforms.each(function(transform) {
+            effect.element.style[transform.style] = '';
+          });
+        }
+      }
+    }
+    this.start(options);
+  },
+  
+  setup: function(){
+    function parseColor(color){
+      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
+      color = color.parseColor();
+      return $R(0,2).map(function(i){
+        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
+      });
+    }
+    this.transforms = this.style.map(function(pair){
+      var property = pair[0], value = pair[1], unit = null;
+
+      if (value.parseColor('#zzzzzz') != '#zzzzzz') {
+        value = value.parseColor();
+        unit  = 'color';
+      } else if (property == 'opacity') {
+        value = parseFloat(value);
+        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+          this.element.setStyle({zoom: 1});
+      } else if (Element.CSS_LENGTH.test(value)) {
+          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+          value = parseFloat(components[1]);
+          unit = (components.length == 3) ? components[2] : null;
+      }
+
+      var originalValue = this.element.getStyle(property);
+      return { 
+        style: property.camelize(), 
+        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
+        targetValue: unit=='color' ? parseColor(value) : value,
+        unit: unit
+      };
+    }.bind(this)).reject(function(transform){
+      return (
+        (transform.originalValue == transform.targetValue) ||
+        (
+          transform.unit != 'color' &&
+          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
+        )
+      )
+    });
+  },
+  update: function(position) {
+    var style = { }, transform, i = this.transforms.length;
+    while(i--)
+      style[(transform = this.transforms[i]).style] = 
+        transform.unit=='color' ? '#'+
+          (Math.round(transform.originalValue[0]+
+            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
+          (Math.round(transform.originalValue[1]+
+            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
+          (Math.round(transform.originalValue[2]+
+            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
+        (transform.originalValue +
+          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
+            (transform.unit === null ? '' : transform.unit);
+    this.element.setStyle(style, true);
+  }
+});
+
+Effect.Transform = Class.create({
+  initialize: function(tracks){
+    this.tracks  = [];
+    this.options = arguments[1] || { };
+    this.addTracks(tracks);
+  },
+  addTracks: function(tracks){
+    tracks.each(function(track){
+      track = $H(track);
+      var data = track.values().first();
+      this.tracks.push($H({
+        ids:     track.keys().first(),
+        effect:  Effect.Morph,
+        options: { style: data }
+      }));
+    }.bind(this));
+    return this;
+  },
+  play: function(){
+    return new Effect.Parallel(
+      this.tracks.map(function(track){
+        var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
+        var elements = [$(ids) || $$(ids)].flatten();
+        return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
+      }).flatten(),
+      this.options
+    );
+  }
+});
+
+Element.CSS_PROPERTIES = $w(
+  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
+  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
+  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
+  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
+  'fontSize fontWeight height left letterSpacing lineHeight ' +
+  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
+  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
+  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
+  'right textIndent top width wordSpacing zIndex');
+  
+Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+String.__parseStyleElement = document.createElement('div');
+String.prototype.parseStyle = function(){
+  var style, styleRules = $H();
+  if (Prototype.Browser.WebKit)
+    style = new Element('div',{style:this}).style;
+  else {
+    String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
+    style = String.__parseStyleElement.childNodes[0].style;
+  }
+  
+  Element.CSS_PROPERTIES.each(function(property){
+    if (style[property]) styleRules.set(property, style[property]); 
+  });
+  
+  if (Prototype.Browser.IE && this.include('opacity'))
+    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
+
+  return styleRules;
+};
+
+if (document.defaultView && document.defaultView.getComputedStyle) {
+  Element.getStyles = function(element) {
+    var css = document.defaultView.getComputedStyle($(element), null);
+    return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
+      styles[property] = css[property];
+      return styles;
+    });
+  };
+} else {
+  Element.getStyles = function(element) {
+    element = $(element);
+    var css = element.currentStyle, styles;
+    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
+      results[property] = css[property];
+      return results;
+    });
+    if (!styles.opacity) styles.opacity = element.getOpacity();
+    return styles;
+  };
+};
+
+Effect.Methods = {
+  morph: function(element, style) {
+    element = $(element);
+    new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
+    return element;
+  },
+  visualEffect: function(element, effect, options) {
+    element = $(element)
+    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
+    new Effect[klass](element, options);
+    return element;
+  },
+  highlight: function(element, options) {
+    element = $(element);
+    new Effect.Highlight(element, options);
+    return element;
+  }
+};
+
+$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
+  'pulsate shake puff squish switchOff dropOut').each(
+  function(effect) { 
+    Effect.Methods[effect] = function(element, options){
+      element = $(element);
+      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
+      return element;
+    }
+  }
+);
+
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
+  function(f) { Effect.Methods[f] = Element[f]; }
+);
+
+Element.addMethods(Effect.Methods);

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/scriptaculous.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/scriptaculous.js b/extras/webjars/snorql/src/main/resources/scriptaculous/scriptaculous.js
new file mode 100755
index 0000000..b60bfd3
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/scriptaculous.js
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+var Scriptaculous = {
+  Version: '1.8.1',
+  REQUIRED_PROTOTYPE: '1.6.0',
+  load: function() {
+    function convertVersionString(versionString){
+      var r = versionString.split('.');
+      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
+    }
+ 
+    if((typeof Prototype=='undefined') || 
+       (typeof Element == 'undefined') || 
+       (typeof Element.Methods=='undefined') ||
+       (convertVersionString(Prototype.Version) < 
+        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
+       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
+        Scriptaculous.REQUIRED_PROTOTYPE);
+    
+  }
+}
+
+Scriptaculous.load();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/slider.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/slider.js b/extras/webjars/snorql/src/main/resources/scriptaculous/slider.js
new file mode 100755
index 0000000..1279f94
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/slider.js
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+if (!Control) var Control = { };
+
+// options:
+//  axis: 'vertical', or 'horizontal' (default)
+//
+// callbacks:
+//  onChange(value)
+//  onSlide(value)
+Control.Slider = Class.create({
+  initialize: function(handle, track, options) {
+    var slider = this;
+    
+    if (Object.isArray(handle)) {
+      this.handles = handle.collect( function(e) { return $(e) });
+    } else {
+      this.handles = [$(handle)];
+    }
+    
+    this.track   = $(track);
+    this.options = options || { };
+
+    this.axis      = this.options.axis || 'horizontal';
+    this.increment = this.options.increment || 1;
+    this.step      = parseInt(this.options.step || '1');
+    this.range     = this.options.range || $R(0,1);
+    
+    this.value     = 0; // assure backwards compat
+    this.values    = this.handles.map( function() { return 0 });
+    this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
+    this.options.startSpan = $(this.options.startSpan || null);
+    this.options.endSpan   = $(this.options.endSpan || null);
+
+    this.restricted = this.options.restricted || false;
+
+    this.maximum   = this.options.maximum || this.range.end;
+    this.minimum   = this.options.minimum || this.range.start;
+
+    // Will be used to align the handle onto the track, if necessary
+    this.alignX = parseInt(this.options.alignX || '0');
+    this.alignY = parseInt(this.options.alignY || '0');
+    
+    this.trackLength = this.maximumOffset() - this.minimumOffset();
+
+    this.handleLength = this.isVertical() ? 
+      (this.handles[0].offsetHeight != 0 ? 
+        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 
+      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 
+        this.handles[0].style.width.replace(/px$/,""));
+
+    this.active   = false;
+    this.dragging = false;
+    this.disabled = false;
+
+    if (this.options.disabled) this.setDisabled();
+
+    // Allowed values array
+    this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
+    if (this.allowedValues) {
+      this.minimum = this.allowedValues.min();
+      this.maximum = this.allowedValues.max();
+    }
+
+    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
+    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
+    this.eventMouseMove = this.update.bindAsEventListener(this);
+
+    // Initialize handles in reverse (make sure first handle is active)
+    this.handles.each( function(h,i) {
+      i = slider.handles.length-1-i;
+      slider.setValue(parseFloat(
+        (Object.isArray(slider.options.sliderValue) ? 
+          slider.options.sliderValue[i] : slider.options.sliderValue) || 
+         slider.range.start), i);
+      h.makePositioned().observe("mousedown", slider.eventMouseDown);
+    });
+    
+    this.track.observe("mousedown", this.eventMouseDown);
+    document.observe("mouseup", this.eventMouseUp);
+    document.observe("mousemove", this.eventMouseMove);
+    
+    this.initialized = true;
+  },
+  dispose: function() {
+    var slider = this;    
+    Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
+    Event.stopObserving(document, "mouseup", this.eventMouseUp);
+    Event.stopObserving(document, "mousemove", this.eventMouseMove);
+    this.handles.each( function(h) {
+      Event.stopObserving(h, "mousedown", slider.eventMouseDown);
+    });
+  },
+  setDisabled: function(){
+    this.disabled = true;
+  },
+  setEnabled: function(){
+    this.disabled = false;
+  },  
+  getNearestValue: function(value){
+    if (this.allowedValues){
+      if (value >= this.allowedValues.max()) return(this.allowedValues.max());
+      if (value <= this.allowedValues.min()) return(this.allowedValues.min());
+      
+      var offset = Math.abs(this.allowedValues[0] - value);
+      var newValue = this.allowedValues[0];
+      this.allowedValues.each( function(v) {
+        var currentOffset = Math.abs(v - value);
+        if (currentOffset <= offset){
+          newValue = v;
+          offset = currentOffset;
+        } 
+      });
+      return newValue;
+    }
+    if (value > this.range.end) return this.range.end;
+    if (value < this.range.start) return this.range.start;
+    return value;
+  },
+  setValue: function(sliderValue, handleIdx){
+    if (!this.active) {
+      this.activeHandleIdx = handleIdx || 0;
+      this.activeHandle    = this.handles[this.activeHandleIdx];
+      this.updateStyles();
+    }
+    handleIdx = handleIdx || this.activeHandleIdx || 0;
+    if (this.initialized && this.restricted) {
+      if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
+        sliderValue = this.values[handleIdx-1];
+      if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
+        sliderValue = this.values[handleIdx+1];
+    }
+    sliderValue = this.getNearestValue(sliderValue);
+    this.values[handleIdx] = sliderValue;
+    this.value = this.values[0]; // assure backwards compat
+    
+    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
+      this.translateToPx(sliderValue);
+    
+    this.drawSpans();
+    if (!this.dragging || !this.event) this.updateFinished();
+  },
+  setValueBy: function(delta, handleIdx) {
+    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 
+      handleIdx || this.activeHandleIdx || 0);
+  },
+  translateToPx: function(value) {
+    return Math.round(
+      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 
+      (value - this.range.start)) + "px";
+  },
+  translateToValue: function(offset) {
+    return ((offset/(this.trackLength-this.handleLength) * 
+      (this.range.end-this.range.start)) + this.range.start);
+  },
+  getRange: function(range) {
+    var v = this.values.sortBy(Prototype.K); 
+    range = range || 0;
+    return $R(v[range],v[range+1]);
+  },
+  minimumOffset: function(){
+    return(this.isVertical() ? this.alignY : this.alignX);
+  },
+  maximumOffset: function(){
+    return(this.isVertical() ? 
+      (this.track.offsetHeight != 0 ? this.track.offsetHeight :
+        this.track.style.height.replace(/px$/,"")) - this.alignY : 
+      (this.track.offsetWidth != 0 ? this.track.offsetWidth : 
+        this.track.style.width.replace(/px$/,"")) - this.alignX);
+  },  
+  isVertical:  function(){
+    return (this.axis == 'vertical');
+  },
+  drawSpans: function() {
+    var slider = this;
+    if (this.spans)
+      $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
+    if (this.options.startSpan)
+      this.setSpan(this.options.startSpan,
+        $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
+    if (this.options.endSpan)
+      this.setSpan(this.options.endSpan, 
+        $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
+  },
+  setSpan: function(span, range) {
+    if (this.isVertical()) {
+      span.style.top = this.translateToPx(range.start);
+      span.style.height = this.translateToPx(range.end - range.start + this.range.start);
+    } else {
+      span.style.left = this.translateToPx(range.start);
+      span.style.width = this.translateToPx(range.end - range.start + this.range.start);
+    }
+  },
+  updateStyles: function() {
+    this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
+    Element.addClassName(this.activeHandle, 'selected');
+  },
+  startDrag: function(event) {
+    if (Event.isLeftClick(event)) {
+      if (!this.disabled){
+        this.active = true;
+        
+        var handle = Event.element(event);
+        var pointer  = [Event.pointerX(event), Event.pointerY(event)];
+        var track = handle;
+        if (track==this.track) {
+          var offsets  = Position.cumulativeOffset(this.track); 
+          this.event = event;
+          this.setValue(this.translateToValue( 
+           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
+          ));
+          var offsets  = Position.cumulativeOffset(this.activeHandle);
+          this.offsetX = (pointer[0] - offsets[0]);
+          this.offsetY = (pointer[1] - offsets[1]);
+        } else {
+          // find the handle (prevents issues with Safari)
+          while((this.handles.indexOf(handle) == -1) && handle.parentNode) 
+            handle = handle.parentNode;
+            
+          if (this.handles.indexOf(handle)!=-1) {
+            this.activeHandle    = handle;
+            this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
+            this.updateStyles();
+            
+            var offsets  = Position.cumulativeOffset(this.activeHandle);
+            this.offsetX = (pointer[0] - offsets[0]);
+            this.offsetY = (pointer[1] - offsets[1]);
+          }
+        }
+      }
+      Event.stop(event);
+    }
+  },
+  update: function(event) {
+   if (this.active) {
+      if (!this.dragging) this.dragging = true;
+      this.draw(event);
+      if (Prototype.Browser.WebKit) window.scrollBy(0,0);
+      Event.stop(event);
+   }
+  },
+  draw: function(event) {
+    var pointer = [Event.pointerX(event), Event.pointerY(event)];
+    var offsets = Position.cumulativeOffset(this.track);
+    pointer[0] -= this.offsetX + offsets[0];
+    pointer[1] -= this.offsetY + offsets[1];
+    this.event = event;
+    this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
+    if (this.initialized && this.options.onSlide)
+      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
+  },
+  endDrag: function(event) {
+    if (this.active && this.dragging) {
+      this.finishDrag(event, true);
+      Event.stop(event);
+    }
+    this.active = false;
+    this.dragging = false;
+  },  
+  finishDrag: function(event, success) {
+    this.active = false;
+    this.dragging = false;
+    this.updateFinished();
+  },
+  updateFinished: function() {
+    if (this.initialized && this.options.onChange) 
+      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
+    this.event = null;
+  }
+});

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/sound.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/sound.js b/extras/webjars/snorql/src/main/resources/scriptaculous/sound.js
new file mode 100755
index 0000000..4d1b027
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/sound.js
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+Sound = {
+  tracks: {},
+  _enabled: true,
+  template:
+    new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
+  enable: function(){
+    Sound._enabled = true;
+  },
+  disable: function(){
+    Sound._enabled = false;
+  },
+  play: function(url){
+    if(!Sound._enabled) return;
+    var options = Object.extend({
+      track: 'global', url: url, replace: false
+    }, arguments[1] || {});
+    
+    if(options.replace && this.tracks[options.track]) {
+      $R(0, this.tracks[options.track].id).each(function(id){
+        var sound = $('sound_'+options.track+'_'+id);
+        sound.Stop && sound.Stop();
+        sound.remove();
+      })
+      this.tracks[options.track] = null;
+    }
+      
+    if(!this.tracks[options.track])
+      this.tracks[options.track] = { id: 0 }
+    else
+      this.tracks[options.track].id++;
+      
+    options.id = this.tracks[options.track].id;
+    $$('body')[0].insert( 
+      Prototype.Browser.IE ? new Element('bgsound',{
+        id: 'sound_'+options.track+'_'+options.id,
+        src: options.url, loop: 1, autostart: true
+      }) : Sound.template.evaluate(options));
+  }
+};
+
+if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
+  if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
+    Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
+  else
+    Sound.play = function(){}
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/snorql/src/main/resources/scriptaculous/unittest.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/scriptaculous/unittest.js b/extras/webjars/snorql/src/main/resources/scriptaculous/unittest.js
new file mode 100755
index 0000000..e40149c
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/scriptaculous/unittest.js
@@ -0,0 +1,578 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// script.aculo.us unittest.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// experimental, Firefox-only
+Event.simulateMouse = function(element, eventName) {
+  var options = Object.extend({
+    pointerX: 0,
+    pointerY: 0,
+    buttons:  0,
+    ctrlKey:  false,
+    altKey:   false,
+    shiftKey: false,
+    metaKey:  false
+  }, arguments[2] || {});
+  var oEvent = document.createEvent("MouseEvents");
+  oEvent.initMouseEvent(eventName, true, true, document.defaultView, 
+    options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, 
+    options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element));
+  
+  if(this.mark) Element.remove(this.mark);
+  this.mark = document.createElement('div');
+  this.mark.appendChild(document.createTextNode(" "));
+  document.body.appendChild(this.mark);
+  this.mark.style.position = 'absolute';
+  this.mark.style.top = options.pointerY + "px";
+  this.mark.style.left = options.pointerX + "px";
+  this.mark.style.width = "5px";
+  this.mark.style.height = "5px;";
+  this.mark.style.borderTop = "1px solid red;"
+  this.mark.style.borderLeft = "1px solid red;"
+  
+  if(this.step)
+    alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
+  
+  $(element).dispatchEvent(oEvent);
+};
+
+// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
+// You need to downgrade to 1.0.4 for now to get this working
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
+Event.simulateKey = function(element, eventName) {
+  var options = Object.extend({
+    ctrlKey: false,
+    altKey: false,
+    shiftKey: false,
+    metaKey: false,
+    keyCode: 0,
+    charCode: 0
+  }, arguments[2] || {});
+
+  var oEvent = document.createEvent("KeyEvents");
+  oEvent.initKeyEvent(eventName, true, true, window, 
+    options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
+    options.keyCode, options.charCode );
+  $(element).dispatchEvent(oEvent);
+};
+
+Event.simulateKeys = function(element, command) {
+  for(var i=0; i<command.length; i++) {
+    Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
+  }
+};
+
+var Test = {}
+Test.Unit = {};
+
+// security exception workaround
+Test.Unit.inspect = Object.inspect;
+
+Test.Unit.Logger = Class.create();
+Test.Unit.Logger.prototype = {
+  initialize: function(log) {
+    this.log = $(log);
+    if (this.log) {
+      this._createLogTable();
+    }
+  },
+  start: function(testName) {
+    if (!this.log) return;
+    this.testName = testName;
+    this.lastLogLine = document.createElement('tr');
+    this.statusCell = document.createElement('td');
+    this.nameCell = document.createElement('td');
+    this.nameCell.className = "nameCell";
+    this.nameCell.appendChild(document.createTextNode(testName));
+    this.messageCell = document.createElement('td');
+    this.lastLogLine.appendChild(this.statusCell);
+    this.lastLogLine.appendChild(this.nameCell);
+    this.lastLogLine.appendChild(this.messageCell);
+    this.loglines.appendChild(this.lastLogLine);
+  },
+  finish: function(status, summary) {
+    if (!this.log) return;
+    this.lastLogLine.className = status;
+    this.statusCell.innerHTML = status;
+    this.messageCell.innerHTML = this._toHTML(summary);
+    this.addLinksToResults();
+  },
+  message: function(message) {
+    if (!this.log) return;
+    this.messageCell.innerHTML = this._toHTML(message);
+  },
+  summary: function(summary) {
+    if (!this.log) return;
+    this.logsummary.innerHTML = this._toHTML(summary);
+  },
+  _createLogTable: function() {
+    this.log.innerHTML =
+    '<div id="logsummary"></div>' +
+    '<table id="logtable">' +
+    '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
+    '<tbody id="loglines"></tbody>' +
+    '</table>';
+    this.logsummary = $('logsummary')
+    this.loglines = $('loglines');
+  },
+  _toHTML: function(txt) {
+    return txt.escapeHTML().replace(/\n/g,"<br/>");
+  },
+  addLinksToResults: function(){ 
+    $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
+      td.title = "Run only this test"
+      Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
+    });
+    $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
+      td.title = "Run all tests"
+      Event.observe(td, 'click', function(){ window.location.search = "";});
+    });
+  }
+}
+
+Test.Unit.Runner = Class.create();
+Test.Unit.Runner.prototype = {
+  initialize: function(testcases) {
+    this.options = Object.extend({
+      testLog: 'testlog'
+    }, arguments[1] || {});
+    this.options.resultsURL = this.parseResultsURLQueryParameter();
+    this.options.tests      = this.parseTestsQueryParameter();
+    if (this.options.testLog) {
+      this.options.testLog = $(this.options.testLog) || null;
+    }
+    if(this.options.tests) {
+      this.tests = [];
+      for(var i = 0; i < this.options.tests.length; i++) {
+        if(/^test/.test(this.options.tests[i])) {
+          this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
+        }
+      }
+    } else {
+      if (this.options.test) {
+        this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
+      } else {
+        this.tests = [];
+        for(var testcase in testcases) {
+          if(/^test/.test(testcase)) {
+            this.tests.push(
+               new Test.Unit.Testcase(
+                 this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, 
+                 testcases[testcase], testcases["setup"], testcases["teardown"]
+               ));
+          }
+        }
+      }
+    }
+    this.currentTest = 0;
+    this.logger = new Test.Unit.Logger(this.options.testLog);
+    setTimeout(this.runTests.bind(this), 1000);
+  },
+  parseResultsURLQueryParameter: function() {
+    return window.location.search.parseQuery()["resultsURL"];
+  },
+  parseTestsQueryParameter: function(){
+    if (window.location.search.parseQuery()["tests"]){
+        return window.location.search.parseQuery()["tests"].split(',');
+    };
+  },
+  // Returns:
+  //  "ERROR" if there was an error,
+  //  "FAILURE" if there was a failure, or
+  //  "SUCCESS" if there was neither
+  getResult: function() {
+    var hasFailure = false;
+    for(var i=0;i<this.tests.length;i++) {
+      if (this.tests[i].errors > 0) {
+        return "ERROR";
+      }
+      if (this.tests[i].failures > 0) {
+        hasFailure = true;
+      }
+    }
+    if (hasFailure) {
+      return "FAILURE";
+    } else {
+      return "SUCCESS";
+    }
+  },
+  postResults: function() {
+    if (this.options.resultsURL) {
+      new Ajax.Request(this.options.resultsURL, 
+        { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
+    }
+  },
+  runTests: function() {
+    var test = this.tests[this.currentTest];
+    if (!test) {
+      // finished!
+      this.postResults();
+      this.logger.summary(this.summary());
+      return;
+    }
+    if(!test.isWaiting) {
+      this.logger.start(test.name);
+    }
+    test.run();
+    if(test.isWaiting) {
+      this.logger.message("Waiting for " + test.timeToWait + "ms");
+      setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
+    } else {
+      this.logger.finish(test.status(), test.summary());
+      this.currentTest++;
+      // tail recursive, hopefully the browser will skip the stackframe
+      this.runTests();
+    }
+  },
+  summary: function() {
+    var assertions = 0;
+    var failures = 0;
+    var errors = 0;
+    var messages = [];
+    for(var i=0;i<this.tests.length;i++) {
+      assertions +=   this.tests[i].assertions;
+      failures   +=   this.tests[i].failures;
+      errors     +=   this.tests[i].errors;
+    }
+    return (
+      (this.options.context ? this.options.context + ': ': '') + 
+      this.tests.length + " tests, " + 
+      assertions + " assertions, " + 
+      failures   + " failures, " +
+      errors     + " errors");
+  }
+}
+
+Test.Unit.Assertions = Class.create();
+Test.Unit.Assertions.prototype = {
+  initialize: function() {
+    this.assertions = 0;
+    this.failures   = 0;
+    this.errors     = 0;
+    this.messages   = [];
+  },
+  summary: function() {
+    return (
+      this.assertions + " assertions, " + 
+      this.failures   + " failures, " +
+      this.errors     + " errors" + "\n" +
+      this.messages.join("\n"));
+  },
+  pass: function() {
+    this.assertions++;
+  },
+  fail: function(message) {
+    this.failures++;
+    this.messages.push("Failure: " + message);
+  },
+  info: function(message) {
+    this.messages.push("Info: " + message);
+  },
+  error: function(error) {
+    this.errors++;
+    this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
+  },
+  status: function() {
+    if (this.failures > 0) return 'failed';
+    if (this.errors > 0) return 'error';
+    return 'passed';
+  },
+  assert: function(expression) {
+    var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
+    try { expression ? this.pass() : 
+      this.fail(message); }
+    catch(e) { this.error(e); }
+  },
+  assertEqual: function(expected, actual) {
+    var message = arguments[2] || "assertEqual";
+    try { (expected == actual) ? this.pass() :
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) + 
+        '", actual "' + Test.Unit.inspect(actual) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertInspect: function(expected, actual) {
+    var message = arguments[2] || "assertInspect";
+    try { (expected == actual.inspect()) ? this.pass() :
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) + 
+        '", actual "' + Test.Unit.inspect(actual) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertEnumEqual: function(expected, actual) {
+    var message = arguments[2] || "assertEnumEqual";
+    try { $A(expected).length == $A(actual).length && 
+      expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ?
+        this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + 
+          ', actual ' + Test.Unit.inspect(actual)); }
+    catch(e) { this.error(e); }
+  },
+  assertNotEqual: function(expected, actual) {
+    var message = arguments[2] || "assertNotEqual";
+    try { (expected != actual) ? this.pass() : 
+      this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertIdentical: function(expected, actual) { 
+    var message = arguments[2] || "assertIdentical"; 
+    try { (expected === actual) ? this.pass() : 
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
+        '", actual "' + Test.Unit.inspect(actual) + '"'); } 
+    catch(e) { this.error(e); } 
+  },
+  assertNotIdentical: function(expected, actual) { 
+    var message = arguments[2] || "assertNotIdentical"; 
+    try { !(expected === actual) ? this.pass() : 
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
+        '", actual "' + Test.Unit.inspect(actual) + '"'); } 
+    catch(e) { this.error(e); } 
+  },
+  assertNull: function(obj) {
+    var message = arguments[1] || 'assertNull'
+    try { (obj==null) ? this.pass() : 
+      this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertMatch: function(expected, actual) {
+    var message = arguments[2] || 'assertMatch';
+    var regex = new RegExp(expected);
+    try { (regex.exec(actual)) ? this.pass() :
+      this.fail(message + ' : regex: "' +  Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertHidden: function(element) {
+    var message = arguments[1] || 'assertHidden';
+    this.assertEqual("none", element.style.display, message);
+  },
+  assertNotNull: function(object) {
+    var message = arguments[1] || 'assertNotNull';
+    this.assert(object != null, message);
+  },
+  assertType: function(expected, actual) {
+    var message = arguments[2] || 'assertType';
+    try { 
+      (actual.constructor == expected) ? this.pass() : 
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
+        '", actual "' + (actual.constructor) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertNotOfType: function(expected, actual) {
+    var message = arguments[2] || 'assertNotOfType';
+    try { 
+      (actual.constructor != expected) ? this.pass() : 
+      this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
+        '", actual "' + (actual.constructor) + '"'); }
+    catch(e) { this.error(e); }
+  },
+  assertInstanceOf: function(expected, actual) {
+    var message = arguments[2] || 'assertInstanceOf';
+    try { 
+      (actual instanceof expected) ? this.pass() : 
+      this.fail(message + ": object was not an instance of the expected type"); }
+    catch(e) { this.error(e); } 
+  },
+  assertNotInstanceOf: function(expected, actual) {
+    var message = arguments[2] || 'assertNotInstanceOf';
+    try { 
+      !(actual instanceof expected) ? this.pass() : 
+      this.fail(message + ": object was an instance of the not expected type"); }
+    catch(e) { this.error(e); } 
+  },
+  assertRespondsTo: function(method, obj) {
+    var message = arguments[2] || 'assertRespondsTo';
+    try {
+      (obj[method] && typeof obj[method] == 'function') ? this.pass() : 
+      this.fail(message + ": object doesn't respond to [" + method + "]"); }
+    catch(e) { this.error(e); }
+  },
+  assertReturnsTrue: function(method, obj) {
+    var message = arguments[2] || 'assertReturnsTrue';
+    try {
+      var m = obj[method];
+      if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
+      m() ? this.pass() : 
+      this.fail(message + ": method returned false"); }
+    catch(e) { this.error(e); }
+  },
+  assertReturnsFalse: function(method, obj) {
+    var message = arguments[2] || 'assertReturnsFalse';
+    try {
+      var m = obj[method];
+      if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
+      !m() ? this.pass() : 
+      this.fail(message + ": method returned true"); }
+    catch(e) { this.error(e); }
+  },
+  assertRaise: function(exceptionName, method) {
+    var message = arguments[2] || 'assertRaise';
+    try { 
+      method();
+      this.fail(message + ": exception expected but none was raised"); }
+    catch(e) {
+      ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); 
+    }
+  },
+  assertElementsMatch: function() {
+    var expressions = $A(arguments), elements = $A(expressions.shift());
+    if (elements.length != expressions.length) {
+      this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions');
+      return false;
+    }
+    elements.zip(expressions).all(function(pair, index) {
+      var element = $(pair.first()), expression = pair.last();
+      if (element.match(expression)) return true;
+      this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect());
+    }.bind(this)) && this.pass();
+  },
+  assertElementMatches: function(element, expression) {
+    this.assertElementsMatch([element], expression);
+  },
+  benchmark: function(operation, iterations) {
+    var startAt = new Date();
+    (iterations || 1).times(operation);
+    var timeTaken = ((new Date())-startAt);
+    this.info((arguments[2] || 'Operation') + ' finished ' + 
+       iterations + ' iterations in ' + (timeTaken/1000)+'s' );
+    return timeTaken;
+  },
+  _isVisible: function(element) {
+    element = $(element);
+    if(!element.parentNode) return true;
+    this.assertNotNull(element);
+    if(element.style && Element.getStyle(element, 'display') == 'none')
+      return false;
+    
+    return this._isVisible(element.parentNode);
+  },
+  assertNotVisible: function(element) {
+    this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
+  },
+  assertVisible: function(element) {
+    this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
+  },
+  benchmark: function(operation, iterations) {
+    var startAt = new Date();
+    (iterations || 1).times(operation);
+    var timeTaken = ((new Date())-startAt);
+    this.info((arguments[2] || 'Operation') + ' finished ' + 
+       iterations + ' iterations in ' + (timeTaken/1000)+'s' );
+    return timeTaken;
+  }
+}
+
+Test.Unit.Testcase = Class.create();
+Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
+  initialize: function(name, test, setup, teardown) {
+    Test.Unit.Assertions.prototype.initialize.bind(this)();
+    this.name           = name;
+    
+    if(typeof test == 'string') {
+      test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,');
+      test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)');
+      this.test = function() {
+        eval('with(this){'+test+'}');
+      }
+    } else {
+      this.test = test || function() {};
+    }
+    
+    this.setup          = setup || function() {};
+    this.teardown       = teardown || function() {};
+    this.isWaiting      = false;
+    this.timeToWait     = 1000;
+  },
+  wait: function(time, nextPart) {
+    this.isWaiting = true;
+    this.test = nextPart;
+    this.timeToWait = time;
+  },
+  run: function() {
+    try {
+      try {
+        if (!this.isWaiting) this.setup.bind(this)();
+        this.isWaiting = false;
+        this.test.bind(this)();
+      } finally {
+        if(!this.isWaiting) {
+          this.teardown.bind(this)();
+        }
+      }
+    }
+    catch(e) { this.error(e); }
+  }
+});
+
+// *EXPERIMENTAL* BDD-style testing to please non-technical folk
+// This draws many ideas from RSpec http://rspec.rubyforge.org/
+
+Test.setupBDDExtensionMethods = function(){
+  var METHODMAP = {
+    shouldEqual:     'assertEqual',
+    shouldNotEqual:  'assertNotEqual',
+    shouldEqualEnum: 'assertEnumEqual',
+    shouldBeA:       'assertType',
+    shouldNotBeA:    'assertNotOfType',
+    shouldBeAn:      'assertType',
+    shouldNotBeAn:   'assertNotOfType',
+    shouldBeNull:    'assertNull',
+    shouldNotBeNull: 'assertNotNull',
+    
+    shouldBe:        'assertReturnsTrue',
+    shouldNotBe:     'assertReturnsFalse',
+    shouldRespondTo: 'assertRespondsTo'
+  };
+  var makeAssertion = function(assertion, args, object) { 
+   	this[assertion].apply(this,(args || []).concat([object]));
+  }
+  
+  Test.BDDMethods = {};   
+  $H(METHODMAP).each(function(pair) { 
+    Test.BDDMethods[pair.key] = function() { 
+       var args = $A(arguments); 
+       var scope = args.shift(); 
+       makeAssertion.apply(scope, [pair.value, args, this]); }; 
+  });
+  
+  [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
+    function(p){ Object.extend(p, Test.BDDMethods) }
+  );
+}
+
+Test.context = function(name, spec, log){
+  Test.setupBDDExtensionMethods();
+  
+  var compiledSpec = {};
+  var titles = {};
+  for(specName in spec) {
+    switch(specName){
+      case "setup":
+      case "teardown":
+        compiledSpec[specName] = spec[specName];
+        break;
+      default:
+        var testName = 'test'+specName.gsub(/\s+/,'-').camelize();
+        var body = spec[specName].toString().split('\n').slice(1);
+        if(/^\{/.test(body[0])) body = body.slice(1);
+        body.pop();
+        body = body.map(function(statement){ 
+          return statement.strip()
+        });
+        compiledSpec[testName] = body.join('\n');
+        titles[testName] = specName;
+    }
+  }
+  new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name });
+};
\ No newline at end of file


[32/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/lib/d3.v2.min.js
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/lib/d3.v2.min.js b/extras/webjars/sgvizler/src/main/resources/lib/d3.v2.min.js
new file mode 100644
index 0000000..521c420
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/lib/d3.v2.min.js
@@ -0,0 +1,4 @@
+(function(){function e(a,b){try{for(var c in b)Object.defineProperty(a.prototype,c,{value:b[c],enumerable:!1})}catch(d){a.prototype=b}}function g(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function h(a){return Array.prototype.slice.call(a)}function k(){}function n(a){return a}function o(){return this}function p(){return!0}function q(a){return typeof a=="function"?a:function(){return a}}function r(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function s(a){return a!=null&&!isNaN(a)}function t(a){return a.length}function v(a){return a==null}function w(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function x(a){var b=1;while(a*b%1)b*=10;return b}function A(){}function B(a){function d(){var c=b,d=-1,e=c.length,f;while(++d<e)(f=c[d].on)&&f.apply(this,arguments);return a}var b=[],c=new k;return d.on=function(d,e){var f=c.get(d),g;return arguments.length<2?f&&f.on:(f&&(f.on=null,b=b.slice(0,g=b.indexOf(f)).concat(b.slice(
 g+1)),c.remove(d)),e&&b.push(c.set(d,{on:e})),a)},d}function E(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function F(a){return a+""}function G(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function I(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function O(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function P(a){return function(b){return 1-a(1-b)}}function Q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function R(a){return a}function S(a){return function(b){return Math.pow(b,a)}}function T(a){return 1-Math.cos(a*Math.PI/2)}function U(a){return Math.pow(2,10*(a-1))}function V(a){return 1-Math.sqrt(1-a*a)}function W(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function X(a){re
 turn a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function Y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function Z(){d3.event.stopPropagation(),d3.event.preventDefault()}function $(){var a=d3.event,b;while(b=a.sourceEvent)a=b;return a}function _(a){var b=new A,c=0,d=arguments.length;while(++c<d)b[arguments[c]]=B(b);return b.of=function(c,d){return function(e){try{var f=e.sourceEvent=d3.event;e.target=a,d3.event=e,b[e.type].apply(c,d)}finally{d3.event=f}}},b}function bb(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function bc(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function bd(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function be(a,b,c){return new bf(a,b,c)}function bf(a,b,c){this.r=a,this.g=b,this.b=c}function bg(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function bh(a,
 b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(bj(h[0]),bj(h[1]),bj(h[2]))}}return(i=bk.get(a))?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function bi(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,bl(g,h,i)}function bj(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function bl(a,b,c){return new bm(a,b,c)}function bm(a,b,c){this.h=a,this.s=b,this.l=c}function bn(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}fu
 nction g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,be(g(a+120),g(a),g(a-120))}function bo(a){return j(a,bu),a}function bv(a){return function(){return bp(a,this)}}function bw(a){return function(){return bq(a,this)}}function by(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=w(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=w(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bz(a){return{__data_
 _:a}}function bA(a){return function(){return bt(this,a)}}function bB(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bD(a){return j(a,bE),a}function bF(a,b,c){j(a,bJ);var d=new k,e=d3.dispatch("start","end"),f=bR;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d.get(b):(c==null?d.remove(b):d.set(b,c),a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bS.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){return o.active>b?r():(o.active=b,d.forEach(function(a,b){(b=b.call(l,h,i))&&k.push(b)}),e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1)}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bL=b,e.end.call(l,h,i),bL=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].d
 elay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bH(a,b,c){return c!=""&&bG}function bI(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bG:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=bb(a);return typeof b=="function"?d:b==null?bH:(b+="",e)}function bS(a){var b=bL,c=bR,d=bP,e=bQ;bL=this.id,bR=this.ease();for(var f=0,g=this.length;f<g;f++)for(var h=this[f],i=0,j=h.length;i<j;i++){var k=h[i];k&&(bP=this[f][i].delay,bQ=this[f][i].duration,a.call(k=k.node,k.__data__,i,f))}return bL=b,bR=c,bP=d,bQ=e,this}function bW(){var a,b=Date.now(),c=bT;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bX()-b;d>24?(isFinite(d)&&(clearTimeout(bV),bV=setTimeout(bW,d)),bU=0):(bU=1,bY(bW))}function bX(){var a=null,b=bT,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bT=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bZ(a){var b=[a.a,a.b],c=[a.c,a
 .d],d=b_(b),e=b$(b,c),f=b_(ca(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*cb,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*cb:0}function b$(a,b){return a[0]*b[0]+a[1]*b[1]}function b_(a){var b=Math.sqrt(b$(a,a));return b&&(a[0]/=b,a[1]/=b),b}function ca(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function cd(a,b){var c=a.ownerSVGElement||a;if(c.createSVGPoint){var d=c.createSVGPoint();if(cc<0&&(window.scrollX||window.scrollY)){c=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var e=c[0][0].getScreenCTM();cc=!e.f&&!e.e,c.remove()}return cc?(d.x=b.pageX,d.y=b.pageY):(d.x=b.clientX,d.y=b.clientY),d=d.matrixTransform(a.getScreenCTM().inverse()),[d.x,d.y]}var f=a.getBoundingClientRect();return[b.clientX-f.left-a.clientLeft,b.clientY-f.top-a.clientTop]}function ce(){}function cf(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}funct
 ion cg(a){return a.rangeExtent?a.rangeExtent():cf(a.range())}function ch(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function ci(){return Math}function cj(a,b,c,d){function g(){var g=Math.min(a.length,b.length)>2?cq:cp,i=d?bd:bc;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return cn(a,b)},h.tickFormat=function(b){return co(a,b)},h.nice=function(){return ch(a,cl),g()},h.copy=function(){return cj(a,b,c,d)},g()}function ck(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clam
 p")}function cl(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function cm(a,b){var c=cf(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function cn(a,b){return d3.range.apply(d3,cm(a,b))}function co(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(cm(a,b)[2])/Math.LN10+.01))+"f")}function cp(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function cq(a,b,c,d){var e=[],f=[],g=0,h=Math.min(a.length,b.length)-1;a[h]<a[0]&&(a=a.slice().reverse(),b=b.slice().reverse());while(++g<=h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,h)-1;return f[c](e[c](b))}}function cr(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=fu
 nction(e){return arguments.length?(b=e[0]<0?cu:ct,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(ch(a.domain(),ci)),d},d.ticks=function(){var d=cf(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=cs);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cu?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return cr(a.copy(),b)},ck(d,a)}function ct(a){return Math.log(a<0?0:a)/Math.LN10}function cu(a){return-Math.log(a>0?0:-a)/Math.LN10}function cv(a,b){function e(b){return a(c(b))}var c=cw(b),d=cw(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function
 (b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return cn(e.domain(),a)},e.tickFormat=function(a){return co(e.domain(),a)},e.nice=function(){return e.domain(ch(e.domain(),cl))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=cw(b=a),d=cw(1/b),e.domain(f)},e.copy=function(){return cv(a.copy(),b)},ck(e,a)}function cw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function cx(a,b){function f(b){return d[((c.get(b)||c.set(b,a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c=new k;var e=-1,g=d.length,h;while(++e<g)c.has(h=d[e])||c.set(h,a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k)
 ,e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[1]<c[0],j=c[i-0],k=c[1-i],l=(k-j)/(a.length+h);return d=g(j+l*h,l),i&&d.reverse(),e=l*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[1]<c[0],j=c[i-0],k=c[1-i],l=Math.floor((k-j)/(a.length+h)),m=k-j-(a.length-h)*l;return d=g(j+Math.round(m/2),l),i&&d.reverse(),e=Math.round(l*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return cf(b.x)},f.copy=function(){return cx(a,b)},f.domain(a)}function cC(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return
  cC(a,b)},d()}function cD(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return cD(a,b,c)},g()}function cE(a){function b(a){return+a}return b.invert=b,b.domain=b.range=function(c){return arguments.length?(a=c.map(b),b):a},b.ticks=function(b){return cn(a,b)},b.tickFormat=function(b){return co(a,b)},b.copy=function(){return cE(a)},b}function cH(a){return a.innerRadius}function cI(a){return a.outerRadius}function cJ(a){return a.startAngle}function cK(a){return a.endAngle}function cL(a){function h(e){function o(){h.push("M",f(a(i),g))}var h=[],i=[],j=-1,k=e.length,l,m=q(b),n=q(c);while(++j<k)d.call(this,l=e[j],j)?i.push([+m.call(this,l,j),+n.call(this,l,j)]):i.length&&(o(),i=[]);return i.length&&o(),h.length?h.join(""):null}var b=cM,c=cN,
 d=p,e=cO,f=cQ,g=.7;return h.x=function(a){return arguments.length?(b=a,h):b},h.y=function(a){return arguments.length?(c=a,h):c},h.defined=function(a){return arguments.length?(d=a,h):d},h.interpolate=function(a){return arguments.length?(cP.has(a+="")||(a=cO),f=cP.get(e=a),h):e},h.tension=function(a){return arguments.length?(g=a,h):g},h}function cM(a){return a[0]}function cN(a){return a[1]}function cQ(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cR(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cS(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cT(a,b){return a.length<4?cQ(a):a[1]+cW(a.slice(1,a.length-1),cX(a,b))}function cU(a,b){return a.length<3?cQ(a):a[0]+cW((a.push(a[0]),a),cX([a[a.length-2]].concat(a,[a[1]]),b))}function cV(a,b,c){return a.length<3?cQ(a):a[0]+cW(a,c
 X(a,b))}function cW(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cQ(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cX(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cY(a){if(a.length<3)return cQ(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];de(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),de(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),de(i,g,h);return i.join("")}function cZ(a){i
 f(a.length<4)return cQ(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(da(dd,f)+","+da(dd,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),de(b,f,g);return b.join("")}function c$(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[da(dd,g),",",da(dd,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),de(b,g,h);return b.join("")}function c_(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cY(a)}function da(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function de(a,b,c){a.push("C",da(db,b),",",da(db,c),",",da(dc,b),",",da(dc,c),",",da(dd,b),",",da(dd,c))}function df(a,b){return(b[1]-a[1])/(b[0]-a[0])}function dg(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=df(e,f);while(++b<c)d[b]=g+(g=df(e=f,f=a[b+1]));return d[b]=g,d}function dh(a
 ){var b=[],c,d,e,f,g=dg(a),h=-1,i=a.length-1;while(++h<i)c=df(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function di(a){return a.length<3?cQ(a):a[0]+cW(a,dh(a))}function dj(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cF,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function dk(a){function l(g){function y(){l.push("M",h(a(n),k),j,i(a(m.reverse()),k),"Z")}var l=[],m=[],n=[],o=-1,p=g.length,r,s=q(b),t=q(d),u=b===c?function(){return w}:q(c),v=d===e?function(){return x}:q(e),w,x;while(++o<p)f.call(this,r=g[o],o)?(m.push([w=+s.call(this,r,o),x=+t.call(this,r,o)]),n.push([+u.call(this,r,o),+v.call(this,r,o)])):m.length&&(y(),m=[],n=[]);return m.length&&y(),l.length?l.join(""):null}var b=cM,c=cM,d=0,e=cN,f=p,g=cO,h=cQ,i=cQ,j="L",k=.7;return l.x=function(a){return arguments.lengt
 h?(b=c=a,l):c},l.x0=function(a){return arguments.length?(b=a,l):b},l.x1=function(a){return arguments.length?(c=a,l):c},l.y=function(a){return arguments.length?(d=e=a,l):e},l.y0=function(a){return arguments.length?(d=a,l):d},l.y1=function(a){return arguments.length?(e=a,l):e},l.defined=function(a){return arguments.length?(f=a,l):f},l.interpolate=function(a){return arguments.length?(cP.has(a+="")||(a=cO),h=cP.get(g=a),i=h.reverse||h,j=/-closed$/.test(a)?"M":"L",l):g},l.tension=function(a){return arguments.length?(k=a,l):k},l}function dl(a){return a.source}function dm(a){return a.target}function dn(a){return a.radius}function dp(a){return a.startAngle}function dq(a){return a.endAngle}function dr(a){return[a.x,a.y]}function ds(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cF;return[c*Math.cos(d),c*Math.sin(d)]}}function dt(){return 64}function du(){return"circle"}function dv(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,
 "+b+"Z"}function dz(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function dA(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dB(a,b,c){e=[];if(c&&b.length>1){var d=cf(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dG(){dE||(dE=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dE.scrollTop=1e3,dE.dispatchEvent(a),b=1e3-dE.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b}function dH(a){var b=a.source,c=a.target,d=dJ(b,c),e=[b];while(b!==d)b=b.parent,e.push(b);var f=e.length;while(c!==d)e.splice(f,0,c),c=c.parent;return e}function dI(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;return b.push(a),b}function dJ(a,b){if(a
 ===b)return a;var c=dI(a),d=dI(b),e=c.pop(),f=d.pop(),g=null;while(e===f)g=e,e=c.pop(),f=d.pop();return g}function dM(a){a.fixed|=2}function dN(a){a!==dL&&(a.fixed&=1)}function dO(){dL.fixed&=1,dK=dL=null}function dP(){dL.px=d3.event.x,dL.py=d3.event.y,dK.resume()}function dQ(a,b,c){var d=0,e=0;a.charge=0;if(!a.leaf){var f=a.nodes,g=f.length,h=-1,i;while(++h<g){i=f[h];if(i==null)continue;dQ(i,b,c),a.charge+=i.charge,d+=i.charge*i.cx,e+=i.charge*i.cy}}if(a.point){a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5);var j=b*c[a.point.index];a.charge+=a.pointCharge=j,d+=j*a.point.x,e+=j*a.point.y}a.cx=d/a.charge,a.cy=e/a.charge}function dR(a){return 20}function dS(a){return 1}function dU(a){return a.x}function dV(a){return a.y}function dW(a,b,c){a.y0=b,a.y=c}function dZ(a){return d3.range(a.length)}function d$(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}function d_(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function 
 ea(a){return a.reduce(eb,0)}function eb(a,b){return a+b[1]}function ec(a,b){return ed(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function ed(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function ee(a){return[d3.min(a),d3.max(a)]}function ef(a,b){return d3.rebind(a,b,"sort","children","value"),a.links=ej,a.nodes=function(b){return ek=!0,(a.nodes=a)(b)},a}function eg(a){return a.children}function eh(a){return a.value}function ei(a,b){return b.value-a.value}function ej(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function el(a,b){return a.value-b.value}function em(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function en(a,b){a._pack_next=b,b._pack_prev=a}function eo(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function ep(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,
 c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(eq),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],eu(g,h,i),l(i),em(g,i),g._pack_prev=i,em(i,h),h=g._pack_next;for(var m=3;m<f;m++){eu(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(eo(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(eo(k,i))break;n?(o<p||o==p&&h.r<g.r?en(g,h=j):en(g=k,h),m--):(em(g,i),h=i,l(i))}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}return a.forEach(er),s}function eq(a){a._pack_next=a._pack_prev=a}function er(a){delete a._pack_next,delete a._pack_prev}function es(a){var b=a.children;b&&b.length?(b.forEach(es),a.r=ep(b)):a.r=Math.sqrt(a.value)}function et(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)et(e[f],b,c,d)}}function eu(a,b,c){var d=a.r+c.r,e=b.x-a.x,f=b.y-a.y;if(d&&(e||f))
 {var g=b.r+c.r,h=Math.sqrt(e*e+f*f),i=Math.max(-1,Math.min(1,(d*d+h*h-g*g)/(2*d*h))),j=Math.acos(i),k=i*(d/=h),l=Math.sin(j)*d;c.x=a.x+k*e+l*f,c.y=a.y+k*f-l*e}else c.x=a.x+d,c.y=a.y}function ev(a){return 1+d3.max(a,function(a){return a.y})}function ew(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function ex(a){var b=a.children;return b&&b.length?ex(b[0]):a}function ey(a){var b=a.children,c;return b&&(c=b.length)?ey(b[c-1]):a}function ez(a,b){return a.parent==b.parent?1:2}function eA(a){var b=a.children;return b&&b.length?b[0]:a._tree.thread}function eB(a){var b=a.children,c;return b&&(c=b.length)?b[c-1]:a._tree.thread}function eC(a,b){var c=a.children;if(c&&(e=c.length)){var d,e,f=-1;while(++f<e)b(d=eC(c[f],b),a)>0&&(a=d)}return a}function eD(a,b){return a.x-b.x}function eE(a,b){return b.x-a.x}function eF(a,b){return a.depth-b.depth}function eG(a,b){function c(a,d){var e=a.children;if(e&&(i=e.length)){var f,g=null,h=-1,i;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}f
 unction eH(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function eI(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function eJ(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function eK(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function eL(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];return e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0),{x:c,y:d,dx:e,dy:f}}function eM(a){return a.map(eN).join(",")}function eN(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}function eP(a,b){return function(c){return c&&a.hasOwnProperty(c.type)?a[c.type](c):b}}function eQ(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function eR(a,b){eS.hasOwnProperty(a.type)&&eS[a.type](a,b)}function eT(a,b){eR(a.geometry,b)}function eU(a,b){for(var c=a.features,d=0,e=c.length;d<e;d++)eR(c[d].geometry,b)}function eV(a,b
 ){for(var c=a.geometries,d=0,e=c.length;d<e;d++)eR(c[d],b)}function eW(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function eX(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function eY(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d][0],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function eZ(a,b){b.apply(null,a.coordinates)}function e$(a,b){for(var c=a.coordinates[0],d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function e_(a){return a.source}function fa(a){return a.target}function fb(a,b){function q(a){var b=Math.sin(o-(a*=o))/p,c=Math.sin(a)/p,f=b*g*d+c*m*j,i=b*g*e+c*m*k,l=b*h+c*n;return[Math.atan2(i,f)/eO,Math.atan2(l,Math.sqrt(f*f+i*i))/eO]}var c=a[0]*eO,d=Math.cos(c),e=Math.sin(c),f=a[1]*eO,g=Math.cos(f),h=Math.sin(f),i=b[0]*eO,j=Math.cos(i),k=Math.sin(i),l=b[1]*eO,m=Math.cos(l),n=Math.sin(l),o=q.d=Math.acos(Math.max(-1,Math.min(1,h*n+g*m*Math.cos(i-c)))),p=Math.sin(o);return q
 }function fe(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b===0?(b=c+1,c=0):(b-=1,c+=1)}}function ff(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function fg(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function fh(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function fj(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.
 leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l,b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[fi[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y<i.y||h.y==i.y&&h.x<i.x?(j=a,k=c):(j=b,k=d);var l=f>=k.region.r.x;return l&&j.side==="l"||!l&&j.side==="r"?null:{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side==="l")return 1;if(!e&&a.side==="r"
 )return 0;if(c.a===1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)<j*f*(1+2*g/j+c.b*c.b),c.b<0&&(i=!i)}}else{var k=c.c-c.a*b.x,l=b.y-k,m=b.x-d.x,n=k-d.y;i=l*l>m*m+n*n}return a.side==="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;if(!a.ep[fi[c]])return;b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;d<g;d++){var h=e[d];if(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return f.list.length===0},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=c.li
 st.shift();var g=c.list.shift(),h,i,j,k,l,m,n,o,p,q,r,s,t;for(;;){f.empty()||(h=f.min());if(g&&(f.empty()||g.y<h.y||g.y==h.y&&g.x<h.x))i=d.leftBound(g),j=d.right(i),n=d.rightRegion(i),s=e.bisect(n,g),m=d.createHalfEdge(s,"l"),d.insert(i,m),q=e.intersect(i,m),q&&(f.del(i),f.insert(i,q,e.distance(q,g))),i=m,m=d.createHalfEdge(s,"r"),d.insert(i,m),q=e.intersect(m,j),q&&f.insert(m,q,e.distance(q,g)),g=c.list.shift();else if(!f.empty())i=f.extractMin(),k=d.left(i),j=d.right(i),l=d.right(j),n=d.leftRegion(i),o=d.rightRegion(j),r=i.vertex,e.endPoint(i.edge,i.side,r),e.endPoint(j.edge,j.side,r),d.del(i),f.del(j),d.del(j),t="l",n.y>o.y&&(p=n,n=o,o=p,t="r"),s=e.bisect(n,o),m=d.createHalfEdge(s,t),d.insert(k,m),e.endPoint(s,fi[t],r),q=e.intersect(k,m),q&&(f.del(k),f.insert(k,q,e.distance(q,n))),q=e.intersect(m,l),q&&f.insert(m,q,e.distance(q,n));else break}for(i=d.right(d.leftEnd);i!=d.rightEnd;i=d.right(i))b(i.edge)}function fk(){return{leaf:!0,nodes:[],point:null}}function fl(a,b,c,d,e,f){if
 (!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&fl(a,i[0],c,d,g,h),i[1]&&fl(a,i[1],g,d,e,h),i[2]&&fl(a,i[2],c,h,g,f),i[3]&&fl(a,i[3],g,h,e,f)}}function fm(a){return{x:a[0],y:a[1]}}function fo(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function fq(a,b,c,d){var e,f,g=0,h=b.length,i=c.length;while(g<h){if(d>=i)return-1;e=b.charCodeAt(g++);if(e==37){f=fw[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function fx(a,b,c){return fz.test(b.substring(c,c+=3))?c:-1}function fy(a,b,c){fA.lastIndex=0;var d=fA.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function fC(a,b,c){var d=fD.get(b.substring(c,c+=3).toLowerCase());return d==null?-1:(a.m=d,c)}function fE(a,b,c){fF.lastIndex=0;var d=fF.exec(b.substring(c,c+12));return d?(a.m=fG.get(d[0].toLowerCase()),c+=d[0].length):-1}function fI(a,b,c){return fq(a,fv.c.toString(),b,c)}function fJ(a,b,c){return fq(a,fv.x.toString(),b,c)}function fK(a,b,c)
 {return fq(a,fv.X.toString(),b,c)}function fL(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+4));return d?(a.y=+d[0],c+=d[0].length):-1}function fM(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.y=fN()+ +d[0],c+=d[0].length):-1}function fN(){return~~((new Date).getFullYear()/1e3)*1e3}function fO(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.m=d[0]-1,c+=d[0].length):-1}function fP(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.d=+d[0],c+=d[0].length):-1}function fQ(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.H=+d[0],c+=d[0].length):-1}function fR(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.M=+d[0],c+=d[0].length):-1}function fS(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+2));return d?(a.S=+d[0],c+=d[0].length):-1}function fT(a,b,c){fU.lastIndex=0;var d=fU.exec(b.substring(c,c+3));return d?(a.L=+d[0],c+=d[0].length):-1}function fV(a,b,c){var d=fW.get(b.substring
 (c,c+=2).toLowerCase());return d==null?-1:(a.p=d,c)}function fX(a){var b=a.getTimezoneOffset(),c=b>0?"-":"+",d=~~(Math.abs(b)/60),e=Math.abs(b)%60;return c+fr(d)+fr(e)}function fZ(a){return a.toISOString()}function f$(a,b,c){function d(b){var c=a(b),d=f(c,1);return b-c<d-b?c:d}function e(c){return b(c=a(new fn(c-1)),1),c}function f(a,c){return b(a=new fn(+a),c),a}function g(a,d,f){var g=e(a),h=[];if(f>1)while(g<d)c(g)%f||h.push(new Date(+g)),b(g,1);else while(g<d)h.push(new Date(+g)),b(g,1);return h}function h(a,b,c){try{fn=fo;var d=new fo;return d._=a,g(d,b,c)}finally{fn=Date}}a.floor=a,a.round=d,a.ceil=e,a.offset=f,a.range=g;var i=a.utc=f_(a);return i.floor=i,i.round=f_(d),i.ceil=f_(e),i.offset=f_(f),i.range=h,a}function f_(a){return function(b,c){try{fn=fo;var d=new fo;return d._=b,a(d,c)._}finally{fn=Date}}}function ga(a,b,c){function d(b){return a(
+b)}return d.invert=function(b){return gc(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(gc)},d.nice=function(a){var b=gb(d.domain());return d.domain([a.floor(b[0]),a.ceil(b[1])])},d.ticks=function(c,e){var f=gb(d.domain());if(typeof c!="function"){var g=f[1]-f[0],h=g/c,i=d3.bisect(gg,h);if(i==gg.length)return b.year(f,c);if(!i)return a.ticks(c).map(gc);Math.log(h/gg[i-1])<Math.log(gg[i]/h)&&--i,c=b[i],e=c[1],c=c[0].range}return c(f[0],new Date(+f[1]+1),e)},d.tickFormat=function(){return c},d.copy=function(){return ga(a.copy(),b,c)},d3.rebind(d,a,"range","rangeRound","interpolate","clamp")}function gb(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function gc(a){return new Date(a)}function gd(a){return function(b){var c=a.length-1,d=a[c];while(!d[1](b))d=a[--c];return d[0](b)}}function ge(a){var b=new Date(a,0,1);return b.setFullYear(a),b}function gf(a){var b=a.getFullYear(),c=ge(b),d=ge(b+1);return b+(a-c)/(d-c)}function go(a){var b=n
 ew Date(Date.UTC(a,0,1));return b.setUTCFullYear(a),b}function gp(a){var b=a.getUTCFullYear(),c=go(b),d=go(b+1);return b+(a-c)/(d-c)}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.9.1"};var f=h;try{f(document.documentElement.childNodes)[0].nodeType}catch(i){f=g}var j=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.map=function(a){var b=new k;for(var c in a)b.set(c,a[c]);return b},e(k,{has:function(a){return l+a in this},get:function(a){return this[l+a]},set:function(a,b){return this[l+a]=b},remove:function(a){return a=l+a,a in this&&delete this[a]},keys:function(){var a=[];return this.forEach(function(b){a.push(b)}),a},values:function(){var a=[];return this.forEach(function(b,c){a.push(c)}),a},entries:function(){var a=[];return this.forEach(function
 (b,c){a.push({key:b,value:c})}),a},forEach:function(a){for(var b in this)b.charCodeAt(0)===m&&a.call(this,b.substring(1),this[b])}});var l="\0",m=l.charCodeAt(0);d3.functor=q,d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=r(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)s(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)s(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(s),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)
 }return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e
 );return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,t),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisector=function(a){return{left:function(b,c,d,e){arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);while(d<e){var f=d+e>>1;a.call(b,b[f],f)<c?d=f+1:e=f}return d},right:function(b,c,d,e){arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);while(d<e){var f=d+e>>1;c<a.call(b,b[f],f)?e=f:d=f+1}return d}}};var u=d3.bisector(function(a){return a});d3.bisectLeft=u.left,d3.bisect=d3.bisectRight=u.right,d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending
 );while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],l,m,n=new k,o,p={};while(++h<i)(o=n.get(l=j(m=c[h])))?o.push(m):n.set(l,[m]);return n.forEach(function(a){p[a]=f(n.get(a),g)}),p}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;whil
 e(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=v);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c===Infinity)throw new Error("infinite range");var d=[],e=x(Math.abs(c)),f=-1,g;a*=e,b*=e,c*=e;if(c<0)while((g=a+c*++f)>b)d.push(g/e);else while((g=a+c*++f)<b)d.push(g/e);return d},d3.requote=function(a){return a.replace(y,"\\$&")};var y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),b&&d.setRequestHeader("Accept",b),d.onreadystatechange=function(){if(d.readyState===4){var a=d.status;c(a>=200&&a<300||a===304?d:null)}},d.send(null)},d3.t
 ext=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var z={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:z,qualify:function(a){var b=a.indexOf(":"),c=a;return b>=0&&(c=a.substring(0,b),a=a.substring(b+1)),z.hasOwnProperty(c)?{space:z[c],local:a}:a}},d3.dispatch=function(){var a=new A,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=B(a);return a},A.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.subst
 ring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):this[a].on(d,b)},d3.format=function(a){var b=C.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=D.get(i)||F,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=G(a)),a=b+a}else{g&&(a=G(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var C=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,D=d3.map({g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=E(a,b
 )).toFixed(Math.max(0,Math.min(20,b)))}}),H=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(I);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,E(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),H[8+c/3]};var J=S(2),K=S(3),L=function(){return R},M=d3.map({linear:L,poly:S,quad:function(){return J},cubic:function(){return K},sin:function(){return T},exp:function(){return U},circle:function(){return V},elastic:W,back:X,bounce:function(){return Y}}),N=d3.map({"in":R,out:P,"in-out":Q,"out-in":function(a){return Q(P(a))}});d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return c=M.get(c)||L,d=N.get(d)||R,O(d(c.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b
 ){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;ba.lastIndex=0;for(d=0;c=ba.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=ba.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=ba.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.
 interpolateTransform=function(a,b){var c=[],d=[],e,f=d3.transform(a),g=d3.transform(b),h=f.translate,i=g.translate,j=f.rotate,k=g.rotate,l=f.skew,m=g.skew,n=f.scale,o=g.scale;return h[0]!=i[0]||h[1]!=i[1]?(c.push("translate(",null,",",null,")"),d.push({i:1,x:d3.interpolateNumber(h[0],i[0])},{i:3,x:d3.interpolateNumber(h[1],i[1])})):i[0]||i[1]?c.push("translate("+i+")"):c.push(""),j!=k?d.push({i:c.push(c.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(j,k)}):k&&c.push(c.pop()+"rotate("+k+")"),l!=m?d.push({i:c.push(c.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(l,m)}):m&&c.push(c.pop()+"skewX("+m+")"),n[0]!=o[0]||n[1]!=o[1]?(e=c.push(c.pop()+"scale(",null,",",null,")"),d.push({i:e-4,x:d3.interpolateNumber(n[0],o[0])},{i:e-2,x:d3.interpolateNumber(n[1],o[1])})):(o[0]!=1||o[1]!=1)&&c.push(c.pop()+"scale("+o+")"),e=d.length,function(a){var b=-1,f;while(++b<e)c[(f=d[b]).i]=f.x(a);return c.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.
 r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+bg(Math.round(c+f*a))+bg(Math.round(d+g*a))+bg(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bn(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=bb(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var ba=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return
 (typeof b=="string"?bk.has(b)||/^(#|rgb\(|hsl\()/.test(b):b instanceof bf||b instanceof bm)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof bf?be(a.r,a.g,a.b):bh(""+a,be,bn):be(~~a,~~b,~~c)},bf.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?be(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),be(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},bf.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),be(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},bf.prototype.hsl=function(){return bi(this.r,this.g,this.b)},bf.prototype.toString=function(){return"#"+bg(this.r)+bg(this.g)+bg(this.b)};var bk=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#f
 fe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"
 #808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#8
 08000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});bk.forEach(function(a,b){bk.set(a,bh(b,be,bn))}),d3.hsl=function(a,b,c){return arguments.length===1?a instanceof bm?bl(a.h,a.s,a.l):bh(""+a,bi,bl):bl(+a,+b,+c)},bm.prototype.brighter=f
 unction(a){return a=Math.pow(.7,arguments.length?a:1),bl(this.h,this.s,this.l/a)},bm.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),bl(this.h,this.s,a*this.l)},bm.prototype.rgb=function(){return bn(this.h,this.s,this.l)},bm.prototype.toString=function(){return this.rgb().toString()};var bp=function(a,b){return b.querySelector(a)},bq=function(a,b){return b.querySelectorAll(a)},br=document.documentElement,bs=br.matchesSelector||br.webkitMatchesSelector||br.mozMatchesSelector||br.msMatchesSelector||br.oMatchesSelector,bt=function(a,b){return bs.call(a,b)};typeof Sizzle=="function"&&(bp=function(a,b){return Sizzle(a,b)[0]},bq=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bt=Sizzle.matchesSelector);var bu=[];d3.selection=function(){return bC},d3.selection.prototype=bu,bu.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bv(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[
 i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bo(b)},bu.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=bw(a));for(var e=-1,g=this.length;++e<g;)for(var h=this[e],i=-1,j=h.length;++i<j;)if(d=h[i])b.push(c=f(a.call(d,d.__data__,i))),c.parentNode=d;return bo(b)},bu.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bu.classed=function(a,b){var 
 c=a.split(bx),d=c.length,e=-1;if(arguments.length>1){while(++e<d)by.call(this,c[e],b);return this}while(++e<d)if(!by.call(this,c[e]))return!1;return!0};var bx=/\s+/g;bu.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bu.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bu.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.textContent=b==null?"":b}:a==null?function(){this.textContent
 =""}:function(){this.textContent=a})},bu.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.innerHTML=b==null?"":b}:a==null?function(){this.innerHTML=""}:function(){this.innerHTML=a})},bu.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bu.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),bp(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),bp(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bu.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bu.data=function(a,b){function g(a,c){var d,e=a.length,f=c.length,g=Math.min(e,f),l=Math.max(e,f),m=[],n=[],o=[],p,q;if(b)
 {var r=new k,s=[],t,u=c.length;for(d=-1;++d<e;)t=b.call(p=a[d],p.__data__,d),r.has(t)?o[u++]=p:r.set(t,p),s.push(t);for(d=-1;++d<f;)t=b.call(c,q=c[d],d),r.has(t)?(m[d]=p=r.get(t),p.__data__=q,n[d]=o[d]=null):(n[d]=bz(q),m[d]=o[d]=null),r.remove(t);for(d=-1;++d<e;)r.has(s[d])&&(o[d]=a[d])}else{for(d=-1;++d<g;)p=a[d],q=c[d],p?(p.__data__=q,m[d]=p,n[d]=o[d]=null):(n[d]=bz(q),m[d]=o[d]=null);for(;d<f;++d)n[d]=bz(c[d]),m[d]=o[d]=null;for(;d<l;++d)o[d]=a[d],n[d]=m[d]=null}n.update=m,n.parentNode=m.parentNode=o.parentNode=a.parentNode,h.push(n),i.push(m),j.push(o)}var c=-1,d=this.length,e,f;if(!arguments.length){a=new Array(d=(e=this[0]).length);while(++c<d)if(f=e[c])a[c]=f.__data__;return a}var h=bD([]),i=bo([]),j=bo([]);if(typeof a=="function")while(++c<d)g(e=this[c],a.call(e,e.parentNode.__data__,c));else while(++c<d)g(e=this[c],a);return i.enter=function(){return h},i.exit=function(){return j},i},bu.datum=bu.map=function(a){return arguments.length<1?this.property("__data__"):this.prope
 rty("__data__",a)},bu.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bA(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bo(b)},bu.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e!==f.nextSibling&&e.parentNode.insertBefore(f,e),e=f;return this},bu.sort=function(a){a=bB.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bu.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function i(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this,h=g[d];h&&(g.removeEventListener(a,h,h.$),delete g[d]),b&&(g.addEventListener(a,g[d]=i,i.$=c),i._=b)})},bu.each=function(a){for(var b=-1,c=this.length;++b<c;
 )for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bu.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bu.empty=function(){return!this.node()},bu.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bu.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:bP,duration:bQ}:null)}return bF(a,bL||++bK,Date.now())};var bC=bo([[document]]);bC[0].parentNode=br,d3.select=function(a){return typeof a=="string"?bC.select(a):bo([[a]])},d3.selectAll=function(a){return typeof a=="string"?bC.selectAll(a):bo([f(a)])};var bE=[];d3.selection.enter=bD,d3.selection.enter.prototype=bE,bE.append=bu.append,bE.insert=bu.insert,bE.empty=bu.empty,bE.node=bu.node,bE.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c
 =[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bo(b)};var bG={},bJ=[],bK=0,bL=0,bM=0,bN=250,bO=d3.ease("cubic-in-out"),bP=bM,bQ=bN,bR=bO;bJ.call=bu.call,d3.transition=function(a){return arguments.length?bL?a.transition():a:bC.transition()},d3.transition.prototype=bJ,bJ.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bv(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bF(b,this.id,this.time).ease(this.ease())},bJ.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bw(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.pus
 h({node:d[k],delay:e.delay,duration:e.duration})}return bF(b,this.id,this.time).ease(this.ease())},bJ.attr=function(a,b){return this.attrTween(a,bI(a,b))},bJ.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bG?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bG?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bJ.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bI(a,b),c)},bJ.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bG?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bJ.text=function(a){return this.tween("
 text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bJ.remove=function(){return this.each("end.transition",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bJ.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=a.apply(this,arguments)|0}:(a|=0,function(c,d,e){b[e][d].delay=a}))},bJ.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=Math.max(1,a.apply(this,arguments)|0)}:(a=Math.max(1,a|0),function(c,d,e){b[e][d].duration=a}))},bJ.transition=function(){return this.select(o)};var bT=null,bU,bV;d3.timer=function(a,b,c){var d=!1,e,f=bT;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bT={callback:a,then:c,delay:b,next:bT}),bU||(bV=clearTimeout(bV),bU=1,bY(bW))},d3.timer.flush=function(){var a,b=Date.now(),c=bT;while(c)a=b-
 c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bX()};var bY=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){var b=document.createElementNS(d3.ns.prefix.svg,"g"),c={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(a){b.setAttribute("transform",a);var d=b.transform.baseVal.consolidate();return new bZ(d?d.matrix:c)})(a)},bZ.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var cb=180/Math.PI;d3.mouse=function(a){return cd(a,$())};var cc=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(a,b){return arguments.length<2&&(b=$().touches),b?f(b).map(function(b){var c=cd(a,b);return c.identifier=b.identifier,c}):[]},d3.scale={},d3.scale.linear=function(){return cj([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return cr
 (d3.scale.linear(),ct)};var cs=d3.format(".0e");ct.pow=function(a){return Math.pow(10,a)},cu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return cv(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return cx([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cy)},d3.scale.category20=function(){return d3.scale.ordinal().range(cz)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cA)},d3.scale.category20c=function(){return d3.scale.ordinal().range(cB)};var cy=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cz=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cA=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9
 e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cB=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cC([],[])},d3.scale.quantize=function(){return cD(0,1,[0,1])},d3.scale.identity=function(){return cE([0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cF,h=d.apply(this,arguments)+cF,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cG?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*
 n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=cH,b=cI,c=cJ,d=cK;return e.innerRadius=function(b){return arguments.length?(a=q(b),e):a},e.outerRadius=function(a){return arguments.length?(b=q(a),e):b},e.startAngle=function(a){return arguments.length?(c=q(a),e):c},e.endAngle=function(a){return arguments.length?(d=q(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cF;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cF=-Math.PI/2,cG=2*Math.PI-1e-6;d3.svg.line=function(){return cL(n)};var cO="linear",cP=d3.map({linear:cQ,"step-before":cR,"step-after":cS,basis:cY,"basis-open":cZ,"basis-closed":c$,bundle:c_,cardinal:cV,"cardinal-open":cT,"cardinal-closed":cU,monotone:di}),db=[0,2/3,1/3,0],dc=[0,1/3,2/3,0],dd=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cL(dj);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cR.reverse=cS
 ,cS.reverse=cR,d3.svg.area=function(){return dk(Object)},d3.svg.area.radial=function(){var a=dk(dj);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1,e.a1-e.a0)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1,f.a1-f.a0)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cF,k=e.call(a,h,g)+cF;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b,c){return"A"+a+","+a+" 0 "+ +(c>Math.PI)+",1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=dl,b=dm,c=dn,d=cJ,e=cK;return f.radius=function(a){return arguments.length?(c=q(a),f):c},f.source=function(b){return arguments.length?(a=q(b),f):a},f.target=function(a){retur
 n arguments.length?(b=q(a),f):b},f.startAngle=function(a){return arguments.length?(d=q(a),f):d},f.endAngle=function(a){return arguments.length?(e=q(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=dl,b=dm,c=dr;return d.source=function(b){return arguments.length?(a=q(b),d):a},d.target=function(a){return arguments.length?(b=q(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=dr,c=a.projection;return a.projection=function(a){return arguments.length?c(ds(b=a)):b},a},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function c(c,d){return(dw.get(a.call(this,c,d))||dv)(b.call(this,c,d))}var a=du,b=dt;return c
+.type=function(b){return arguments.length?(a=q(b),c):a},c.size=function(a){return arguments.length?(b=q(a),c):b},c};var dw=d3.map({circle:dv,cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dy)),c=b*dy;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dx),c=b*dx/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dx),c=b*dx/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}});d3.svg.symbolTypes=dw.keys();var dx=Math.sqrt(3),dy=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function k(k){k.each(function(){var k=d3.select(this),l=h==null?a.ticks?a.ticks.apply(a,g):a.domain():h,m=i==null?a.tickFormat?a.tickFormat.apply(a,g):String:i,n=dB(a,l,j),o=k
 .selectAll(".minor").data(n,String),p=o.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),q=d3.transition(o.exit()).style("opacity",1e-6).remove(),r=d3.transition(o).style("opacity",1),s=k.selectAll("g").data(l,String),t=s.enter().insert("g","path").style("opacity",1e-6),u=d3.transition(s.exit()).style("opacity",1e-6).remove(),v=d3.transition(s).style("opacity",1),w,x=cg(a),y=k.selectAll(".domain").data([0]),z=y.enter().append("path").attr("class","domain"),A=d3.transition(y),B=a.copy(),C=this.__chart__||B;this.__chart__=B,t.append("line").attr("class","tick"),t.append("text"),v.select("text").text(m);switch(b){case"bottom":w=dz,p.attr("y2",d),r.attr("x2",0).attr("y2",d),t.select("line").attr("y2",c),t.select("text").attr("y",Math.max(c,0)+f),v.select("line").attr("x2",0).attr("y2",c),v.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),A.attr("d","M"+x[0]+","+e+"V0H"+x[1]+"V"+e);break;case"top":w=dz,p.attr(
 "y2",-d),r.attr("x2",0).attr("y2",-d),t.select("line").attr("y2",-c),t.select("text").attr("y",-(Math.max(c,0)+f)),v.select("line").attr("x2",0).attr("y2",-c),v.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),A.attr("d","M"+x[0]+","+ -e+"V0H"+x[1]+"V"+ -e);break;case"left":w=dA,p.attr("x2",-d),r.attr("x2",-d).attr("y2",0),t.select("line").attr("x2",-c),t.select("text").attr("x",-(Math.max(c,0)+f)),v.select("line").attr("x2",-c).attr("y2",0),v.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),A.attr("d","M"+ -e+","+x[0]+"H0V"+x[1]+"H"+ -e);break;case"right":w=dA,p.attr("x2",d),r.attr("x2",d).attr("y2",0),t.select("line").attr("x2",c),t.select("text").attr("x",Math.max(c,0)+f),v.select("line").attr("x2",c).attr("y2",0),v.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),A.attr("d","M"+e+","+x[0]+"H0V"+x[1]+"H"+e)}if(a.ticks)t.call(w
 ,C),v.call(w,B),u.call(w,B),p.call(w,C),r.call(w,B),q.call(w,B);else{var D=B.rangeBand()/2,E=function(a){return B(a)+D};t.call(w,E),v.call(w,E)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h=null,i,j=0;return k.scale=function(b){return arguments.length?(a=b,k):a},k.orient=function(a){return arguments.length?(b=a,k):b},k.ticks=function(){return arguments.length?(g=arguments,k):g},k.tickValues=function(a){return arguments.length?(h=a,k):h},k.tickFormat=function(a){return arguments.length?(i=a,k):i},k.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,k},k.tickPadding=function(a){return arguments.length?(f=+a,k):f},k.tickSubdivide=function(a){return arguments.length?(j=+a,k):j},k},d3.svg.brush=function(){function g(a){a.each(function(){var a=d3.select(this),e=a.selectAll(".background").data([0]),f=a.selectAll(".extent").data([0]),l=a.selectAll(".resize").data(d,String),m;a.style("pointer-events","
 all").on("mousedown.brush",k).on("touchstart.brush",k),e.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),f.enter().append("rect").attr("class","extent").style("cursor","move"),l.enter().append("g").attr("class",function(a){return"resize "+a}).style("cursor",function(a){return dC[a]}).append("rect").attr("x",function(a){return/[ew]$/.test(a)?-3:null}).attr("y",function(a){return/^[ns]/.test(a)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),l.style("display",g.empty()?"none":null),l.exit().remove(),b&&(m=cg(b),e.attr("x",m[0]).attr("width",m[1]-m[0]),i(a)),c&&(m=cg(c),e.attr("y",m[0]).attr("height",m[1]-m[0]),j(a)),h(a)})}function h(a){a.selectAll(".resize").attr("transform",function(a){return"translate("+e[+/e$/.test(a)][0]+","+e[+/^s/.test(a)][1]+")"})}function i(a){a.select(".extent").attr("x",e[0][0]),a.selectAll(".extent,.n>rect,.s>rect").attr("width",e[1][0]-e[0][0])}function j(a){a.select(".exte
 nt").attr("y",e[0][1]),a.selectAll(".extent,.e>rect,.w>rect").attr("height",e[1][1]-e[0][1])}function k(){function x(){var a=d3.event.changedTouches;return a?d3.touches(d,a)[0]:d3.mouse(d)}function y(){d3.event.keyCode==32&&(q||(r=null,s[0]-=e[1][0],s[1]-=e[1][1],q=2),Z())}function z(){d3.event.keyCode==32&&q==2&&(s[0]+=e[1][0],s[1]+=e[1][1],q=0,Z())}function A(){var a=x(),d=!1;t&&(a[0]+=t[0],a[1]+=t[1]),q||(d3.event.altKey?(r||(r=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]),s[0]=e[+(a[0]<r[0])][0],s[1]=e[+(a[1]<r[1])][1]):r=null),o&&B(a,b,0)&&(i(m),d=!0),p&&B(a,c,1)&&(j(m),d=!0),d&&(h(m),l({type:"brush",mode:q?"move":"resize"}))}function B(a,b,c){var d=cg(b),g=d[0],h=d[1],i=s[c],j=e[1][c]-e[0][c],k,l;q&&(g-=i,h-=j+i),k=Math.max(g,Math.min(h,a[c])),q?l=(k+=i)+j:(r&&(i=Math.max(g,Math.min(h,2*r[c]-k))),i<k?(l=k,k=i):l=i);if(e[0][c]!==k||e[1][c]!==l)return f=null,e[0][c]=k,e[1][c]=l,!0}function C(){A(),m.style("pointer-events","all").selectAll(".resize").style("display",g.empty()?"none"
 :null),d3.select("body").style("cursor",null),u.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),l({type:"brushend"}),Z()}var d=this,k=d3.select(d3.event.target),l=a.of(d,arguments),m=d3.select(d),n=k.datum(),o=!/^(n|s)$/.test(n)&&b,p=!/^(e|w)$/.test(n)&&c,q=k.classed("extent"),r,s=x(),t,u=d3.select(window).on("mousemove.brush",A).on("mouseup.brush",C).on("touchmove.brush",A).on("touchend.brush",C).on("keydown.brush",y).on("keyup.brush",z);if(q)s[0]=e[0][0]-s[0],s[1]=e[0][1]-s[1];else if(n){var v=+/w$/.test(n),w=+/^n/.test(n);t=[e[1-v][0]-s[0],e[1-w][1]-s[1]],s[0]=e[v][0],s[1]=e[w][1]}else d3.event.altKey&&(r=s.slice());m.style("pointer-events","none").selectAll(".resize").style("display",null),d3.select("body").style("cursor",k.style("cursor")),l({type:"brushstart"}),A(),Z()}var a=_(g,"brushstart","brush","brushend"),b=null,c=null,d=dD[0],e=[[0,0],[0,0]],f;return g.x=function(a){
 return arguments.length?(b=a,d=dD[!b<<1|!c],g):b},g.y=function(a){return arguments.length?(c=a,d=dD[!b<<1|!c],g):c},g.extent=function(a){var d,h,i,j,k;return arguments.length?(f=[[0,0],[0,0]],b&&(d=a[0],h=a[1],c&&(d=d[0],h=h[0]),f[0][0]=d,f[1][0]=h,b.invert&&(d=b(d),h=b(h)),h<d&&(k=d,d=h,h=k),e[0][0]=d|0,e[1][0]=h|0),c&&(i=a[0],j=a[1],b&&(i=i[1],j=j[1]),f[0][1]=i,f[1][1]=j,c.invert&&(i=c(i),j=c(j)),j<i&&(k=i,i=j,j=k),e[0][1]=i|0,e[1][1]=j|0),g):(a=f||e,b&&(d=a[0][0],h=a[1][0],f||(d=e[0][0],h=e[1][0],b.invert&&(d=b.invert(d),h=b.invert(h)),h<d&&(k=d,d=h,h=k))),c&&(i=a[0][1],j=a[1][1],f||(i=e[0][1],j=e[1][1],c.invert&&(i=c.invert(i),j=c.invert(j)),j<i&&(k=i,i=j,j=k))),b&&c?[[d,i],[h,j]]:b?[d,h]:c&&[i,j])},g.clear=function(){return f=null,e[0][0]=e[0][1]=e[1][0]=e[1][1]=0,g},g.empty=function(){return b&&e[0][0]===e[1][0]||c&&e[0][1]===e[1][1]},d3.rebind(g,a,"on")};var dC={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw
 -resize"},dD=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",d).on("touchstart.drag",d)}function d(){function j(){var a=c.parentNode,b=d3.event.changedTouches;return b?d3.touches(a,b)[0]:d3.mouse(a)}function k(){if(!c.parentNode)return l();var a=j(),b=a[0]-g[0],e=a[1]-g[1];h|=b|e,g=a,Z(),d({type:"drag",x:a[0]+f[0],y:a[1]+f[1],dx:b,dy:e})}function l(){d({type:"dragend"}),h&&(Z(),d3.event.target===e&&i.on("click.drag",m,!0)),i.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function m(){Z(),i.on("click.drag",null)}var c=this,d=a.of(c,arguments),e=d3.event.target,f,g=j(),h=0,i=d3.select(window).on("mousemove.drag",k).on("touchmove.drag",k).on("mouseup.drag",l,!0).on("touchend.drag",l,!0);b?(f=b.apply(c,arguments),f=[f.x-g[0],f.y-g[1]]):f=[0,0],Z(),d({type:"dragstart"})}var a=_(c,"drag","dragstart","dragend"),b=null;return c.origin=function
 (a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")},d3.behavior.zoom=function(){function l(){this.on("mousedown.zoom",r).on("mousewheel.zoom",s).on("mousemove.zoom",t).on("DOMMouseScroll.zoom",s).on("dblclick.zoom",u).on("touchstart.zoom",v).on("touchmove.zoom",w).on("touchend.zoom",v)}function m(b){return[(b[0]-a[0])/c,(b[1]-a[1])/c]}function n(b){return[b[0]*c+a[0],b[1]*c+a[1]]}function o(a){c=Math.max(e[0],Math.min(e[1],a))}function p(b,c){c=n(c),a[0]+=b[0]-c[0],a[1]+=b[1]-c[1]}function q(b){h&&h.domain(g.range().map(function(b){return(b-a[0])/c}).map(g.invert)),j&&j.domain(i.range().map(function(b){return(b-a[1])/c}).map(i.invert)),d3.event.preventDefault(),b({type:"zoom",scale:c,translate:a})}function r(){function h(){d=1,p(d3.mouse(a),g),q(b)}function i(){d&&Z(),e.on("mousemove.zoom",null).on("mouseup.zoom",null),d&&d3.event.target===c&&e.on("click.zoom",j,!0)}function j(){Z(),e.on("click.zoom",null)}var a=this,b=f.of(a,arguments),c=d3.event.target,d=0,e=d3.select(wind
 ow).on("mousemove.zoom",h).on("mouseup.zoom",i),g=m(d3.mouse(a));window.focus(),Z()}function s(){b||(b=m(d3.mouse(this))),o(Math.pow(2,dG()*.002)*c),p(d3.mouse(this),b),q(f.of(this,arguments))}function t(){b=null}function u(){var a=d3.mouse(this),b=m(a);o(d3.event.shiftKey?c/2:c*2),p(a,b),q(f.of(this,arguments))}function v(){var a=d3.touches(this),e=Date.now();d=c,b={},a.forEach(function(a){b[a.identifier]=m(a)}),Z();if(a.length===1&&e-k<500){var g=a[0],h=m(a[0]);o(c*2),p(g,h),q(f.of(this,arguments))}k=e}function w(){var a=d3.touches(this),c=a[0],e=b[c.identifier];if(g=a[1]){var g,h=b[g.identifier];c=[(c[0]+g[0])/2,(c[1]+g[1])/2],e=[(e[0]+h[0])/2,(e[1]+h[1])/2],o(d3.event.scale*d)}p(c,e),q(f.of(this,arguments))}var a=[0,0],b,c=1,d,e=dF,f=_(l,"zoom"),g,h,i,j,k;return l.translate=function(b){return arguments.length?(a=b.map(Number),l):a},l.scale=function(a){return arguments.length?(c=+a,l):c},l.scaleExtent=function(a){return arguments.length?(e=a==null?dF:a.map(Number),l):e},l.x=funct
 ion(a){return arguments.length?(h=a,g=a.copy(),l):h},l.y=function(a){return arguments.length?(j=a,i=a.copy(),l):j},d3.rebind(l,f,"on")};var dE,dF=[0,Infinity];d3.layout={},d3.layout.bundle=function(){return function(a){var b=[],c=-1,d=a.length;while(++c<d)b.push(dH(a[c]));return b}},d3.layout.chord=function(){function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[s][r],u=d[s][t],v=o,w=o+=u*n;a[s+"-"+t]={index:s,subindex:t,startAngle:v,endAngle:w,value:u}}c[s]={index:s,startAngle:p,endAngle:o,value:(o-p)/n},o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var x=a[q+"-"+r],y=a[r+"-"+q];(x.value||y.value)&&b.push(x.value<y.value?{source:y,target:x}:{source:x,target:y})}}i&&k()}function k(){b.sor
 t(function(a,b){return i((a.source.value+a.target.value)/2,(b.source.value+b.target.value)/2)})}var a={},b,c,d,e,f=0,g,h,i;return a.matrix=function(f){return arguments.length?(e=(d=f)&&d.length,b=c=null,a):d},a.padding=function(d){return arguments.length?(f=d,b=c=null,a):f},a.sortGroups=function(d){return arguments.length?(g=d,b=c=null,a):g},a.sortSubgroups=function(c){return arguments.length?(h=c,b=null,a):h},a.sortChords=function(c){return arguments.length?(i=c,b&&k(),a):i},a.chords=function(){return b||j(),b},a.groups=function(){return c||j(),c},a},d3.layout.force=function(){function t(a){return function(b,c,d,e,f){if(b.point!==a){var g=b.cx-a.x,h=b.cy-a.y,i=1/Math.sqrt(g*g+h*h);if((e-c)*i<k){var j=b.charge*i*i;return a.px-=g*j,a.py-=h*j,!0}if(b.point&&isFinite(i)){var j=b.pointCharge*i*i;a.px-=g*j,a.py-=h*j}}return!b.charge}}function u(b){dM(dL=b),dK=a}var a={},b=d3.dispatch("start","tick","end"),c=[1,1],d,e,f=.9,g=dR,h=dS,i=-30,j=.1,k=.8,l,m=[],o=[],p,r,s;return a.tick=function
 (){if((e*=.99)<.005)return b.end({type:"end",alpha:e=0}),!0;var a=m.length,d=o.length,g,h,k,l,n,q,u,v,w;for(h=0;h<d;++h){k=o[h],l=k.source,n=k.target,v=n.x-l.x,w=n.y-l.y;if(q=v*v+w*w)q=e*r[h]*((q=Math.sqrt(q))-p[h])/q,v*=q,w*=q,n.x-=v*(u=l.weight/(n.weight+l.weight)),n.y-=w*u,l.x+=v*(u=1-u),l.y+=w*u}if(u=e*j){v=c[0]/2,w=c[1]/2,h=-1;if(u)while(++h<a)k=m[h],k.x+=(v-k.x)*u,k.y+=(w-k.y)*u}if(i){dQ(g=d3.geom.quadtree(m),e,s),h=-1;while(++h<a)(k=m[h]).fixed||g.visit(t(k))}h=-1;while(++h<a)k=m[h],k.fixed?(k.x=k.px,k.y=k.py):(k.x-=(k.px-(k.px=k.x))*f,k.y-=(k.py-(k.py=k.y))*f);b.tick({type:"tick",alpha:e})},a.nodes=function(b){return arguments.length?(m=b,a):m},a.links=function(b){return arguments.length?(o=b,a):o},a.size=function(b){return arguments.length?(c=b,a):c},a.linkDistance=function(b){return arguments.length?(g=q(b),a):g},a.distance=a.linkDistance,a.linkStrength=function(b){return arguments.length?(h=q(b),a):h},a.friction=function(b){return arguments.length?(f=b,a):f},a.charge=func
 tion(b){return arguments.length?(i=typeof b=="function"?b:+b,a):i},a.gravity=function(b){return arguments.length?(j=b,a):j},a.theta=function(b){return arguments.length?(k=b,a):k},a.alpha=function(c){return arguments.length?(e?c>0?e=c:e=0:c>0&&(b.start({type:"start",alpha:e=c}),d3.timer(a.tick)),a):e},a.start=function(){function q(a,c){var d=t(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}function t(){if(!l){l=[];for(d=0;d<e;++d)l[d]=[];for(d=0;d<f;++d){var a=o[d];l[a.source.index].push(a.target),l[a.target.index].push(a.source)}}return l[b]}var b,d,e=m.length,f=o.length,j=c[0],k=c[1],l,n;for(b=0;b<e;++b)(n=m[b]).index=b,n.weight=0;p=[],r=[];for(b=0;b<f;++b)n=o[b],typeof n.source=="number"&&(n.source=m[n.source]),typeof n.target=="number"&&(n.target=m[n.target]),p[b]=g.call(this,n,b),r[b]=h.call(this,n,b),++n.source.weight,++n.target.weight;for(b=0;b<e;++b)n=m[b],isNaN(n.x)&&(n.x=q("x",j)),isNaN(n.y)&&(n.y=q("y",k)),isNaN(n.px)&&(n.px=n.x),isNa
 N(n.py)&&(n.py=n.y);s=[];if(typeof i=="function")for(b=0;b<e;++b)s[b]=+i.call(this,m[b],b);else for(b=0;b<e;++b)s[b]=i;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){d||(d=d3.behavior.drag().origin(n).on("dragstart",u).on("drag",dP).on("dragend",dO)),this.on("mouseover.force",dM).on("mouseout.force",dN).call(d)},d3.rebind(a,b,"on")};var dK,dL;d3.layout.partition=function(){function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f&&(h=f.length)){var g=-1,h,i,j;d=a.value?d/a.value:0;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}function d(a){var b=a.children,c=0;if(b&&(f=b.length)){var e=-1,f;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function e(e,f){var g=a.call(this,e,f);return c(g[0],0,b[0],b[1]/d(g[0])),g}var a=d3.layout.hierarchy(),b=[1,1];return e.size=function(a){return arguments.length?(b=a,e):b},ef(e,a)},d3.layout.pie=function(){function f(g,h){var i=g.map(function(b,c){return+a.call(f,b,c)})
 ,j=+(typeof c=="function"?c.apply(this,arguments):c),k=((typeof e=="function"?e.apply(this,arguments):e)-c)/d3.sum(i),l=d3.range(g.length);b!=null&&l.sort(b===dT?function(a,b){return i[b]-i[a]}:function(a,c){return b(g[a],g[c])});var m=[];return l.forEach(function(a){m[a]={data:g[a],value:d=i[a],startAngle:j,endAngle:j+=d*k}}),m}var a=Number,b=dT,c=0,e=2*Math.PI;return f.value=function(b){return arguments.length?(a=b,f):a},f.sort=function(a){return arguments.length?(b=a,f):b},f.startAngle=function(a){return arguments.length?(c=a,f):c},f.endAngle=function(a){return arguments.length?(e=a,f):e},f};var dT={};d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1]
 ,k[p][q][1])}return h}var a=n,b=dZ,c=d$,d=dW,e=dU,f=dV;return g.values=function(b){return arguments.length?(a=b,g):a},g.order=function(a){return arguments.length?(b=typeof a=="function"?a:dX.get(a)||dZ,g):b},g.offset=function(a){return arguments.length?(c=typeof a=="function"?a:dY.get(a)||d$,g):c},g.x=function(a){return arguments.length?(e=a,g):e},g.y=function(a){return arguments.length?(f=a,g):f},g.out=function(a){return arguments.length?(d=a,g):d},g};var dX=d3.map({"inside-out":function(a){var b=a.length,c,d,e=a.map(d_),f=a.map(ea),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":dZ}),dY=d3.map({silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){va
 r b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:d$});d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;if(m>0){f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]))}return g}var a=!0,b=Number,c=ee,d=ec;return e.value=function(a){return arguments.length?(b=a,e):b},e.range=function(a){return arguments.length?(
 c=q(a),e):c},e.bins=function(a){return arguments.length?(d=typeof a=="number"?function(b){return ed(b,a)}:q(a),e):d},e.frequency=function(b){return arguments.length?(a=!!b,e):a},e},d3.layout.hierarchy=function(){function e(f,h,i){var j=b.call(g,f,h),k=ek?f:{data:f};k.depth=h,i.push(k);if(j&&(m=j.length)){var l=-1,m,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=+c.call(g,f,h)||0);return k}function f(a,b){var d=a.children,e=0;if(d&&(i=d.length)){var h=-1,i,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=+c.call(g,ek?a:a.data,b)||0);return c&&(a.value=e),e}function g(a){var b=[];return e(a,0,b),b}var a=ei,b=eg,c=eh;return g.sort=function(b){return arguments.length?(a=b,g):a},g.children=function(a){return arguments.length?(b=a,g):b},g.value=function(a){return arguments.length?(c=a,g):c},g.revalue=function(a){return f(a,0),a},g};var ek=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.
 x=0,f.y=0,es(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);return et(f,g/2,h/2,i),e}var a=d3.layout.hierarchy().sort(el),b=[1,1];return c.size=function(a){return arguments.length?(b=a,c):b},ef(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;eG(g,function(a){var c=a.children;c&&c.length?(a.x=ew(c),a.y=ev(c)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=ex(g),m=ey(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;return eG(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-(g.y?a.y/g.y:1))*c[1]}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=ez,c=[1,1];return d.separation=function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},ef(d,a)},d3.layout.tree=function(){function d(d,e){function h(a,c){var d=a.children,e=a._tree;if(d&&(f=d.length)){var f,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;eH(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}el
 se c&&(e.prelim=c._tree.prelim+b(a,c))}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c&&(e=c.length)){var d=-1,e;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=eB(g),e=eA(e),g&&e)h=eA(h),f=eB(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(eI(eJ(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!eB(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!eA(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}var f=a.call(this,d,e),g=f[0];eG(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=eC(g,eE),l=eC(g,eD),m=eC(g,eF),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;return eG(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree}),f}var a=d3.layout.hierarchy().sort(null).value(null),b=ez,c=[1,1];return d.separation=
 function(a){return arguments.length?(b=a,d):b},d.size=function(a){return arguments.length?(c=a,d):c},ef(d,a)},d3.layout.treemap=function(){function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}function j(a){var b=a.children;if(b&&b.length){var c=e(a),d=[],f=b.slice(),g,h=Infinity,k,n=Math.min(c.dx,c.dy),o;i(f,c.dx*c.dy/a.value),d.area=0;while((o=f.length)>0)d.push(g=f[o-1]),d.area+=g.area,(k=l(d,n))<=h?(f.pop(),h=k):(d.area-=d.pop().area,m(d,n,c,!1),n=Math.min(c.dx,c.dy),d.length=d.area=0,h=Infinity);d.length&&(m(d,n,c,!0),d.length=d.area=0),b.forEach(j)}}function k(a){var b=a.children;if(b&&b.length){var c=e(a),d=b.slice(),f,g=[];i(d,c.dx*c.dy/a.value),g.area=0;while(f=d.pop())g.push(f),g.area+=f.area,f.z!=null&&(m(g,f.z?c.dx:c.dy,c,!d.length),g.length=g.area=0);b.forEach(k)}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){if(!(d=a[g].area))continue;d<f&&(f=d),d>e&&(e=d)}return c*=c,b*=b,c?Math.max(b*e*h/
 c,c/(b*f*h)):Infinity}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=Math.min(d.x+d.dx-h,j?b(k.area/j):0);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=Math.min(d.y+d.dy-i,j?b(k.area/j):0);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function n(b){var d=g||a(b),e=d[0];return e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d),d}va

<TRUNCATED>

[06/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/rdf_flyer.24.gif
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/rdf_flyer.24.gif b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/rdf_flyer.24.gif
deleted file mode 100755
index 0291161..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/rdf_flyer.24.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/builder.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/builder.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/builder.js
deleted file mode 100755
index afa33df..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/builder.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-var Builder = {
-  NODEMAP: {
-    AREA: 'map',
-    CAPTION: 'table',
-    COL: 'table',
-    COLGROUP: 'table',
-    LEGEND: 'fieldset',
-    OPTGROUP: 'select',
-    OPTION: 'select',
-    PARAM: 'object',
-    TBODY: 'table',
-    TD: 'table',
-    TFOOT: 'table',
-    TH: 'table',
-    THEAD: 'table',
-    TR: 'table'
-  },
-  // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
-  //       due to a Firefox bug
-  node: function(elementName) {
-    elementName = elementName.toUpperCase();
-    
-    // try innerHTML approach
-    var parentTag = this.NODEMAP[elementName] || 'div';
-    var parentElement = document.createElement(parentTag);
-    try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
-      parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
-    } catch(e) {}
-    var element = parentElement.firstChild || null;
-      
-    // see if browser added wrapping tags
-    if(element && (element.tagName.toUpperCase() != elementName))
-      element = element.getElementsByTagName(elementName)[0];
-    
-    // fallback to createElement approach
-    if(!element) element = document.createElement(elementName);
-    
-    // abort if nothing could be created
-    if(!element) return;
-
-    // attributes (or text)
-    if(arguments[1])
-      if(this._isStringOrNumber(arguments[1]) ||
-        (arguments[1] instanceof Array) ||
-        arguments[1].tagName) {
-          this._children(element, arguments[1]);
-        } else {
-          var attrs = this._attributes(arguments[1]);
-          if(attrs.length) {
-            try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
-              parentElement.innerHTML = "<" +elementName + " " +
-                attrs + "></" + elementName + ">";
-            } catch(e) {}
-            element = parentElement.firstChild || null;
-            // workaround firefox 1.0.X bug
-            if(!element) {
-              element = document.createElement(elementName);
-              for(attr in arguments[1]) 
-                element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
-            }
-            if(element.tagName.toUpperCase() != elementName)
-              element = parentElement.getElementsByTagName(elementName)[0];
-          }
-        } 
-
-    // text, or array of children
-    if(arguments[2])
-      this._children(element, arguments[2]);
-
-     return element;
-  },
-  _text: function(text) {
-     return document.createTextNode(text);
-  },
-
-  ATTR_MAP: {
-    'className': 'class',
-    'htmlFor': 'for'
-  },
-
-  _attributes: function(attributes) {
-    var attrs = [];
-    for(attribute in attributes)
-      attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
-          '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
-    return attrs.join(" ");
-  },
-  _children: function(element, children) {
-    if(children.tagName) {
-      element.appendChild(children);
-      return;
-    }
-    if(typeof children=='object') { // array can hold nodes and text
-      children.flatten().each( function(e) {
-        if(typeof e=='object')
-          element.appendChild(e)
-        else
-          if(Builder._isStringOrNumber(e))
-            element.appendChild(Builder._text(e));
-      });
-    } else
-      if(Builder._isStringOrNumber(children))
-        element.appendChild(Builder._text(children));
-  },
-  _isStringOrNumber: function(param) {
-    return(typeof param=='string' || typeof param=='number');
-  },
-  build: function(html) {
-    var element = this.node('div');
-    $(element).update(html.strip());
-    return element.down();
-  },
-  dump: function(scope) { 
-    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 
-  
-    var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
-      "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
-      "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
-      "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
-      "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
-      "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
-  
-    tags.each( function(tag){ 
-      scope[tag] = function() { 
-        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
-      } 
-    });
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/controls.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/controls.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/controls.js
deleted file mode 100755
index 278f99b..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/controls.js
+++ /dev/null
@@ -1,971 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least, 
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method 
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most 
-// useful when one of the tokens is \n (a newline), as it 
-// allows smart autocompletion after linebreaks.
-
-if(typeof Effect == 'undefined')
-  throw("controls.js requires including script.aculo.us' effects.js library");
-
-var Autocompleter = { }
-Autocompleter.Base = Class.create({
-  baseInitialize: function(element, update, options) {
-    element          = $(element)
-    this.element     = element; 
-    this.update      = $(update);  
-    this.hasFocus    = false; 
-    this.changed     = false; 
-    this.active      = false; 
-    this.index       = 0;     
-    this.entryCount  = 0;
-    this.oldElementValue = this.element.value;
-
-    if(this.setOptions)
-      this.setOptions(options);
-    else
-      this.options = options || { };
-
-    this.options.paramName    = this.options.paramName || this.element.name;
-    this.options.tokens       = this.options.tokens || [];
-    this.options.frequency    = this.options.frequency || 0.4;
-    this.options.minChars     = this.options.minChars || 1;
-    this.options.onShow       = this.options.onShow || 
-      function(element, update){ 
-        if(!update.style.position || update.style.position=='absolute') {
-          update.style.position = 'absolute';
-          Position.clone(element, update, {
-            setHeight: false, 
-            offsetTop: element.offsetHeight
-          });
-        }
-        Effect.Appear(update,{duration:0.15});
-      };
-    this.options.onHide = this.options.onHide || 
-      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
-    if(typeof(this.options.tokens) == 'string') 
-      this.options.tokens = new Array(this.options.tokens);
-    // Force carriage returns as token delimiters anyway
-    if (!this.options.tokens.include('\n'))
-      this.options.tokens.push('\n');
-
-    this.observer = null;
-    
-    this.element.setAttribute('autocomplete','off');
-
-    Element.hide(this.update);
-
-    Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
-    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
-  },
-
-  show: function() {
-    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
-    if(!this.iefix && 
-      (Prototype.Browser.IE) &&
-      (Element.getStyle(this.update, 'position')=='absolute')) {
-      new Insertion.After(this.update, 
-       '<iframe id="' + this.update.id + '_iefix" '+
-       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
-       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
-      this.iefix = $(this.update.id+'_iefix');
-    }
-    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
-  },
-  
-  fixIEOverlapping: function() {
-    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
-    this.iefix.style.zIndex = 1;
-    this.update.style.zIndex = 2;
-    Element.show(this.iefix);
-  },
-
-  hide: function() {
-    this.stopIndicator();
-    if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
-    if(this.iefix) Element.hide(this.iefix);
-  },
-
-  startIndicator: function() {
-    if(this.options.indicator) Element.show(this.options.indicator);
-  },
-
-  stopIndicator: function() {
-    if(this.options.indicator) Element.hide(this.options.indicator);
-  },
-
-  onKeyPress: function(event) {
-    if(this.active)
-      switch(event.keyCode) {
-       case Event.KEY_TAB:
-       case Event.KEY_RETURN:
-         this.selectEntry();
-         Event.stop(event);
-       case Event.KEY_ESC:
-         this.hide();
-         this.active = false;
-         Event.stop(event);
-         return;
-       case Event.KEY_LEFT:
-       case Event.KEY_RIGHT:
-         return;
-       case Event.KEY_UP:
-         this.markPrevious();
-         this.render();
-         Event.stop(event);
-         return;
-       case Event.KEY_DOWN:
-         this.markNext();
-         this.render();
-         Event.stop(event);
-         return;
-      }
-     else 
-       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 
-         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
-
-    this.changed = true;
-    this.hasFocus = true;
-
-    if(this.observer) clearTimeout(this.observer);
-      this.observer = 
-        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
-  },
-
-  activate: function() {
-    this.changed = false;
-    this.hasFocus = true;
-    this.getUpdatedChoices();
-  },
-
-  onHover: function(event) {
-    var element = Event.findElement(event, 'LI');
-    if(this.index != element.autocompleteIndex) 
-    {
-        this.index = element.autocompleteIndex;
-        this.render();
-    }
-    Event.stop(event);
-  },
-  
-  onClick: function(event) {
-    var element = Event.findElement(event, 'LI');
-    this.index = element.autocompleteIndex;
-    this.selectEntry();
-    this.hide();
-  },
-  
-  onBlur: function(event) {
-    // needed to make click events working
-    setTimeout(this.hide.bind(this), 250);
-    this.hasFocus = false;
-    this.active = false;     
-  }, 
-  
-  render: function() {
-    if(this.entryCount > 0) {
-      for (var i = 0; i < this.entryCount; i++)
-        this.index==i ? 
-          Element.addClassName(this.getEntry(i),"selected") : 
-          Element.removeClassName(this.getEntry(i),"selected");
-      if(this.hasFocus) { 
-        this.show();
-        this.active = true;
-      }
-    } else {
-      this.active = false;
-      this.hide();
-    }
-  },
-  
-  markPrevious: function() {
-    if(this.index > 0) this.index--
-      else this.index = this.entryCount-1;
-    this.getEntry(this.index).scrollIntoView(true);
-  },
-  
-  markNext: function() {
-    if(this.index < this.entryCount-1) this.index++
-      else this.index = 0;
-    this.getEntry(this.index).scrollIntoView(false);
-  },
-  
-  getEntry: function(index) {
-    return this.update.firstChild.childNodes[index];
-  },
-  
-  getCurrentEntry: function() {
-    return this.getEntry(this.index);
-  },
-  
-  selectEntry: function() {
-    this.active = false;
-    this.updateElement(this.getCurrentEntry());
-  },
-
-  updateElement: function(selectedElement) {
-    if (this.options.updateElement) {
-      this.options.updateElement(selectedElement);
-      return;
-    }
-    var value = '';
-    if (this.options.select) {
-      var nodes = $(selectedElement).select('.' + this.options.select) || [];
-      if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
-    } else
-      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-    
-    var bounds = this.getTokenBounds();
-    if (bounds[0] != -1) {
-      var newValue = this.element.value.substr(0, bounds[0]);
-      var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
-      if (whitespace)
-        newValue += whitespace[0];
-      this.element.value = newValue + value + this.element.value.substr(bounds[1]);
-    } else {
-      this.element.value = value;
-    }
-    this.oldElementValue = this.element.value;
-    this.element.focus();
-    
-    if (this.options.afterUpdateElement)
-      this.options.afterUpdateElement(this.element, selectedElement);
-  },
-
-  updateChoices: function(choices) {
-    if(!this.changed && this.hasFocus) {
-      this.update.innerHTML = choices;
-      Element.cleanWhitespace(this.update);
-      Element.cleanWhitespace(this.update.down());
-
-      if(this.update.firstChild && this.update.down().childNodes) {
-        this.entryCount = 
-          this.update.down().childNodes.length;
-        for (var i = 0; i < this.entryCount; i++) {
-          var entry = this.getEntry(i);
-          entry.autocompleteIndex = i;
-          this.addObservers(entry);
-        }
-      } else { 
-        this.entryCount = 0;
-      }
-
-      this.stopIndicator();
-      this.index = 0;
-      
-      if(this.entryCount==1 && this.options.autoSelect) {
-        this.selectEntry();
-        this.hide();
-      } else {
-        this.render();
-      }
-    }
-  },
-
-  addObservers: function(element) {
-    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
-    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
-  },
-
-  onObserverEvent: function() {
-    this.changed = false;   
-    this.tokenBounds = null;
-    if(this.getToken().length>=this.options.minChars) {
-      this.getUpdatedChoices();
-    } else {
-      this.active = false;
-      this.hide();
-    }
-    this.oldElementValue = this.element.value;
-  },
-
-  getToken: function() {
-    var bounds = this.getTokenBounds();
-    return this.element.value.substring(bounds[0], bounds[1]).strip();
-  },
-
-  getTokenBounds: function() {
-    if (null != this.tokenBounds) return this.tokenBounds;
-    var value = this.element.value;
-    if (value.strip().empty()) return [-1, 0];
-    var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
-    var offset = (diff == this.oldElementValue.length ? 1 : 0);
-    var prevTokenPos = -1, nextTokenPos = value.length;
-    var tp;
-    for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
-      tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
-      if (tp > prevTokenPos) prevTokenPos = tp;
-      tp = value.indexOf(this.options.tokens[index], diff + offset);
-      if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
-    }
-    return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
-  }
-});
-
-Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
-  var boundary = Math.min(newS.length, oldS.length);
-  for (var index = 0; index < boundary; ++index)
-    if (newS[index] != oldS[index])
-      return index;
-  return boundary;
-};
-
-Ajax.Autocompleter = Class.create(Autocompleter.Base, {
-  initialize: function(element, update, url, options) {
-    this.baseInitialize(element, update, options);
-    this.options.asynchronous  = true;
-    this.options.onComplete    = this.onComplete.bind(this);
-    this.options.defaultParams = this.options.parameters || null;
-    this.url                   = url;
-  },
-
-  getUpdatedChoices: function() {
-    this.startIndicator();
-    
-    var entry = encodeURIComponent(this.options.paramName) + '=' + 
-      encodeURIComponent(this.getToken());
-
-    this.options.parameters = this.options.callback ?
-      this.options.callback(this.element, entry) : entry;
-
-    if(this.options.defaultParams) 
-      this.options.parameters += '&' + this.options.defaultParams;
-    
-    new Ajax.Request(this.url, this.options);
-  },
-
-  onComplete: function(request) {
-    this.updateChoices(request.responseText);
-  }
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-//                    text only at the beginning of strings in the 
-//                    autocomplete array. Defaults to true, which will
-//                    match text at the beginning of any *word* in the
-//                    strings in the autocomplete array. If you want to
-//                    search anywhere in the string, additionally set
-//                    the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-//                   a partial match (unlike minChars, which defines
-//                   how many characters are required to do any match
-//                   at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-//                 Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector' 
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create(Autocompleter.Base, {
-  initialize: function(element, update, array, options) {
-    this.baseInitialize(element, update, options);
-    this.options.array = array;
-  },
-
-  getUpdatedChoices: function() {
-    this.updateChoices(this.options.selector(this));
-  },
-
-  setOptions: function(options) {
-    this.options = Object.extend({
-      choices: 10,
-      partialSearch: true,
-      partialChars: 2,
-      ignoreCase: true,
-      fullSearch: false,
-      selector: function(instance) {
-        var ret       = []; // Beginning matches
-        var partial   = []; // Inside matches
-        var entry     = instance.getToken();
-        var count     = 0;
-
-        for (var i = 0; i < instance.options.array.length &&  
-          ret.length < instance.options.choices ; i++) { 
-
-          var elem = instance.options.array[i];
-          var foundPos = instance.options.ignoreCase ? 
-            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
-            elem.indexOf(entry);
-
-          while (foundPos != -1) {
-            if (foundPos == 0 && elem.length != entry.length) { 
-              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
-                elem.substr(entry.length) + "</li>");
-              break;
-            } else if (entry.length >= instance.options.partialChars && 
-              instance.options.partialSearch && foundPos != -1) {
-              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
-                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
-                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
-                  foundPos + entry.length) + "</li>");
-                break;
-              }
-            }
-
-            foundPos = instance.options.ignoreCase ? 
-              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 
-              elem.indexOf(entry, foundPos + 1);
-
-          }
-        }
-        if (partial.length)
-          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
-        return "<ul>" + ret.join('') + "</ul>";
-      }
-    }, options || { });
-  }
-});
-
-// AJAX in-place editor and collection editor
-// Full rewrite by Christophe Porteneuve <td...@tddsworld.com> (April 2007).
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
-  setTimeout(function() {
-    Field.activate(field);
-  }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create({
-  initialize: function(element, url, options) {
-    this.url = url;
-    this.element = element = $(element);
-    this.prepareOptions();
-    this._controls = { };
-    arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
-    Object.extend(this.options, options || { });
-    if (!this.options.formId && this.element.id) {
-      this.options.formId = this.element.id + '-inplaceeditor';
-      if ($(this.options.formId))
-        this.options.formId = '';
-    }
-    if (this.options.externalControl)
-      this.options.externalControl = $(this.options.externalControl);
-    if (!this.options.externalControl)
-      this.options.externalControlOnly = false;
-    this._originalBackground = this.element.getStyle('background-color') || 'transparent';
-    this.element.title = this.options.clickToEditText;
-    this._boundCancelHandler = this.handleFormCancellation.bind(this);
-    this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
-    this._boundFailureHandler = this.handleAJAXFailure.bind(this);
-    this._boundSubmitHandler = this.handleFormSubmission.bind(this);
-    this._boundWrapperHandler = this.wrapUp.bind(this);
-    this.registerListeners();
-  },
-  checkForEscapeOrReturn: function(e) {
-    if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
-    if (Event.KEY_ESC == e.keyCode)
-      this.handleFormCancellation(e);
-    else if (Event.KEY_RETURN == e.keyCode)
-      this.handleFormSubmission(e);
-  },
-  createControl: function(mode, handler, extraClasses) {
-    var control = this.options[mode + 'Control'];
-    var text = this.options[mode + 'Text'];
-    if ('button' == control) {
-      var btn = document.createElement('input');
-      btn.type = 'submit';
-      btn.value = text;
-      btn.className = 'editor_' + mode + '_button';
-      if ('cancel' == mode)
-        btn.onclick = this._boundCancelHandler;
-      this._form.appendChild(btn);
-      this._controls[mode] = btn;
-    } else if ('link' == control) {
-      var link = document.createElement('a');
-      link.href = '#';
-      link.appendChild(document.createTextNode(text));
-      link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
-      link.className = 'editor_' + mode + '_link';
-      if (extraClasses)
-        link.className += ' ' + extraClasses;
-      this._form.appendChild(link);
-      this._controls[mode] = link;
-    }
-  },
-  createEditField: function() {
-    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
-    var fld;
-    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
-      fld = document.createElement('input');
-      fld.type = 'text';
-      var size = this.options.size || this.options.cols || 0;
-      if (0 < size) fld.size = size;
-    } else {
-      fld = document.createElement('textarea');
-      fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
-      fld.cols = this.options.cols || 40;
-    }
-    fld.name = this.options.paramName;
-    fld.value = text; // No HTML breaks conversion anymore
-    fld.className = 'editor_field';
-    if (this.options.submitOnBlur)
-      fld.onblur = this._boundSubmitHandler;
-    this._controls.editor = fld;
-    if (this.options.loadTextURL)
-      this.loadExternalText();
-    this._form.appendChild(this._controls.editor);
-  },
-  createForm: function() {
-    var ipe = this;
-    function addText(mode, condition) {
-      var text = ipe.options['text' + mode + 'Controls'];
-      if (!text || condition === false) return;
-      ipe._form.appendChild(document.createTextNode(text));
-    };
-    this._form = $(document.createElement('form'));
-    this._form.id = this.options.formId;
-    this._form.addClassName(this.options.formClassName);
-    this._form.onsubmit = this._boundSubmitHandler;
-    this.createEditField();
-    if ('textarea' == this._controls.editor.tagName.toLowerCase())
-      this._form.appendChild(document.createElement('br'));
-    if (this.options.onFormCustomization)
-      this.options.onFormCustomization(this, this._form);
-    addText('Before', this.options.okControl || this.options.cancelControl);
-    this.createControl('ok', this._boundSubmitHandler);
-    addText('Between', this.options.okControl && this.options.cancelControl);
-    this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
-    addText('After', this.options.okControl || this.options.cancelControl);
-  },
-  destroy: function() {
-    if (this._oldInnerHTML)
-      this.element.innerHTML = this._oldInnerHTML;
-    this.leaveEditMode();
-    this.unregisterListeners();
-  },
-  enterEditMode: function(e) {
-    if (this._saving || this._editing) return;
-    this._editing = true;
-    this.triggerCallback('onEnterEditMode');
-    if (this.options.externalControl)
-      this.options.externalControl.hide();
-    this.element.hide();
-    this.createForm();
-    this.element.parentNode.insertBefore(this._form, this.element);
-    if (!this.options.loadTextURL)
-      this.postProcessEditField();
-    if (e) Event.stop(e);
-  },
-  enterHover: function(e) {
-    if (this.options.hoverClassName)
-      this.element.addClassName(this.options.hoverClassName);
-    if (this._saving) return;
-    this.triggerCallback('onEnterHover');
-  },
-  getText: function() {
-    return this.element.innerHTML;
-  },
-  handleAJAXFailure: function(transport) {
-    this.triggerCallback('onFailure', transport);
-    if (this._oldInnerHTML) {
-      this.element.innerHTML = this._oldInnerHTML;
-      this._oldInnerHTML = null;
-    }
-  },
-  handleFormCancellation: function(e) {
-    this.wrapUp();
-    if (e) Event.stop(e);
-  },
-  handleFormSubmission: function(e) {
-    var form = this._form;
-    var value = $F(this._controls.editor);
-    this.prepareSubmission();
-    var params = this.options.callback(form, value) || '';
-    if (Object.isString(params))
-      params = params.toQueryParams();
-    params.editorId = this.element.id;
-    if (this.options.htmlResponse) {
-      var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
-      Object.extend(options, {
-        parameters: params,
-        onComplete: this._boundWrapperHandler,
-        onFailure: this._boundFailureHandler
-      });
-      new Ajax.Updater({ success: this.element }, this.url, options);
-    } else {
-      var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-      Object.extend(options, {
-        parameters: params,
-        onComplete: this._boundWrapperHandler,
-        onFailure: this._boundFailureHandler
-      });
-      new Ajax.Request(this.url, options);
-    }
-    if (e) Event.stop(e);
-  },
-  leaveEditMode: function() {
-    this.element.removeClassName(this.options.savingClassName);
-    this.removeForm();
-    this.leaveHover();
-    this.element.style.backgroundColor = this._originalBackground;
-    this.element.show();
-    if (this.options.externalControl)
-      this.options.externalControl.show();
-    this._saving = false;
-    this._editing = false;
-    this._oldInnerHTML = null;
-    this.triggerCallback('onLeaveEditMode');
-  },
-  leaveHover: function(e) {
-    if (this.options.hoverClassName)
-      this.element.removeClassName(this.options.hoverClassName);
-    if (this._saving) return;
-    this.triggerCallback('onLeaveHover');
-  },
-  loadExternalText: function() {
-    this._form.addClassName(this.options.loadingClassName);
-    this._controls.editor.disabled = true;
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        this._form.removeClassName(this.options.loadingClassName);
-        var text = transport.responseText;
-        if (this.options.stripLoadedTextTags)
-          text = text.stripTags();
-        this._controls.editor.value = text;
-        this._controls.editor.disabled = false;
-        this.postProcessEditField();
-      }.bind(this),
-      onFailure: this._boundFailureHandler
-    });
-    new Ajax.Request(this.options.loadTextURL, options);
-  },
-  postProcessEditField: function() {
-    var fpc = this.options.fieldPostCreation;
-    if (fpc)
-      $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
-  },
-  prepareOptions: function() {
-    this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
-    Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
-    [this._extraDefaultOptions].flatten().compact().each(function(defs) {
-      Object.extend(this.options, defs);
-    }.bind(this));
-  },
-  prepareSubmission: function() {
-    this._saving = true;
-    this.removeForm();
-    this.leaveHover();
-    this.showSaving();
-  },
-  registerListeners: function() {
-    this._listeners = { };
-    var listener;
-    $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
-      listener = this[pair.value].bind(this);
-      this._listeners[pair.key] = listener;
-      if (!this.options.externalControlOnly)
-        this.element.observe(pair.key, listener);
-      if (this.options.externalControl)
-        this.options.externalControl.observe(pair.key, listener);
-    }.bind(this));
-  },
-  removeForm: function() {
-    if (!this._form) return;
-    this._form.remove();
-    this._form = null;
-    this._controls = { };
-  },
-  showSaving: function() {
-    this._oldInnerHTML = this.element.innerHTML;
-    this.element.innerHTML = this.options.savingText;
-    this.element.addClassName(this.options.savingClassName);
-    this.element.style.backgroundColor = this._originalBackground;
-    this.element.show();
-  },
-  triggerCallback: function(cbName, arg) {
-    if ('function' == typeof this.options[cbName]) {
-      this.options[cbName](this, arg);
-    }
-  },
-  unregisterListeners: function() {
-    $H(this._listeners).each(function(pair) {
-      if (!this.options.externalControlOnly)
-        this.element.stopObserving(pair.key, pair.value);
-      if (this.options.externalControl)
-        this.options.externalControl.stopObserving(pair.key, pair.value);
-    }.bind(this));
-  },
-  wrapUp: function(transport) {
-    this.leaveEditMode();
-    // Can't use triggerCallback due to backward compatibility: requires
-    // binding + direct element
-    this._boundComplete(transport, this.element);
-  }
-});
-
-Object.extend(Ajax.InPlaceEditor.prototype, {
-  dispose: Ajax.InPlaceEditor.prototype.destroy
-});
-
-Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
-  initialize: function($super, element, url, options) {
-    this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
-    $super(element, url, options);
-  },
-
-  createEditField: function() {
-    var list = document.createElement('select');
-    list.name = this.options.paramName;
-    list.size = 1;
-    this._controls.editor = list;
-    this._collection = this.options.collection || [];
-    if (this.options.loadCollectionURL)
-      this.loadCollection();
-    else
-      this.checkForExternalText();
-    this._form.appendChild(this._controls.editor);
-  },
-
-  loadCollection: function() {
-    this._form.addClassName(this.options.loadingClassName);
-    this.showLoadingText(this.options.loadingCollectionText);
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        var js = transport.responseText.strip();
-        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
-          throw 'Server returned an invalid collection representation.';
-        this._collection = eval(js);
-        this.checkForExternalText();
-      }.bind(this),
-      onFailure: this.onFailure
-    });
-    new Ajax.Request(this.options.loadCollectionURL, options);
-  },
-
-  showLoadingText: function(text) {
-    this._controls.editor.disabled = true;
-    var tempOption = this._controls.editor.firstChild;
-    if (!tempOption) {
-      tempOption = document.createElement('option');
-      tempOption.value = '';
-      this._controls.editor.appendChild(tempOption);
-      tempOption.selected = true;
-    }
-    tempOption.update((text || '').stripScripts().stripTags());
-  },
-
-  checkForExternalText: function() {
-    this._text = this.getText();
-    if (this.options.loadTextURL)
-      this.loadExternalText();
-    else
-      this.buildOptionList();
-  },
-
-  loadExternalText: function() {
-    this.showLoadingText(this.options.loadingText);
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        this._text = transport.responseText.strip();
-        this.buildOptionList();
-      }.bind(this),
-      onFailure: this.onFailure
-    });
-    new Ajax.Request(this.options.loadTextURL, options);
-  },
-
-  buildOptionList: function() {
-    this._form.removeClassName(this.options.loadingClassName);
-    this._collection = this._collection.map(function(entry) {
-      return 2 === entry.length ? entry : [entry, entry].flatten();
-    });
-    var marker = ('value' in this.options) ? this.options.value : this._text;
-    var textFound = this._collection.any(function(entry) {
-      return entry[0] == marker;
-    }.bind(this));
-    this._controls.editor.update('');
-    var option;
-    this._collection.each(function(entry, index) {
-      option = document.createElement('option');
-      option.value = entry[0];
-      option.selected = textFound ? entry[0] == marker : 0 == index;
-      option.appendChild(document.createTextNode(entry[1]));
-      this._controls.editor.appendChild(option);
-    }.bind(this));
-    this._controls.editor.disabled = false;
-    Field.scrollFreeActivate(this._controls.editor);
-  }
-});
-
-//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
-//**** This only  exists for a while,  in order to  let ****
-//**** users adapt to  the new API.  Read up on the new ****
-//**** API and convert your code to it ASAP!            ****
-
-Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
-  if (!options) return;
-  function fallback(name, expr) {
-    if (name in options || expr === undefined) return;
-    options[name] = expr;
-  };
-  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
-    options.cancelLink == options.cancelButton == false ? false : undefined)));
-  fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
-    options.okLink == options.okButton == false ? false : undefined)));
-  fallback('highlightColor', options.highlightcolor);
-  fallback('highlightEndColor', options.highlightendcolor);
-};
-
-Object.extend(Ajax.InPlaceEditor, {
-  DefaultOptions: {
-    ajaxOptions: { },
-    autoRows: 3,                                // Use when multi-line w/ rows == 1
-    cancelControl: 'link',                      // 'link'|'button'|false
-    cancelText: 'cancel',
-    clickToEditText: 'Click to edit',
-    externalControl: null,                      // id|elt
-    externalControlOnly: false,
-    fieldPostCreation: 'activate',              // 'activate'|'focus'|false
-    formClassName: 'inplaceeditor-form',
-    formId: null,                               // id|elt
-    highlightColor: '#ffff99',
-    highlightEndColor: '#ffffff',
-    hoverClassName: '',
-    htmlResponse: true,
-    loadingClassName: 'inplaceeditor-loading',
-    loadingText: 'Loading...',
-    okControl: 'button',                        // 'link'|'button'|false
-    okText: 'ok',
-    paramName: 'value',
-    rows: 1,                                    // If 1 and multi-line, uses autoRows
-    savingClassName: 'inplaceeditor-saving',
-    savingText: 'Saving...',
-    size: 0,
-    stripLoadedTextTags: false,
-    submitOnBlur: false,
-    textAfterControls: '',
-    textBeforeControls: '',
-    textBetweenControls: ''
-  },
-  DefaultCallbacks: {
-    callback: function(form) {
-      return Form.serialize(form);
-    },
-    onComplete: function(transport, element) {
-      // For backward compatibility, this one is bound to the IPE, and passes
-      // the element directly.  It was too often customized, so we don't break it.
-      new Effect.Highlight(element, {
-        startcolor: this.options.highlightColor, keepBackgroundImage: true });
-    },
-    onEnterEditMode: null,
-    onEnterHover: function(ipe) {
-      ipe.element.style.backgroundColor = ipe.options.highlightColor;
-      if (ipe._effect)
-        ipe._effect.cancel();
-    },
-    onFailure: function(transport, ipe) {
-      alert('Error communication with the server: ' + transport.responseText.stripTags());
-    },
-    onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
-    onLeaveEditMode: null,
-    onLeaveHover: function(ipe) {
-      ipe._effect = new Effect.Highlight(ipe.element, {
-        startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
-        restorecolor: ipe._originalBackground, keepBackgroundImage: true
-      });
-    }
-  },
-  Listeners: {
-    click: 'enterEditMode',
-    keydown: 'checkForEscapeOrReturn',
-    mouseover: 'enterHover',
-    mouseout: 'leaveHover'
-  }
-});
-
-Ajax.InPlaceCollectionEditor.DefaultOptions = {
-  loadingCollectionText: 'Loading options...'
-};
-
-// Delayed observer, like Form.Element.Observer, 
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create({
-  initialize: function(element, delay, callback) {
-    this.delay     = delay || 0.5;
-    this.element   = $(element);
-    this.callback  = callback;
-    this.timer     = null;
-    this.lastValue = $F(this.element); 
-    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
-  },
-  delayedListener: function(event) {
-    if(this.lastValue == $F(this.element)) return;
-    if(this.timer) clearTimeout(this.timer);
-    this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
-    this.lastValue = $F(this.element);
-  },
-  onTimerEvent: function() {
-    this.timer = null;
-    this.callback(this.element, $F(this.element));
-  }
-});

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/dragdrop.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/dragdrop.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/dragdrop.js
deleted file mode 100755
index dde6393..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous/dragdrop.js
+++ /dev/null
@@ -1,985 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
-
-if(Object.isUndefined(Effect))
-  throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
-  drops: [],
-
-  remove: function(element) {
-    this.drops = this.drops.reject(function(d) { return d.element==$(element) });
-  },
-
-  add: function(element) {
-    element = $(element);
-    var options = Object.extend({
-      greedy:     true,
-      hoverclass: null,
-      tree:       false
-    }, arguments[1] || { });
-
-    // cache containers
-    if(options.containment) {
-      options._containers = [];
-      var containment = options.containment;
-      if(Object.isArray(containment)) {
-        containment.each( function(c) { options._containers.push($(c)) });
-      } else {
-        options._containers.push($(containment));
-      }
-    }
-    
-    if(options.accept) options.accept = [options.accept].flatten();
-
-    Element.makePositioned(element); // fix IE
-    options.element = element;
-
-    this.drops.push(options);
-  },
-  
-  findDeepestChild: function(drops) {
-    deepest = drops[0];
-      
-    for (i = 1; i < drops.length; ++i)
-      if (Element.isParent(drops[i].element, deepest.element))
-        deepest = drops[i];
-    
-    return deepest;
-  },
-
-  isContained: function(element, drop) {
-    var containmentNode;
-    if(drop.tree) {
-      containmentNode = element.treeNode; 
-    } else {
-      containmentNode = element.parentNode;
-    }
-    return drop._containers.detect(function(c) { return containmentNode == c });
-  },
-  
-  isAffected: function(point, element, drop) {
-    return (
-      (drop.element!=element) &&
-      ((!drop._containers) ||
-        this.isContained(element, drop)) &&
-      ((!drop.accept) ||
-        (Element.classNames(element).detect( 
-          function(v) { return drop.accept.include(v) } ) )) &&
-      Position.within(drop.element, point[0], point[1]) );
-  },
-
-  deactivate: function(drop) {
-    if(drop.hoverclass)
-      Element.removeClassName(drop.element, drop.hoverclass);
-    this.last_active = null;
-  },
-
-  activate: function(drop) {
-    if(drop.hoverclass)
-      Element.addClassName(drop.element, drop.hoverclass);
-    this.last_active = drop;
-  },
-
-  show: function(point, element) {
-    if(!this.drops.length) return;
-    var drop, affected = [];
-    
-    this.drops.each( function(drop) {
-      if(Droppables.isAffected(point, element, drop))
-        affected.push(drop);
-    });
-        
-    if(affected.length>0)
-      drop = Droppables.findDeepestChild(affected);
-
-    if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
-    if (drop) {
-      Position.within(drop.element, point[0], point[1]);
-      if(drop.onHover)
-        drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-      
-      if (drop != this.last_active) Droppables.activate(drop);
-    }
-  },
-
-  fire: function(event, element) {
-    if(!this.last_active) return;
-    Position.prepare();
-
-    if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
-      if (this.last_active.onDrop) {
-        this.last_active.onDrop(element, this.last_active.element, event); 
-        return true; 
-      }
-  },
-
-  reset: function() {
-    if(this.last_active)
-      this.deactivate(this.last_active);
-  }
-}
-
-var Draggables = {
-  drags: [],
-  observers: [],
-  
-  register: function(draggable) {
-    if(this.drags.length == 0) {
-      this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
-      this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
-      this.eventKeypress  = this.keyPress.bindAsEventListener(this);
-      
-      Event.observe(document, "mouseup", this.eventMouseUp);
-      Event.observe(document, "mousemove", this.eventMouseMove);
-      Event.observe(document, "keypress", this.eventKeypress);
-    }
-    this.drags.push(draggable);
-  },
-  
-  unregister: function(draggable) {
-    this.drags = this.drags.reject(function(d) { return d==draggable });
-    if(this.drags.length == 0) {
-      Event.stopObserving(document, "mouseup", this.eventMouseUp);
-      Event.stopObserving(document, "mousemove", this.eventMouseMove);
-      Event.stopObserving(document, "keypress", this.eventKeypress);
-    }
-  },
-  
-  activate: function(draggable) {
-    if(draggable.options.delay) { 
-      this._timeout = setTimeout(function() { 
-        Draggables._timeout = null; 
-        window.focus(); 
-        Draggables.activeDraggable = draggable; 
-      }.bind(this), draggable.options.delay); 
-    } else {
-      window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
-      this.activeDraggable = draggable;
-    }
-  },
-  
-  deactivate: function() {
-    this.activeDraggable = null;
-  },
-  
-  updateDrag: function(event) {
-    if(!this.activeDraggable) return;
-    var pointer = [Event.pointerX(event), Event.pointerY(event)];
-    // Mozilla-based browsers fire successive mousemove events with
-    // the same coordinates, prevent needless redrawing (moz bug?)
-    if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
-    this._lastPointer = pointer;
-    
-    this.activeDraggable.updateDrag(event, pointer);
-  },
-  
-  endDrag: function(event) {
-    if(this._timeout) { 
-      clearTimeout(this._timeout); 
-      this._timeout = null; 
-    }
-    if(!this.activeDraggable) return;
-    this._lastPointer = null;
-    this.activeDraggable.endDrag(event);
-    this.activeDraggable = null;
-  },
-  
-  keyPress: function(event) {
-    if(this.activeDraggable)
-      this.activeDraggable.keyPress(event);
-  },
-  
-  addObserver: function(observer) {
-    this.observers.push(observer);
-    this._cacheObserverCallbacks();
-  },
-  
-  removeObserver: function(element) {  // element instead of observer fixes mem leaks
-    this.observers = this.observers.reject( function(o) { return o.element==element });
-    this._cacheObserverCallbacks();
-  },
-  
-  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
-    if(this[eventName+'Count'] > 0)
-      this.observers.each( function(o) {
-        if(o[eventName]) o[eventName](eventName, draggable, event);
-      });
-    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
-  },
-  
-  _cacheObserverCallbacks: function() {
-    ['onStart','onEnd','onDrag'].each( function(eventName) {
-      Draggables[eventName+'Count'] = Draggables.observers.select(
-        function(o) { return o[eventName]; }
-      ).length;
-    });
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create({
-  initialize: function(element) {
-    var defaults = {
-      handle: false,
-      reverteffect: function(element, top_offset, left_offset) {
-        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
-        new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
-          queue: {scope:'_draggable', position:'end'}
-        });
-      },
-      endeffect: function(element) {
-        var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
-        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
-          queue: {scope:'_draggable', position:'end'},
-          afterFinish: function(){ 
-            Draggable._dragging[element] = false 
-          }
-        }); 
-      },
-      zindex: 1000,
-      revert: false,
-      quiet: false,
-      scroll: false,
-      scrollSensitivity: 20,
-      scrollSpeed: 15,
-      snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
-      delay: 0
-    };
-    
-    if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
-      Object.extend(defaults, {
-        starteffect: function(element) {
-          element._opacity = Element.getOpacity(element);
-          Draggable._dragging[element] = true;
-          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
-        }
-      });
-    
-    var options = Object.extend(defaults, arguments[1] || { });
-
-    this.element = $(element);
-    
-    if(options.handle && Object.isString(options.handle))
-      this.handle = this.element.down('.'+options.handle, 0);
-    
-    if(!this.handle) this.handle = $(options.handle);
-    if(!this.handle) this.handle = this.element;
-    
-    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
-      options.scroll = $(options.scroll);
-      this._isScrollChild = Element.childOf(this.element, options.scroll);
-    }
-
-    Element.makePositioned(this.element); // fix IE    
-
-    this.options  = options;
-    this.dragging = false;   
-
-    this.eventMouseDown = this.initDrag.bindAsEventListener(this);
-    Event.observe(this.handle, "mousedown", this.eventMouseDown);
-    
-    Draggables.register(this);
-  },
-  
-  destroy: function() {
-    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
-    Draggables.unregister(this);
-  },
-  
-  currentDelta: function() {
-    return([
-      parseInt(Element.getStyle(this.element,'left') || '0'),
-      parseInt(Element.getStyle(this.element,'top') || '0')]);
-  },
-  
-  initDrag: function(event) {
-    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
-      Draggable._dragging[this.element]) return;
-    if(Event.isLeftClick(event)) {    
-      // abort on form elements, fixes a Firefox issue
-      var src = Event.element(event);
-      if((tag_name = src.tagName.toUpperCase()) && (
-        tag_name=='INPUT' ||
-        tag_name=='SELECT' ||
-        tag_name=='OPTION' ||
-        tag_name=='BUTTON' ||
-        tag_name=='TEXTAREA')) return;
-        
-      var pointer = [Event.pointerX(event), Event.pointerY(event)];
-      var pos     = Position.cumulativeOffset(this.element);
-      this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-      
-      Draggables.activate(this);
-      Event.stop(event);
-    }
-  },
-  
-  startDrag: function(event) {
-    this.dragging = true;
-    if(!this.delta)
-      this.delta = this.currentDelta();
-    
-    if(this.options.zindex) {
-      this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
-      this.element.style.zIndex = this.options.zindex;
-    }
-    
-    if(this.options.ghosting) {
-      this._clone = this.element.cloneNode(true);
-      this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
-      if (!this.element._originallyAbsolute)
-        Position.absolutize(this.element);
-      this.element.parentNode.insertBefore(this._clone, this.element);
-    }
-    
-    if(this.options.scroll) {
-      if (this.options.scroll == window) {
-        var where = this._getWindowScroll(this.options.scroll);
-        this.originalScrollLeft = where.left;
-        this.originalScrollTop = where.top;
-      } else {
-        this.originalScrollLeft = this.options.scroll.scrollLeft;
-        this.originalScrollTop = this.options.scroll.scrollTop;
-      }
-    }
-    
-    Draggables.notify('onStart', this, event);
-        
-    if(this.options.starteffect) this.options.starteffect(this.element);
-  },
-  
-  updateDrag: function(event, pointer) {
-    if(!this.dragging) this.startDrag(event);
-    
-    if(!this.options.quiet){
-      Position.prepare();
-      Droppables.show(pointer, this.element);
-    }
-    
-    Draggables.notify('onDrag', this, event);
-    
-    this.draw(pointer);
-    if(this.options.change) this.options.change(this);
-    
-    if(this.options.scroll) {
-      this.stopScrolling();
-      
-      var p;
-      if (this.options.scroll == window) {
-        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
-      } else {
-        p = Position.page(this.options.scroll);
-        p[0] += this.options.scroll.scrollLeft + Position.deltaX;
-        p[1] += this.options.scroll.scrollTop + Position.deltaY;
-        p.push(p[0]+this.options.scroll.offsetWidth);
-        p.push(p[1]+this.options.scroll.offsetHeight);
-      }
-      var speed = [0,0];
-      if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
-      if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
-      if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
-      if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
-      this.startScrolling(speed);
-    }
-    
-    // fix AppleWebKit rendering
-    if(Prototype.Browser.WebKit) window.scrollBy(0,0);
-    
-    Event.stop(event);
-  },
-  
-  finishDrag: function(event, success) {
-    this.dragging = false;
-    
-    if(this.options.quiet){
-      Position.prepare();
-      var pointer = [Event.pointerX(event), Event.pointerY(event)];
-      Droppables.show(pointer, this.element);
-    }
-
-    if(this.options.ghosting) {
-      if (!this.element._originallyAbsolute)
-        Position.relativize(this.element);
-      delete this.element._originallyAbsolute;
-      Element.remove(this._clone);
-      this._clone = null;
-    }
-
-    var dropped = false; 
-    if(success) { 
-      dropped = Droppables.fire(event, this.element); 
-      if (!dropped) dropped = false; 
-    }
-    if(dropped && this.options.onDropped) this.options.onDropped(this.element);
-    Draggables.notify('onEnd', this, event);
-
-    var revert = this.options.revert;
-    if(revert && Object.isFunction(revert)) revert = revert(this.element);
-    
-    var d = this.currentDelta();
-    if(revert && this.options.reverteffect) {
-      if (dropped == 0 || revert != 'failure')
-        this.options.reverteffect(this.element,
-          d[1]-this.delta[1], d[0]-this.delta[0]);
-    } else {
-      this.delta = d;
-    }
-
-    if(this.options.zindex)
-      this.element.style.zIndex = this.originalZ;
-
-    if(this.options.endeffect) 
-      this.options.endeffect(this.element);
-      
-    Draggables.deactivate(this);
-    Droppables.reset();
-  },
-  
-  keyPress: function(event) {
-    if(event.keyCode!=Event.KEY_ESC) return;
-    this.finishDrag(event, false);
-    Event.stop(event);
-  },
-  
-  endDrag: function(event) {
-    if(!this.dragging) return;
-    this.stopScrolling();
-    this.finishDrag(event, true);
-    Event.stop(event);
-  },
-  
-  draw: function(point) {
-    var pos = Position.cumulativeOffset(this.element);
-    if(this.options.ghosting) {
-      var r   = Position.realOffset(this.element);
-      pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
-    }
-    
-    var d = this.currentDelta();
-    pos[0] -= d[0]; pos[1] -= d[1];
-    
-    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
-      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
-      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
-    }
-    
-    var p = [0,1].map(function(i){ 
-      return (point[i]-pos[i]-this.offset[i]) 
-    }.bind(this));
-    
-    if(this.options.snap) {
-      if(Object.isFunction(this.options.snap)) {
-        p = this.options.snap(p[0],p[1],this);
-      } else {
-      if(Object.isArray(this.options.snap)) {
-        p = p.map( function(v, i) {
-          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
-      } else {
-        p = p.map( function(v) {
-          return (v/this.options.snap).round()*this.options.snap }.bind(this))
-      }
-    }}
-    
-    var style = this.element.style;
-    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
-      style.left = p[0] + "px";
-    if((!this.options.constraint) || (this.options.constraint=='vertical'))
-      style.top  = p[1] + "px";
-    
-    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
-  },
-  
-  stopScrolling: function() {
-    if(this.scrollInterval) {
-      clearInterval(this.scrollInterval);
-      this.scrollInterval = null;
-      Draggables._lastScrollPointer = null;
-    }
-  },
-  
-  startScrolling: function(speed) {
-    if(!(speed[0] || speed[1])) return;
-    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
-    this.lastScrolled = new Date();
-    this.scrollInterval = setInterval(this.scroll.bind(this), 10);
-  },
-  
-  scroll: function() {
-    var current = new Date();
-    var delta = current - this.lastScrolled;
-    this.lastScrolled = current;
-    if(this.options.scroll == window) {
-      with (this._getWindowScroll(this.options.scroll)) {
-        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
-          var d = delta / 1000;
-          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
-        }
-      }
-    } else {
-      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
-      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
-    }
-    
-    Position.prepare();
-    Droppables.show(Draggables._lastPointer, this.element);
-    Draggables.notify('onDrag', this);
-    if (this._isScrollChild) {
-      Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
-      Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
-      Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
-      if (Draggables._lastScrollPointer[0] < 0)
-        Draggables._lastScrollPointer[0] = 0;
-      if (Draggables._lastScrollPointer[1] < 0)
-        Draggables._lastScrollPointer[1] = 0;
-      this.draw(Draggables._lastScrollPointer);
-    }
-    
-    if(this.options.change) this.options.change(this);
-  },
-  
-  _getWindowScroll: function(w) {
-    var T, L, W, H;
-    with (w.document) {
-      if (w.document.documentElement && documentElement.scrollTop) {
-        T = documentElement.scrollTop;
-        L = documentElement.scrollLeft;
-      } else if (w.document.body) {
-        T = body.scrollTop;
-        L = body.scrollLeft;
-      }
-      if (w.innerWidth) {
-        W = w.innerWidth;
-        H = w.innerHeight;
-      } else if (w.document.documentElement && documentElement.clientWidth) {
-        W = documentElement.clientWidth;
-        H = documentElement.clientHeight;
-      } else {
-        W = body.offsetWidth;
-        H = body.offsetHeight
-      }
-    }
-    return { top: T, left: L, width: W, height: H };
-  }
-});
-
-Draggable._dragging = { };
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create({
-  initialize: function(element, observer) {
-    this.element   = $(element);
-    this.observer  = observer;
-    this.lastValue = Sortable.serialize(this.element);
-  },
-  
-  onStart: function() {
-    this.lastValue = Sortable.serialize(this.element);
-  },
-  
-  onEnd: function() {
-    Sortable.unmark();
-    if(this.lastValue != Sortable.serialize(this.element))
-      this.observer(this.element)
-  }
-});
-
-var Sortable = {
-  SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-  
-  sortables: { },
-  
-  _findRootElement: function(element) {
-    while (element.tagName.toUpperCase() != "BODY") {  
-      if(element.id && Sortable.sortables[element.id]) return element;
-      element = element.parentNode;
-    }
-  },
-
-  options: function(element) {
-    element = Sortable._findRootElement($(element));
-    if(!element) return;
-    return Sortable.sortables[element.id];
-  },
-  
-  destroy: function(element){
-    var s = Sortable.options(element);
-    
-    if(s) {
-      Draggables.removeObserver(s.element);
-      s.droppables.each(function(d){ Droppables.remove(d) });
-      s.draggables.invoke('destroy');
-      
-      delete Sortable.sortables[s.element.id];
-    }
-  },
-
-  create: function(element) {
-    element = $(element);
-    var options = Object.extend({ 
-      element:     element,
-      tag:         'li',       // assumes li children, override with tag: 'tagname'
-      dropOnEmpty: false,
-      tree:        false,
-      treeTag:     'ul',
-      overlap:     'vertical', // one of 'vertical', 'horizontal'
-      constraint:  'vertical', // one of 'vertical', 'horizontal', false
-      containment: element,    // also takes array of elements (or id's); or false
-      handle:      false,      // or a CSS class
-      only:        false,
-      delay:       0,
-      hoverclass:  null,
-      ghosting:    false,
-      quiet:       false, 
-      scroll:      false,
-      scrollSensitivity: 20,
-      scrollSpeed: 15,
-      format:      this.SERIALIZE_RULE,
-      
-      // these take arrays of elements or ids and can be 
-      // used for better initialization performance
-      elements:    false,
-      handles:     false,
-      
-      onChange:    Prototype.emptyFunction,
-      onUpdate:    Prototype.emptyFunction
-    }, arguments[1] || { });
-
-    // clear any old sortable with same element
-    this.destroy(element);
-
-    // build options for the draggables
-    var options_for_draggable = {
-      revert:      true,
-      quiet:       options.quiet,
-      scroll:      options.scroll,
-      scrollSpeed: options.scrollSpeed,
-      scrollSensitivity: options.scrollSensitivity,
-      delay:       options.delay,
-      ghosting:    options.ghosting,
-      constraint:  options.constraint,
-      handle:      options.handle };
-
-    if(options.starteffect)
-      options_for_draggable.starteffect = options.starteffect;
-
-    if(options.reverteffect)
-      options_for_draggable.reverteffect = options.reverteffect;
-    else
-      if(options.ghosting) options_for_draggable.reverteffect = function(element) {
-        element.style.top  = 0;
-        element.style.left = 0;
-      };
-
-    if(options.endeffect)
-      options_for_draggable.endeffect = options.endeffect;
-
-    if(options.zindex)
-      options_for_draggable.zindex = options.zindex;
-
-    // build options for the droppables  
-    var options_for_droppable = {
-      overlap:     options.overlap,
-      containment: options.containment,
-      tree:        options.tree,
-      hoverclass:  options.hoverclass,
-      onHover:     Sortable.onHover
-    }
-    
-    var options_for_tree = {
-      onHover:      Sortable.onEmptyHover,
-      overlap:      options.overlap,
-      containment:  options.containment,
-      hoverclass:   options.hoverclass
-    }
-
-    // fix for gecko engine
-    Element.cleanWhitespace(element); 
-
-    options.draggables = [];
-    options.droppables = [];
-
-    // drop on empty handling
-    if(options.dropOnEmpty || options.tree) {
-      Droppables.add(element, options_for_tree);
-      options.droppables.push(element);
-    }
-
-    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
-      var handle = options.handles ? $(options.handles[i]) :
-        (options.handle ? $(e).select('.' + options.handle)[0] : e); 
-      options.draggables.push(
-        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
-      Droppables.add(e, options_for_droppable);
-      if(options.tree) e.treeNode = element;
-      options.droppables.push(e);      
-    });
-    
-    if(options.tree) {
-      (Sortable.findTreeElements(element, options) || []).each( function(e) {
-        Droppables.add(e, options_for_tree);
-        e.treeNode = element;
-        options.droppables.push(e);
-      });
-    }
-
-    // keep reference
-    this.sortables[element.id] = options;
-
-    // for onupdate
-    Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
-  },
-
-  // return all suitable-for-sortable elements in a guaranteed order
-  findElements: function(element, options) {
-    return Element.findChildren(
-      element, options.only, options.tree ? true : false, options.tag);
-  },
-  
-  findTreeElements: function(element, options) {
-    return Element.findChildren(
-      element, options.only, options.tree ? true : false, options.treeTag);
-  },
-
-  onHover: function(element, dropon, overlap) {
-    if(Element.isParent(dropon, element)) return;
-
-    if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
-      return;
-    } else if(overlap>0.5) {
-      Sortable.mark(dropon, 'before');
-      if(dropon.previousSibling != element) {
-        var oldParentNode = element.parentNode;
-        element.style.visibility = "hidden"; // fix gecko rendering
-        dropon.parentNode.insertBefore(element, dropon);
-        if(dropon.parentNode!=oldParentNode) 
-          Sortable.options(oldParentNode).onChange(element);
-        Sortable.options(dropon.parentNode).onChange(element);
-      }
-    } else {
-      Sortable.mark(dropon, 'after');
-      var nextElement = dropon.nextSibling || null;
-      if(nextElement != element) {
-        var oldParentNode = element.parentNode;
-        element.style.visibility = "hidden"; // fix gecko rendering
-        dropon.parentNode.insertBefore(element, nextElement);
-        if(dropon.parentNode!=oldParentNode) 
-          Sortable.options(oldParentNode).onChange(element);
-        Sortable.options(dropon.parentNode).onChange(element);
-      }
-    }
-  },
-  
-  onEmptyHover: function(element, dropon, overlap) {
-    var oldParentNode = element.parentNode;
-    var droponOptions = Sortable.options(dropon);
-        
-    if(!Element.isParent(dropon, element)) {
-      var index;
-      
-      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
-      var child = null;
-            
-      if(children) {
-        var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-        
-        for (index = 0; index < children.length; index += 1) {
-          if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
-            offset -= Element.offsetSize (children[index], droponOptions.overlap);
-          } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
-            child = index + 1 < children.length ? children[index + 1] : null;
-            break;
-          } else {
-            child = children[index];
-            break;
-          }
-        }
-      }
-      
-      dropon.insertBefore(element, child);
-      
-      Sortable.options(oldParentNode).onChange(element);
-      droponOptions.onChange(element);
-    }
-  },
-
-  unmark: function() {
-    if(Sortable._marker) Sortable._marker.hide();
-  },
-
-  mark: function(dropon, position) {
-    // mark on ghosting only
-    var sortable = Sortable.options(dropon.parentNode);
-    if(sortable && !sortable.ghosting) return; 
-
-    if(!Sortable._marker) {
-      Sortable._marker = 
-        ($('dropmarker') || Element.extend(document.createElement('DIV'))).
-          hide().addClassName('dropmarker').setStyle({position:'absolute'});
-      document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
-    }    
-    var offsets = Position.cumulativeOffset(dropon);
-    Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-    
-    if(position=='after')
-      if(sortable.overlap == 'horizontal') 
-        Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
-      else
-        Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-    
-    Sortable._marker.show();
-  },
-  
-  _tree: function(element, options, parent) {
-    var children = Sortable.findElements(element, options) || [];
-  
-    for (var i = 0; i < children.length; ++i) {
-      var match = children[i].id.match(options.format);
-
-      if (!match) continue;
-      
-      var child = {
-        id: encodeURIComponent(match ? match[1] : null),
-        element: element,
-        parent: parent,
-        children: [],
-        position: parent.children.length,
-        container: $(children[i]).down(options.treeTag)
-      }
-      
-      /* Get the element containing the children and recurse over it */
-      if (child.container)
-        this._tree(child.container, options, child)
-      
-      parent.children.push (child);
-    }
-
-    return parent; 
-  },
-
-  tree: function(element) {
-    element = $(element);
-    var sortableOptions = this.options(element);
-    var options = Object.extend({
-      tag: sortableOptions.tag,
-      treeTag: sortableOptions.treeTag,
-      only: sortableOptions.only,
-      name: element.id,
-      format: sortableOptions.format
-    }, arguments[1] || { });
-    
-    var root = {
-      id: null,
-      parent: null,
-      children: [],
-      container: element,
-      position: 0
-    }
-    
-    return Sortable._tree(element, options, root);
-  },
-
-  /* Construct a [i] index for a particular node */
-  _constructIndex: function(node) {
-    var index = '';
-    do {
-      if (node.id) index = '[' + node.position + ']' + index;
-    } while ((node = node.parent) != null);
-    return index;
-  },
-
-  sequence: function(element) {
-    element = $(element);
-    var options = Object.extend(this.options(element), arguments[1] || { });
-    
-    return $(this.findElements(element, options) || []).map( function(item) {
-      return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
-    });
-  },
-
-  setSequence: function(element, new_sequence) {
-    element = $(element);
-    var options = Object.extend(this.options(element), arguments[2] || { });
-    
-    var nodeMap = { };
-    this.findElements(element, options).each( function(n) {
-        if (n.id.match(options.format))
-            nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
-        n.parentNode.removeChild(n);
-    });
-   
-    new_sequence.each(function(ident) {
-      var n = nodeMap[ident];
-      if (n) {
-        n[1].appendChild(n[0]);
-        delete nodeMap[ident];
-      }
-    });
-  },
-  
-  serialize: function(element) {
-    element = $(element);
-    var options = Object.extend(Sortable.options(element), arguments[1] || { });
-    var name = encodeURIComponent(
-      (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-    
-    if (options.tree) {
-      return Sortable.tree(element, arguments[1]).children.map( function (item) {
-        return [name + Sortable._constructIndex(item) + "[id]=" + 
-                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
-      }).flatten().join('&');
-    } else {
-      return Sortable.sequence(element, arguments[1]).map( function(item) {
-        return name + "[]=" + encodeURIComponent(item);
-      }).join('&');
-    }
-  }
-}
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
-  if (!child.parentNode || child == element) return false;
-  if (child.parentNode == element) return true;
-  return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {   
-  if(!element.hasChildNodes()) return null;
-  tagName = tagName.toUpperCase();
-  if(only) only = [only].flatten();
-  var elements = [];
-  $A(element.childNodes).each( function(e) {
-    if(e.tagName && e.tagName.toUpperCase()==tagName &&
-      (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
-        elements.push(e);
-    if(recursive) {
-      var grandchildren = Element.findChildren(e, only, recursive, tagName);
-      if(grandchildren) elements.push(grandchildren);
-    }
-  });
-
-  return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
-  return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}


[15/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_24x24.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_24x24.png b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_24x24.png
deleted file mode 100644
index 141f1ca..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/Undo_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/ajax-loader-red.gif
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/ajax-loader-red.gif b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/ajax-loader-red.gif
deleted file mode 100644
index c2b1859..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/images/ajax-loader-red.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-local.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-local.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-local.js
deleted file mode 100644
index 60e2f35..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-local.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-$(document).ready(function() {
-	var sampleQuery1 = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT ?title ?uri WHERE {\n\t?uri rdf:type <http://www.w3.org/ns/ma-ont#MediaResource>.\n\t?uri <http://www.w3.org/ns/ma-ont#title> ?title\n}\nLIMIT 10";
-
-	var flintConfig = {
-		"interface": {
-			"toolbar": true,
-			"menu": true
-		},
-		"namespaces": [
-			{"name": "Friend of a friend", "prefix": "foaf", "uri": "http://xmlns.com/foaf/0.1/"},
-			{"name": "XML schema", "prefix": "xsd", "uri": "http://www.w3.org/2001/XMLSchema#"},
-			{"name": "SIOC", "prefix": "sioc", "uri": "http://rdfs.org/sioc/ns#"},
-			{"name": "Resource Description Framework", "prefix": "rdf", "uri": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
-			{"name": "Resource Description Framework schema", "prefix": "rdfs", "uri": "http://www.w3.org/2000/01/rdf-schema#"},
-			{"name": "Dublin Core", "prefix": "dc", "uri": "http://purl.org/dc/elements/1.1/"},
-			{"name": "Dublin Core terms", "prefix": "dct", "uri": "http://purl.org/dc/terms/"},
-			{"name": "Creative Commons", "prefix": "cc", "uri": "http://www.creativecommons.org/ns#"},
-			{"name": "Web Ontology Language", "prefix": "owl", "uri": "http://www.w3.org/2002/07/owl#"},
-			{"name": "Simple Knowledge Organisation System", "prefix": "skos", "uri": "http://www.w3.org/2004/02/skos/core#"},
-			{"name": "Geography", "prefix": "geo", "uri": "http://www.w3.org/2003/01/geo/wgs84_pos#"},
-			{"name": "Geonames", "prefix": "geonames", "uri": "http://www.geonames.org/ontology#"},
-		        {"name": "DBPedia property", "prefix": "dbp", "uri": "http://dbpedia.org/property/"},
-		        {"name": "Open Provenance Model Vocabulary", "prefix": "opmv", "uri": "http://purl.org./net/opmv/ns#"},
-        	        {"name": "Functional Requirements for Bibliographic Records", "prefix": "frbr", "uri": "http://purl.org/vocab/frbr/core#"}
-
-		],
-		"defaultEndpointParameters": {
-			"queryParameters": {
-				"format": "output",
-				"query": "query"
-			},
-			"selectFormats": [
-				//{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "SPARQL-XML", "format": "sparql", "type": "application/sparql-results+xml"},
-				{"name": "JSON", "format": "json", "type": "application/sparql-results+json"},
-                {"name": "HTML", "format": "html", "type": "text/html"}
-			],
-			"constructFormats": [
-				//{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "RDF/XML", "format": "rdfxml", "type": "application/rdf+xml"},
-				{"name": "Turtle", "format": "turtle", "type": "application/turtle"}
-			]
-		},
-		"endpoints": [	
-			{"name": "Local LMF", "uri": _SERVER_URL+"sparql/select"},
-			{"name": "LMF Showcase", "uri": "http://labs.newmedialab.at/RedBull/sparql/select", queries: [
-				{"name": "Sample Query 1", "description": "Return all media resources.", "query": sampleQuery1}
-			]}
-        ]
-	}
-	var flintEd = new FlintEditor("flint-test", "sparql/images", flintConfig);
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-openuplabs.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-openuplabs.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-openuplabs.js
deleted file mode 100644
index 4c771e8..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-openuplabs.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-$(document).ready(function() {
-	var sampleQuery1 = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\nPREFIX frbr: <http://purl.org/vocab/frbr/core#>\nPREFIX dct: <http://purl.org/dc/terms/>\n\nSELECT ?work ?date ?title WHERE {\n\t?work a frbr:Work .\n\t?work dct:title ?title .\n\t?work dct:created ?date .\n\tFILTER (?date >= '2010-10-15'^^xsd:date)\n}\nORDER BY desc(?date)\nLIMIT 100";
-	
-	var sampleQuery2 = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nCONSTRUCT {?s ?p ?o}\nWHERE {\n\tGRAPH <http://www.legislation.gov.uk/id/uksi/2010/2581>\n\t{?s ?p ?o}\n}";
-	
-	var sampleQuery3 = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\nPREFIX gzt: <http://www.gazettes-online.co.uk/ontology#>\n\nSELECT ?n WHERE {\n\t?n a gzt:Notice .\n\t?n gzt:hasPublicationDate ?d .\n\tFILTER (?d >= '2010-09-01'^^xsd:date)\n}\nORDER BY ?d\nLIMIT 100";
-	
-	var flintConfig = {
-		"interface": {
-			"toolbar": true,
-			"menu": true
-		},
-		"namespaces": [
-			{"name": "Friend of a friend", "prefix": "foaf", "uri": "http://xmlns.com/foaf/0.1/"},
-			{"name": "XML schema", "prefix": "xsd", "uri": "http://www.w3.org/2001/XMLSchema#"},
-			{"name": "SIOC", "prefix": "sioc", "uri": "http://rdfs.org/sioc/ns#"},
-			{"name": "Resource Description Framework", "prefix": "rdf", "uri": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
-			{"name": "Resource Description Framework schema", "prefix": "rdfs", "uri": "http://www.w3.org/2000/01/rdf-schema#"},
-			{"name": "Dublin Core", "prefix": "dc", "uri": "http://purl.org/dc/elements/1.1/"},
-			{"name": "Dublin Core terms", "prefix": "dct", "uri": "http://purl.org/dc/terms/"},
-			{"name": "Creative Commons", "prefix": "cc", "uri": "http://www.creativecommons.org/ns#"},
-			{"name": "Web Ontology Language", "prefix": "owl", "uri": "http://www.w3.org/2002/07/owl#"},
-			{"name": "Simple Knowledge Organisation System", "prefix": "skos", "uri": "http://www.w3.org/2004/02/skos/core#"},
-			{"name": "Geography", "prefix": "geo", "uri": "http://www.w3.org/2003/01/geo/wgs84_pos#"},
-			{"name": "Geonames", "prefix": "geonames", "uri": "http://www.geonames.org/ontology#"},
-   		        {"name": "DBPedia property", "prefix": "dbp", "uri": "http://dbpedia.org/property/"},
-		        {"name": "Open Provenance Model Vocabulary", "prefix": "opmv", "uri": "http://purl.org./net/opmv/ns#"},
-        	    {"name": "Functional Requirements for Bibliographic Records", "prefix": "frbr", "uri": "http://purl.org/vocab/frbr/core#"}
-
-		],
-		"defaultEndpointParameters": {
-			"queryParameters": {
-				"format": "output",
-				"query": "query"
-			},
-			"selectFormats": [
-				//{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "SPARQL-XML", "format": "sparql", "type": "application/sparql-results+xml"},
-				{"name": "JSON", "format": "json", "type": "application/sparql-results+json"}
-			],
-			"constructFormats": [
-				//{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "RDF/XML", "format": "rdfxml", "type": "application/rdf+xml"},
-				{"name": "Turtle", "format": "turtle", "type": "application/turtle"}
-			]
-		},
-		"endpoints": [	
-			{"name": "Local LMF", "uri": _SERVER_URL+"sparql/select"},
-            {"name": "Legislation",
-				"uri": "http://gov.tso.co.uk/legislation/sparql",
-				queries: [
-					{"name": "Sample Legislation Query 1", "description": "Select up to 100 pieces of legislation after a given date, with most recent first.", "query": sampleQuery1},
-					{"name": "Sample Legislation Query 2", "description": "The RDF description of each piece of legislation is stored in a separate named graph, so all of the RDF for the item can be retrieved with the following query.", "query": sampleQuery2}
-				]
-			},
-			{"name": "Gazettes", "uri": "http://gov.tso.co.uk/gazettes/sparql", queries: [
-				{"name": "Sample Gazettes Query 1", "description": "Select the first 100 notices after a given date.", "query": sampleQuery3}
-			]},
-			{"name": "Education", "uri": "http://gov.tso.co.uk/education/sparql"},
-			{"name": "Ordnance Survey", "uri": "http://os.services.tso.co.uk/geo/sparql"},
-			{"name": "Transport", "uri": "http://gov.tso.co.uk/transport/sparql"},
-			{"name": "COINS", "uri": "http://gov.tso.co.uk/coins/sparql"},
-			{"name": "Organograms", "uri": "http://reference.data.gov.uk/organograms/sparql"}
-		]
-	}
-	var flintEd = new FlintEditor("flint-test","/script/sparql/images", flintConfig);
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-sparqlservice.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-sparqlservice.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-sparqlservice.js
deleted file mode 100644
index d31c413..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/init-sparqlservice.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-$(document).ready(function(){
-		
-	var endpoint = document.URL;	
-	
-	addStylesheet("http://openuplabs.tso.co.uk/script/sparql/lib/codemirror.css");		
-	addStylesheet("http://openuplabs.tso.co.uk/script/sparql/css/sparqlcolors.css");
-	addStylesheet("http://openuplabs.tso.co.uk/script/sparql/css/docs.css");
-	jQuery.getScript("http://openuplabs.tso.co.uk/script/sparql/lib/codemirror.js", function() {
-		jQuery.getScript("http://openuplabs.tso.co.uk/script/sparql/sparqlmode_ll1.js", function () {
-			jQuery.getScript("http://openuplabs.tso.co.uk/script/sparql/flint-editor.js", function () {
-				init(endpoint);
-			});
-		});
-	});
-	
-});
-
-function init(endpoint) {
-	
-	var flintConfig = {
-		"interface": {
-			"toolbar": true,
-			"menu": true
-		},
-		"namespaces": [
-			{"name": "Friend of a friend", "prefix": "foaf", "uri": "http://xmlns.com/foaf/0.1/"},
-			{"name": "XML schema", "prefix": "xsd", "uri": "http://www.w3.org/2001/XMLSchema#"},
-			{"name": "SIOC", "prefix": "sioc", "uri": "http://rdfs.org/sioc/ns#"},
-			{"name": "Resource Description Framework", "prefix": "rdf", "uri": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
-			{"name": "Resource Description Framework schema", "prefix": "rdfs", "uri": "http://www.w3.org/2000/01/rdf-schema#"},
-			{"name": "Dublin Core", "prefix": "dc", "uri": "http://purl.org/dc/elements/1.1/"},
-			{"name": "Dublin Core terms", "prefix": "dct", "uri": "http://purl.org/dc/terms/"},
-			{"name": "Creative Commons", "prefix": "cc", "uri": "http://www.creativecommons.org/ns#"},
-			{"name": "Web Ontology Language", "prefix": "owl", "uri": "http://www.w3.org/2002/07/owl#"},
-			{"name": "Simple Knowledge Organisation System", "prefix": "skos", "uri": "http://www.w3.org/2004/02/skos/core#"},
-			{"name": "Geography", "prefix": "geo", "uri": "http://www.w3.org/2003/01/geo/wgs84_pos#"},
-			{"name": "Geonames", "prefix": "geonames", "uri": "http://www.geonames.org/ontology#"},
-   		        {"name": "DBPedia property", "prefix": "dbp", "uri": "http://dbpedia.org/property/"},
-		        {"name": "Open Provenance Model Vocabulary", "prefix": "opmv", "uri": "http://purl.org./net/opmv/ns#"},
-        	    {"name": "Functional Requirements for Bibliographic Records", "prefix": "frbr", "uri": "http://purl.org/vocab/frbr/core#"}
-
-		],
-		"defaultEndpointParameters": {
-			"queryParameters": {
-				"format": "output",
-				"query": "query"
-			},
-			"selectFormats": [
-				{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "SPARQL-XML", "format": "sparql", "type": "application/sparql-results+xml"},
-				{"name": "JSON", "format": "json", "type": "application/sparql-results+json"}
-			],
-			"constructFormats": [
-				{"name": "Plain text", "format": "text", "type": "text/plain"},
-				{"name": "RDF/XML", "format": "rdfxml", "type": "application/rdf+xml"},
-				{"name": "Turtle", "format": "turtle", "type": "application/turtle"}
-			],			
-		},
-		"endpoints": [	
-			{"name": document.title,
-				"uri": endpoint,				
-			}
-		]
-	}
-	
-	// add Flint button
-	$('#description').after('<a href="" id="flint-button">Query endpoint with Flint SPARQL Editor</a>');	
-	
-	$('#flint-button').click(function(e) {
-		e.preventDefault();
-		$('#flint-button').after('<div style="display:none; width: 950px" id="flint-test"></div>');
-		$('#flint-button').remove();
-		var flintEd = new FlintEditor("flint-test","http://openuplabs.tso.co.uk/script/sparql/images", flintConfig);
-		$('#flint-test').show();
-	});
-	
-}
-
-function addStylesheet(url) {
-	var css = document.createElement( 'link' );
-	css.href = url;
-	css.rel= "stylesheet";
-	$('head').append( css );
-}
\ No newline at end of file


[40/41] git commit: - contributed JAX-RS error handling from our own project to Marmotta

Posted by ss...@apache.org.
- contributed JAX-RS error handling from our own project to Marmotta


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/75e6832e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/75e6832e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/75e6832e

Branch: refs/heads/develop
Commit: 75e6832e35b3c650fbb5f1956e8929b18659e63c
Parents: 00f64a0
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Jul 9 11:46:21 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Jul 9 11:46:21 2013 +0200

----------------------------------------------------------------------
 .../core/api/jaxrs/ExceptionMapperService.java  |  28 +++++
 .../platform/core/jaxrs/CDIExceptionMapper.java |  11 ++
 .../platform/core/jaxrs/ErrorResponse.java      | 116 +++++++++++++++++++
 .../core/jaxrs/IllegalStateExceptionMapper.java |  30 +++++
 .../core/jaxrs/MarmottaExceptionMapper.java     |  34 ++++++
 .../jaxrs/MarmottaImportExceptionMapper.java    |  32 +++++
 .../core/jaxrs/RepositoryExceptionMapper.java   |  33 ++++++
 .../core/jaxrs/URISyntaxExceptionMapper.java    |  29 +++++
 .../UnsupportedOperationExceptionMapper.java    |  30 +++++
 .../jaxrs/ExceptionMapperServiceImpl.java       |  52 +++++++++
 10 files changed, 395 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/jaxrs/ExceptionMapperService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/jaxrs/ExceptionMapperService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/jaxrs/ExceptionMapperService.java
new file mode 100644
index 0000000..d5a9cf4
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/jaxrs/ExceptionMapperService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.platform.core.api.jaxrs;
+
+/**
+ * This service auto-registers JAX-RS exception mappers implementing the CDIExceptionMapper interface and
+ * registers them with RESTEasy. This allows applications based on Marmotta to easily implement and register their
+ * own ExceptionMapppers without needing to go into RESTEasy.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface ExceptionMapperService {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
new file mode 100644
index 0000000..7d7bf4f
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/CDIExceptionMapper.java
@@ -0,0 +1,11 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import javax.ws.rs.ext.ExceptionMapper;
+
+/**
+ * A marker-interface to allow CDI injection of ExceptionMappers implementing this interface by the ExceptionMapperService.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface CDIExceptionMapper<E extends Throwable> extends ExceptionMapper<E> {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/ErrorResponse.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/ErrorResponse.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/ErrorResponse.java
new file mode 100644
index 0000000..e2490d0
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/ErrorResponse.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.platform.core.jaxrs;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * Represents a uniform error response for REST service requests.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@XmlRootElement(name = "Error")
+public class ErrorResponse {
+
+    private int code;
+
+    private String message;
+
+    private String stackTrace;
+
+    public ErrorResponse() {
+    }
+
+    public ErrorResponse(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public ErrorResponse(int code, String message, String stackTrace) {
+        this.code = code;
+        this.message = message;
+        this.stackTrace = stackTrace;
+    }
+
+    public ErrorResponse(int code, Exception ex) {
+        this.code = code;
+        this.message = ex.getMessage();
+
+        StringWriter writer = new StringWriter();
+        ex.printStackTrace(new PrintWriter(writer));
+
+        this.stackTrace = writer.toString();
+    }
+
+
+    @XmlElement(name = "code", required = true)
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    @XmlElement(name = "message", required = true)
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    @XmlElement(name = "stackTrace", required = false)
+    public String getStackTrace() {
+        return stackTrace;
+    }
+
+    public void setStackTrace(String stackTrace) {
+        this.stackTrace = stackTrace;
+    }
+
+    public static Response errorResponse(Response.Status status, String message) {
+        ErrorResponse entity = new ErrorResponse(status.getStatusCode(), message);
+        return Response.status(status).entity(entity).build();
+    }
+
+    public static Response errorResponse(Response.Status status, Exception ex) {
+        ErrorResponse entity = new ErrorResponse(status.getStatusCode(), ex);
+        return Response.status(status).entity(entity).build();
+    }
+
+    public String toString() {
+        StringBuffer b = new StringBuffer();
+        b.append("Code: ");
+        b.append(code);
+        b.append(System.getProperty("line.separator"));
+        b.append("Message: ");
+        b.append(message);
+        if(stackTrace != null) {
+            b.append(System.getProperty("line.separator"));
+            b.append("StackTrace: ");
+            b.append(stackTrace);
+        }
+        return b.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
new file mode 100644
index 0000000..983d07e
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/IllegalStateExceptionMapper.java
@@ -0,0 +1,30 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Map MarmottaExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+@ApplicationScoped
+public class IllegalStateExceptionMapper implements CDIExceptionMapper<IllegalStateException> {
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(IllegalStateException exception) {
+        return ErrorResponse.errorResponse(Response.Status.SERVICE_UNAVAILABLE, exception.getMessage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
new file mode 100644
index 0000000..1dadc6e
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaExceptionMapper.java
@@ -0,0 +1,34 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.exception.MarmottaException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Map MarmottaExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+@ApplicationScoped
+public class MarmottaExceptionMapper implements CDIExceptionMapper<MarmottaException> {
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(MarmottaException exception) {
+        return ErrorResponse.errorResponse(Response.Status.INTERNAL_SERVER_ERROR, exception);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
new file mode 100644
index 0000000..2bda331
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
@@ -0,0 +1,32 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Map MarmottaExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+@ApplicationScoped
+public class MarmottaImportExceptionMapper implements CDIExceptionMapper<MarmottaImportException> {
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(MarmottaImportException exception) {
+        return ErrorResponse.errorResponse(Response.Status.INTERNAL_SERVER_ERROR, exception);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
new file mode 100644
index 0000000..80dfd71
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/RepositoryExceptionMapper.java
@@ -0,0 +1,33 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import org.openrdf.repository.RepositoryException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Map RepositoryExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+@ApplicationScoped
+public class RepositoryExceptionMapper implements CDIExceptionMapper<RepositoryException> {
+
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(RepositoryException exception) {
+        return ErrorResponse.errorResponse(Response.Status.INTERNAL_SERVER_ERROR, exception);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
new file mode 100644
index 0000000..858ccaa
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/URISyntaxExceptionMapper.java
@@ -0,0 +1,29 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import java.net.URISyntaxException;
+
+/**
+ * Map MarmottaExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+public class URISyntaxExceptionMapper implements CDIExceptionMapper<URISyntaxException> {
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(URISyntaxException exception) {
+        return ErrorResponse.errorResponse(Response.Status.INTERNAL_SERVER_ERROR, exception);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
new file mode 100644
index 0000000..e62e5b5
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/UnsupportedOperationExceptionMapper.java
@@ -0,0 +1,30 @@
+package org.apache.marmotta.platform.core.jaxrs;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Map MarmottaExceptions to a internal server error and return the default error object
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@Provider
+@ApplicationScoped
+public class UnsupportedOperationExceptionMapper implements CDIExceptionMapper<UnsupportedOperationException> {
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(UnsupportedOperationException exception) {
+        return ErrorResponse.errorResponse(Response.Status.fromStatusCode(501), exception.getMessage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75e6832e/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/jaxrs/ExceptionMapperServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/jaxrs/ExceptionMapperServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/jaxrs/ExceptionMapperServiceImpl.java
new file mode 100644
index 0000000..88c3bf2
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/jaxrs/ExceptionMapperServiceImpl.java
@@ -0,0 +1,52 @@
+package org.apache.marmotta.platform.core.services.jaxrs;
+
+import org.apache.marmotta.platform.core.api.content.ContentReader;
+import org.apache.marmotta.platform.core.api.jaxrs.ExceptionMapperService;
+import org.apache.marmotta.platform.core.events.ConfigurationServiceInitEvent;
+import org.apache.marmotta.platform.core.jaxrs.CDIExceptionMapper;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.slf4j.Logger;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+@ApplicationScoped
+public class ExceptionMapperServiceImpl implements ExceptionMapperService {
+
+    @Inject
+    private Logger log;
+
+    @Inject
+    private Instance<CDIExceptionMapper> mappers;
+
+    /**
+     * Register Exception Mappers
+     */
+    @PostConstruct
+    public void initialise() {
+        log.info("initialising JAX-RS exception mappers");
+
+        ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+
+        for(CDIExceptionMapper mapper : mappers) {
+            log.debug("registering exception mapper: {}", mapper.getClass().getName());
+
+            factory.registerProviderInstance(mapper);
+        }
+    }
+
+    // trigger startup once configuration service is finished with initialisation
+    public void initEvent(@Observes ConfigurationServiceInitEvent e) {
+
+    }
+
+
+}


[23/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/js/lib/sgvizler.pack.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/js/lib/sgvizler.pack.js b/platform/marmotta-core/src/main/resources/web/admin/js/lib/sgvizler.pack.js
deleted file mode 100644
index b847cc2..0000000
--- a/platform/marmotta-core/src/main/resources/web/admin/js/lib/sgvizler.pack.js
+++ /dev/null
@@ -1,1294 +0,0 @@
-/*  Sgvizler JavaScript SPARQL result set visualizer, version 0.5.1
- *  (c) 2011--2012 Martin G. Skjæveland
- *
- *  Sgvizler is freely distributable under the terms of an MIT-style license.
- *  Sgvizler web site: https://code.google.com/p/sgvizler/
- *--------------------------------------------------------------------------*/
-(function (global) {
-    "use strict";
-
-    /*global google, $, jQuery */
-    /*jslint browser: true */
-
-    var sgvizler = {
-
-        go: function (callback) {
-            this.loadLibs();
-
-            google.load('visualization',
-                        '1.0',
-                        {'packages':
-                         ['annotatedtimeline',
-                          'corechart',
-                          'gauge',
-                          'geomap',
-                          'geochart',
-                          'imagesparkline',
-                          'map',
-                          'orgchart',
-                          'table',
-                          'motionchart',
-                          'treemap'
-                         ]
-                        }
-                       );
-
-            google.setOnLoadCallback(function () {
-                sgvizler.charts.loadCharts();
-                sgvizler.drawFormQuery();
-                sgvizler.drawContainerQueries();
-                callback();
-            });
-        },
-
-        loadLibs: function () {
-            var i, libs = ['d3.v2.min.js', 'raphael-dracula.pack.min.js'];
-            if (sgvizler.ui.isElement(sgvizler.ui.id.script)) {
-                this.option.homefolder = $('#' + sgvizler.ui.id.script).attr('src').replace(/sgvizler\.pack\.js$/, "");
-                this.option.libfolder = this.option.homefolder + "/js/lib/";
-            }
-            // load "child" scripts
-            for (i = 0; i < libs.length; i += 1) {
-                $.ajax(this.option.libfolder + libs[i], { dataType: "script", async: false });
-            }
-
-            // load stylesheet
-            $('head').append('<link rel="stylesheet" href="'+this.option.stylepath+'sgvizler.chart.css" type="text/css" />');
-        },
-
-        drawFormQuery: function () {
-            var query = new sgvizler.query(sgvizler.ui.id.chartCon),
-                params = sgvizler.ui.getUrlParams();
-            $.extend(query,
-                     sgvizler.option.query,
-                     { query: params.query, chart: params.chart });
-
-            if (sgvizler.ui.isElement(query.container) && query.query) {
-                $.extend(query.chartOptions,
-                         { width: params.width, height: params.height });
-                query.draw();
-            }
-            sgvizler.ui.displayUI(query);
-        },
-
-        drawContainerQueries: function () {
-            $('[' + this.ui.attr.prefix + 'query]').each(function () {
-                var query = new sgvizler.query();
-                $.extend(query,
-                         sgvizler.option.query,
-                         sgvizler.ui.getQueryOptionAttr(this));
-                $.extend(query.chartOptions,
-                         sgvizler.ui.getChartOptionAttr(this));
-                query.draw();
-            });
-        },
-
-        // kept in separate files:
-        option: {},   // settings, global variables.
-        chart: {},    // the set of user-defined rendering functions.
-        charts: {},   // functions for handling rendering functions.
-        parser: {},   // SPARQL results XML/JSON parser.
-        ui: {}       // html get/set functions.
-    };
-
-    jQuery.ajaxSetup({
-        accepts: {
-            xml:  "application/sparql-results+xml",
-            json: "application/sparql-results+json"
-        }
-    });
-    sgvizler.option = {
-
-        home: (window.location.href).replace(window.location.search, ""),
-        homefolder: "",
-        libfolder: "/lib/",
-
-        stylepath:"",
-
-        //// Prefixes included in queries:
-        namespace: {
-            'rdf' : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
-            'rdfs': "http://www.w3.org/2000/01/rdf-schema#",
-            'owl' : "http://www.w3.org/2002/07/owl#",
-            'xsd' : "http://www.w3.org/2001/XMLSchema#"
-        },
-
-        query: {}, // holds options set by user in html file.
-        chart: {}  // ditto.
-    };
-    sgvizler.ui = {
-
-        //// #id's to html elements:
-        id: {
-            script:       'sgvzlr_script',    // #id to the script tag for this file
-            chartCon:     'sgvzlr_gchart',    // #id to the container to hold the chart
-            queryForm:    'sgvzlr_formQuery', //
-            queryTxt:     'sgvzlr_cQuery',    // query text area.
-            formQuery:    'sgvzlr_strQuery',  // hidden query string. "trick" taken from snorql.
-            formWidth:    'sgvzlr_strWidth',  //
-            formHeight:   'sgvzlr_strHeight', //
-            formChart:    'sgvzlr_optChart',  //
-            prefixCon:    'sgvzlr_cPrefix',   // print prefixes
-            messageCon:   'sgvzlr_cMessage'  // print messages
-        },
-
-        attr: {
-            prefix:      'data-sgvizler-',
-            prefixChart: 'data-sgvizler-chart-options',
-
-            valueAssign: '=',
-            valueSplit:  '|'
-        },
-
-        params: [ 'query', 'chart', 'width', 'height' ], // permissible URL parameters.
-
-        displayUI: function (queryOpt) {
-            this.displayPrefixes();
-            this.displayChartTypesMenu();
-            this.displayUserInput(queryOpt);
-        },
-        displayPrefixes: function () {
-            this.setElementText(this.id.prefixCon, sgvizler.query.prototype.getPrefixes());
-        },
-        displayUserInput: function (queryOpt) {
-            this.setElementValue(this.id.queryTxt, queryOpt.query);
-            this.setElementValue(this.id.formChart, queryOpt.chart);
-            this.setElementValue(this.id.formWidth, queryOpt.chartOptions.width);
-            this.setElementValue(this.id.formHeight, queryOpt.chartOptions.height);
-        },
-        displayChartTypesMenu: function () {
-            var chart,
-                i;
-            if (this.isElement(this.id.formChart)) {
-                chart = sgvizler.charts.all;
-                for (i = 0; i < chart.length; i += 1) {
-                    $('#' + this.id.formChart)
-                        .append($('<option/>')
-                                .val(chart[i].id)
-                                .html(chart[i].id));
-                }
-            }
-        },
-
-        displayFeedback: function (queryOpt, messageName) {
-            var message,
-                container = queryOpt.container;
-            if (queryOpt.container === this.id.chartCon && this.isElement(this.id.messageCon)) {
-                container = this.id.messageCon;
-            }
-
-            if (queryOpt.loglevel === 0) {
-                message = "";
-            } else if (queryOpt.loglevel === 1) {
-                if (messageName === "LOADING") {
-                    message = "Loading...";
-                } else if (messageName === "ERROR_ENDPOINT" || messageName === "ERROR_UNKNOWN") {
-                    message = "Error.";
-                }
-            } else {
-                if (messageName === "LOADING") {
-                    message = "Sending query...";
-                } else if (messageName === "ERROR_ENDPOINT") {
-                    message = "Error querying endpoint. Possible errors:" +
-                        this.html.ul(
-                            this.html.a(queryOpt.endpoint, "SPARQL endpoint") + " down? " +
-                                this.html.a(queryOpt.endpoint + queryOpt.endpoint_query_url + queryOpt.encodedQuery,
-                                            "Check if query runs at the endpoint") + ".",
-                            "Malformed SPARQL query? " +
-                                this.html.a(queryOpt.validator_query_url + queryOpt.encodedQuery, "Check if it validates") + ".",
-                            "CORS supported and enabled? Read more about " +
-                                this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility", "CORS and compatibility") + ".",
-                            "Is your " + this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility", "browser support") + "ed?",
-                            "Hmm.. it might be a bug! Please file a report to " +
-                                this.html.a("http://code.google.com/p/sgvizler/issues/", "the issues") + "."
-                        );
-                } else if (messageName === "ERROR_UNKNOWN") {
-                    message = "Unknown error.";
-                } else if (messageName === "NO_RESULTS") {
-                    message = "Query returned no results.";
-                } else if (messageName === "DRAWING") {
-                    message = "Received " + queryOpt.noRows + " rows. Drawing chart...<br/>" +
-                        this.html.a(queryOpt.endpoint + queryOpt.endpoint_query_url + queryOpt.encodedQuery,
-                                    "View query results", "target='_blank'") + " (in new window).";
-                }
-            }
-            this.setElementHTML(container, this.html.tag("p", message));
-        },
-
-        setElementValue: function (elementID, value) {
-            if (this.isElement(elementID)) {
-                $('#' + elementID).val(value);
-            }
-        },
-        setElementText: function (elementID, value) {
-            if (this.isElement(elementID)) {
-                $('#' + elementID).text(value);
-            }
-        },
-        setElementHTML: function (elementID, value) {
-            if (this.isElement(elementID)) {
-                $('#' + elementID).html(value);
-            }
-        },
-        isElement: function (elementID) {
-            return $('#' + elementID).length > 0;
-        },
-
-        getQueryOptionAttr: function (element) {
-            var i,
-                queryOpt = {container: $(element).attr('id')},
-                attr = element.attributes;
-            for (i = 0; i < attr.length; i += 1) {
-                if (attr[i].name.lastIndexOf(this.attr.prefix, 0) === 0) { // starts-with attr.prefix.
-                    queryOpt[attr[i].name.substring(this.attr.prefix.length)] = attr[i].value;
-                }
-            }
-            return queryOpt;
-        },
-        getChartOptionAttr: function (element) {
-            var i,
-                options,
-                assignment,
-                path,
-                o,
-                j,
-                chartOpt = {},
-                attrValue = $(element).attr(sgvizler.ui.attr.prefixChart);
-            if (typeof attrValue !== 'undefined') {
-                options = attrValue.split(this.attr.valueSplit);
-                for (i = 0; i < options.length; i += 1) {
-                    assignment = options[i].split(this.attr.valueAssign);
-                    path = assignment[0].split(".");
-                    o = chartOpt;
-                    for (j = 0; j < path.length - 1; j += 1) {
-                        if (typeof o[path[j]] === 'undefined') {
-                            o[path[j]] = {};
-                        }
-                        o = o[path[j]];
-                    }
-                    o[path[j]] = assignment[1];
-                }
-            }
-            // get width and heigth from css. take only numbers.
-            chartOpt.width = /(\d+)/.exec($(element).css('width'))[1];
-            chartOpt.height = /(\d+)/.exec($(element).css('height'))[1];
-            return chartOpt;
-        },
-
-        getUrlParams: function () {
-            /*jslint regexp: true */
-            var urlParams = {},
-                e,
-                r = /([^&=]+)=?([^&]*)/g, // parameter, value pairs.
-                d = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); }, // replace '+' with space.
-                q = window.location.search.substring(1); // URL query string part.
-
-            while ((e = r.exec(q))) {
-                if (e[2].length > 0 && this.params.indexOf(e[1]) !== -1) {
-                    urlParams[d(e[1])] = d(e[2]);
-                }
-            }
-            return urlParams;
-        },
-
-        resetPage: function () {
-            document.location = sgvizler.home;
-        },
-        submitQuery: function () {
-            $('#' + this.id.formQuery).val($('#' + this.id.queryTxt).val());
-            $('#' + this.id.queryForm).submit();
-        },
-
-        html: {
-            a: function (href, link, attr) {
-                if (typeof attr === 'undefined') { attr = ""; }
-                if (typeof href !== 'undefined' && typeof link !== 'undefined') {
-                    return "<a " + attr + " href='" + href + "'>" + link + "</a>";
-                }
-            },
-            ul: function () {
-                var i,
-                    txt;
-                if (arguments.length) {
-                    txt = "<ul>";
-                    for (i = 0; i < arguments.length; i += 1) {
-                        txt += "<li>" + arguments[i] + "</li>";
-                    }
-                    return txt + "</ul>";
-                }
-            },
-            tag: function (tag, content) {
-                return "<" + tag + ">" + content + "</" + tag + ">";
-            }
-        }
-    };
-
-    sgvizler.parser = {
-
-        // variable notation: xtable, xcol(s), xrow(s) -- x is 's'(parql) or 'g'(oogle).
-
-        defaultGDatatype: 'string',
-
-        countRowsSparqlXML: function (sxml) {
-            return $(sxml).find('sparql').find('results').find('result').length;
-        },
-
-        countRowsSparqlJSON: function (stable) {
-            if (typeof stable.results.bindings !== 'undefined') {
-                return stable.results.bindings.length;
-            }
-        },
-
-        SparqlXML2GoogleJSON: function (sxml) {
-            var c,
-                r,
-                gcols = [],
-                grows = [],
-                gdatatype = [], // for easy reference of datatypes
-                sresults = $(sxml).find('sparql').find('results').find('result');
-
-            // gcols
-            c = 0;
-            $(sxml).find('sparql').find('head').find('variable').each(function () {
-                var stype = null,
-                    sdatatype = null,
-                    name = $(this).attr('name'),
-                    scell = null,
-                    scells = $(sresults).find('binding[name="' + name + '"]');
-                if (scells.length) {
-                    scell = $(scells).first().children().first()[0]; // uri, literal element
-                    stype = scell.nodeName;
-                    sdatatype = $(scell).attr('datatype');
-                }
-                gdatatype[c] = sgvizler.parser.getGoogleJsonDatatype(stype, sdatatype);
-                gcols[c] = {'id': name, 'label': name, 'type': gdatatype[c]};
-                c += 1;
-            });
-
-            // grows
-            r = 0;
-            $(sresults).each(function () {
-                var gvalue,
-                    scells,
-                    scell,
-                    stype,
-                    svalue,
-                    grow = [];
-                for (c = 0; c < gcols.length; c += 1) {
-                    gvalue = null;
-                    scells = $(this).find('binding[name="' + gcols[c].id + '"]');
-                    if (scells.length &&
-                            typeof $(scells).first().children().first() !== 'undefined' &&
-                            $(scells).first().children().first().firstChild !== null) {
-                        scell = $(scells).first().children().first()[0]; // uri, literal element
-                        stype = scell.nodeName;
-                        svalue = $(scell).first().text();
-                        gvalue = sgvizler.parser.getGoogleJsonValue(svalue, gdatatype[c], stype);
-                    }
-                    grow[c] = {'v': gvalue};
-                }
-                grows[r] = {'c': grow};
-                r += 1;
-            });
-            return {'cols': gcols, 'rows': grows};
-        },
-
-        SparqlJSON2GoogleJSON: function (stable) {
-            var c,
-                r,
-                srow,
-                grow,
-                gvalue,
-                stype,
-                sdatatype,
-                gcols = [],
-                grows = [],
-                gdatatype = [], // for easy reference of datatypes
-                scols = stable.head.vars,
-                srows = stable.results.bindings;
-
-            for (c = 0; c < scols.length; c += 1) {
-                r = 0;
-                stype = null;
-                sdatatype = null;
-                // find a row where there is a value for this column
-                while (typeof srows[r][scols[c]] === 'undefined' && r + 1 < srows.length) { r += 1; }
-                if (typeof srows[r][scols[c]] !== 'undefined') {
-                    stype = srows[r][scols[c]].type;
-                    sdatatype = srows[r][scols[c]].datatype;
-                }
-                gdatatype[c] = this.getGoogleJsonDatatype(stype, sdatatype);
-                gcols[c] = {'id': scols[c], 'label': scols[c], 'type': gdatatype[c]};
-            }
-
-            // loop rows
-            for (r = 0; r < srows.length; r += 1) {
-                srow = srows[r];
-                grow = [];
-                // loop cells
-                for (c = 0; c < scols.length; c += 1) {
-                    gvalue = null;
-                    if (typeof srow[scols[c]] !== 'undefined' &&
-                            typeof srow[scols[c]].value !== 'undefined') {
-                        gvalue = this.getGoogleJsonValue(srow[scols[c]].value, gdatatype[c], srow[scols[c]].type);
-                    }
-                    grow[c] = { 'v': gvalue };
-                }
-                grows[r] = {'c': grow};
-            }
-            return {'cols': gcols, 'rows': grows};
-        },
-
-        getGoogleJsonValue: function (value, gdatatype, stype) {
-            var newvalue;
-            if (gdatatype === 'number') {
-                newvalue = Number(value);
-            } else if (gdatatype === 'date') {
-                //assume format yyyy-MM-dd
-                newvalue = new Date(value.substr(0, 4),
-                                value.substr(5, 2),
-                                value.substr(8, 2));
-            } else if (gdatatype === 'datetime') {
-                //assume format yyyy-MM-ddZHH:mm:ss
-                newvalue = new Date(value.substr(0, 4),
-                                value.substr(5, 2),
-                                value.substr(8, 2),
-                                value.substr(11, 2),
-                                value.substr(14, 2),
-                                value.substr(17, 2));
-            } else if (gdatatype === 'timeofday') {
-                //assume format HH:mm:ss
-                newvalue = [value.substr(0, 2),
-                        value.substr(3, 2),
-                        value.substr(6, 2)];
-            } else { // datatype === 'string' || datatype === 'boolean'
-                if (stype === 'uri') { // replace namespace with prefix
-                    newvalue = this.prefixify(value);
-                }
-                newvalue = value;
-            }
-            return newvalue;
-        },
-
-        getGoogleJsonDatatype: function (stype, sdatatype) {
-            var gdatatype = this.defaultGDatatype,
-                xsdns = sgvizler.option.namespace.xsd;
-            if (typeof stype !== 'undefined' && (stype === 'typed-literal' || stype === 'literal')) {
-                if (sdatatype === xsdns + "float"   ||
-                        sdatatype === xsdns + "double"  ||
-                        sdatatype === xsdns + "decimal" ||
-                        sdatatype === xsdns + "int"     ||
-                        sdatatype === xsdns + "long"    ||
-                        sdatatype === xsdns + "integer") {
-                    gdatatype =  'number';
-                } else if (sdatatype === xsdns + "boolean") {
-                    gdatatype =  'boolean';
-                } else if (sdatatype === xsdns + "date") {
-                    gdatatype =  'date';
-                } else if (sdatatype === xsdns + "dateTime") {
-                    gdatatype =  'datetime';
-                } else if (sdatatype === xsdns + "time") {
-                    gdatatype =  'timeofday';
-                }
-            }
-            return gdatatype;
-        },
-
-        prefixify: function (url) {
-            var ns;
-            for (ns in sgvizler.option.namespace) {
-                if (sgvizler.option.namespace.hasOwnProperty(ns) &&
-                        url.lastIndexOf(sgvizler.option.namespace[ns], 0) === 0) {
-                    return url.replace(sgvizler.option.namespace[ns], ns + ":");
-                }
-            }
-            return url;
-        },
-        unprefixify: function (qname) {
-            var ns;
-            for (ns in sgvizler.option.namespace) {
-                if (sgvizler.option.namespace.hasOwnProperty(ns) &&
-                        qname.lastIndexOf(ns + ":", 0) === 0) {
-                    return qname.replace(ns + ":", sgvizler.option.namespace[ns]);
-                }
-            }
-            return qname;
-        }
-    };
-
-
-    /*global XDomainRequest */
-
-    sgvizler.query = function (container) {
-        this.container = container;
-
-        //defaults
-        this.query = "SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?instance a ?class }\nGROUP BY ?class\nORDER BY ?class";
-        this.endpoint = "http://sws.ifi.uio.no/sparql/world";
-        this.endpoint_output = 'json';  // xml, json, jsonp
-        this.endpoint_query_url = "?output=text&amp;query=";
-        this.validator_query_url = "http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=";
-        this.chart = 'gLineChart';
-        this.loglevel = 2;
-
-        this.chartOptions = {
-            'width':           '800',
-            'height':          '400',
-            'chartArea':       { left: '5%', top: '5%', width: '75%', height: '80%' },
-            'gGeoMap': {
-                'dataMode':           'markers'
-            },
-            'gMap': {
-                'dataMode':           'markers'
-            },
-            'sMap': {
-                'dataMode':           'markers',
-                'showTip':            true,
-                'useMapTypeControl':  true
-            },
-            'gSparkline': {
-                'showAxisLines':      false
-            }
-        };
-    };
-
-    sgvizler.query.prototype.draw = function (listeners,options,callback) {
-        var that = this,
-            chartFunc = sgvizler.charts.getChart(this.container, this.chart);
-        this.setChartSpecificOptions();
-        this.insertFrom();
-        $.extend(this.chartOptions,options);
-        this.runQuery(function (data) {
-            var dataTable = new google.visualization.DataTable(that.processQueryResults(data));
-            for(var listener in listeners) {
-                google.visualization.events.addListener(chartFunc, listener, function(){
-                    listeners[listener](chartFunc,dataTable);
-                });
-            }
-            chartFunc.draw(dataTable,that.chartOptions);
-            if(callback)callback(dataTable);
-        });
-    };
-
-    sgvizler.query.prototype.runQuery = function (callback) {
-        var xdr,
-            url,
-            endpoint_output = this.endpoint_output;
-        sgvizler.ui.displayFeedback(this, "LOADING");
-        this.encodedQuery = encodeURIComponent(this.getPrefixes() + this.query);
-        if (this.endpoint_output !== 'jsonp' && $.browser.msie && window.XDomainRequest) {
-            xdr = new XDomainRequest();
-            url = this.endpoint +
-                "?query=" + this.encodedQuery +
-                "&output=" + this.endpoint_output;
-            xdr.open("GET", url);
-            xdr.onload = function () {
-                var data;
-                if (endpoint_output === "xml") {
-                    data = $.parseXML(xdr.responseText);
-                } else {
-                    data = $.parseJSON(xdr.responseText);
-                }
-                callback(data);
-            };
-            xdr.send();
-        } else {
-            $.get(this.endpoint,
-                  { query: this.getPrefixes() + this.query,
-                    output: (this.endpoint_output === 'jsonp') ? 'json' : this.endpoint_output },
-                  function (data) { callback(data); },
-                  this.endpoint_output)
-                .error(function () {
-                    sgvizler.ui.displayFeedback(this, "ERROR_ENDPOINT");
-                });
-        }
-    };
-
-    sgvizler.query.prototype.processQueryResults = function (data) {
-        this.setResultRowCount(data);
-        if (this.noRows === null) {
-            sgvizler.ui.displayFeedback(this, "ERROR_UNKNOWN");
-        } else if (this.noRows === 0) {
-            sgvizler.ui.displayFeedback(this, "NO_RESULTS");
-        } else {
-            sgvizler.ui.displayFeedback(this, "DRAWING");
-            return this.getGoogleJSON(data);
-        }
-    };
-
-    sgvizler.query.prototype.setResultRowCount = function (data) {
-        if (this.endpoint_output === 'xml') {
-            this.noRows = sgvizler.parser.countRowsSparqlXML(data);
-        } else {
-            this.noRows = sgvizler.parser.countRowsSparqlJSON(data);
-        }
-    };
-
-    sgvizler.query.prototype.getGoogleJSON = function (data) {
-        if (this.endpoint_output === 'xml') {
-            data = sgvizler.parser.SparqlXML2GoogleJSON(data);
-        } else {
-            data = sgvizler.parser.SparqlJSON2GoogleJSON(data);
-        }
-        return data;
-    };
-
-    sgvizler.query.prototype.insertFrom = function () {
-        if (typeof this.rdf !== 'undefined') {
-            var i,
-                froms = this.rdf.split(sgvizler.ui.attr.valueSplit),
-                from = "";
-            for (i = 0; i < froms.length; i += 1) {
-                from += 'FROM <' + froms[i] + '>\n';
-            }
-            this.query = this.query.replace(/(WHERE)?(\s)*\{/, '\n' + from + 'WHERE {');
-        }
-    };
-
-    sgvizler.query.prototype.getPrefixes = function () {
-        var prefix,
-            prefixes = "";
-        for (prefix in sgvizler.option.namespace) {
-            if (sgvizler.option.namespace.hasOwnProperty(prefix)) {
-                prefixes += "PREFIX " + prefix + ": <" + sgvizler.option.namespace[prefix] + ">\n";
-            }
-        }
-        return prefixes;
-    };
-
-    sgvizler.query.prototype.setChartSpecificOptions = function () {
-        var level1,
-            level2;
-        for (level1 in this.chartOptions) {
-            if (this.chartOptions.hasOwnProperty(level1) &&
-                    level1 === this.chart) {
-                for (level2 in this.chartOptions[level1]) {
-                    if (this.chartOptions[level1].hasOwnProperty(level2)) {
-                        this.chartOptions[level2] = this.chartOptions[level1][level2];
-                    }
-                }
-            }
-        }
-    };
-
-    sgvizler.charts = {
-        // Package for handling rendering functions. The rendering
-        // functions themselves are kept in sgvizler.chart.*
-
-        all: [],
-
-        loadCharts: function () {
-            var googlecharts = [
-                { 'id': "gLineChart",        'func': google.visualization.LineChart },
-                { 'id': "gAreaChart",        'func': google.visualization.AreaChart },
-                { 'id': "gSteppedAreaChart", 'func': google.visualization.SteppedAreaChart },
-                { 'id': "gPieChart",         'func': google.visualization.PieChart },
-                { 'id': "gBubbleChart",      'func': google.visualization.BubbleChart },
-                { 'id': "gColumnChart",      'func': google.visualization.ColumnChart },
-                { 'id': "gBarChart",         'func': google.visualization.BarChart },
-                { 'id': "gSparkline",        'func': google.visualization.ImageSparkLine },
-                { 'id': "gScatterChart",     'func': google.visualization.ScatterChart },
-                { 'id': "gCandlestickChart", 'func': google.visualization.CandlestickChart },
-                { 'id': "gGauge",            'func': google.visualization.Gauge },
-                { 'id': "gOrgChart",         'func': google.visualization.OrgChart },
-                { 'id': "gTreeMap",          'func': google.visualization.TreeMap },
-                { 'id': "gTimeline",         'func': google.visualization.AnnotatedTimeLine },
-                { 'id': "gMotionChart",      'func': google.visualization.MotionChart },
-                { 'id': "gGeoChart",         'func': google.visualization.GeoChart },
-                { 'id': "gGeoMap",           'func': google.visualization.GeoMap },
-                { 'id': "gMap",              'func': google.visualization.Map },
-                { 'id': "gTable",            'func': google.visualization.Table }
-            ],
-                chart;
-
-            $.merge(this.all, googlecharts);
-            for (chart in sgvizler.chart) {
-                if (sgvizler.chart.hasOwnProperty(chart)) {
-                    this.register(
-                        sgvizler.chart[chart].prototype.id,
-                        sgvizler.chart[chart]
-                    );
-                }
-            }
-        },
-
-        register: function (id, func) {
-            this.all.push({'id': id, 'func': func});
-        },
-
-        getChart: function (containerId, chartId) {
-            var i,
-                container = document.getElementById(containerId);
-            for (i = 0; i < this.all.length; i += 1) {
-                if (chartId === this.all[i].id) {
-                    return new this.all[i].func(container);
-                }
-            }
-        }
-    };
-
-
-    /*global d3 */
-    /** dForceGraph **
-
-
-        D3 force directed graph. Under development.
-    */
-    sgvizler.chart.dForceGraph = function (container) { this.container = container; };
-    sgvizler.chart.dForceGraph.prototype = {
-        id:   "dForceGraph",
-        draw: function (data, chartOpt) {
-            var noColumns = data.getNumberOfColumns(),
-                noRows = data.getNumberOfRows(),
-                opt = $.extend({'maxnodesize': 15, 'minnodesize': 2 }, chartOpt), // set defaults
-                colors = d3.scale.category20(),
-                w = chartOpt.width,
-                h = chartOpt.height,
-                isNumber = function (n) {  return !isNaN(parseFloat(n)) && isFinite(n); },
-
-                // build arrays of nodes and links.
-                nodes = [],
-                edges = [],
-                t_color = {},
-                t_size = {},
-                t_maxnodesize = 0,
-
-                r,
-                source,
-                target,
-
-                nodesizeratio,
-                i,
-                color,
-                size,
-
-                vis,
-                force,
-                link,
-                node,
-                ticks;
-
-            for (r = 0; r < noRows; r += 1) {
-                source = data.getValue(r, 0);
-                target = data.getValue(r, 1);
-                // nodes
-                if (source !== null && $.inArray(source, nodes) === -1) {
-                    nodes.push(source);
-                    t_size[source] = (noColumns > 2) ? Math.sqrt(data.getValue(r, 2)) : 0;
-                    t_color[source] = (noColumns > 3) ? data.getValue(r, 3) : 0;
-                    if (t_size[source] > t_maxnodesize) {
-                        t_maxnodesize = t_size[source];
-                    }
-                }
-                if (target !== null && $.inArray(target, nodes) === -1) {
-                    nodes.push(target);
-                }
-                // edges
-                if (source !== null && target !== null) {
-                    edges.push({'source': $.inArray(source, nodes),
-                                'target': $.inArray(target, nodes)
-                            }
-                        );
-                }
-            }
-            if (t_maxnodesize === 0) {
-                t_maxnodesize = 1;
-            }
-            nodesizeratio = opt.maxnodesize / t_maxnodesize;
-            for (i = 0; i < nodes.length; i += 1) {
-                color = typeof t_color[nodes[i]] !== 'undefined' ?
-                        t_color[nodes[i]] :
-                        1;
-                size = isNumber(t_size[nodes[i]]) ?
-                        opt.minnodesize + t_size[nodes[i]] * nodesizeratio :
-                        opt.minnodesize;
-
-                nodes[i] = {'name': nodes[i], 'color': color, 'size': size };
-            }
-
-            $(this.container).empty();
-
-            vis = d3.select(this.container)
-                .append("svg:svg")
-                .attr("width", w)
-                .attr("height", h)
-                .attr("pointer-events", "all")
-                .append('svg:g')
-                .call(d3.behavior.zoom().on("zoom", function () {
-                    vis.attr("transform", "translate(" + d3.event.translate + ")" +
-                         " scale(" + d3.event.scale + ")");
-                }))
-                .append('svg:g');
-
-            vis.append('svg:rect')
-                .attr('width', w)
-                .attr('height', h)
-                .attr('fill', 'white');
-
-            force = d3.layout.force()
-                .gravity(0.05)
-                .distance(100)
-                .charge(-100)
-                .nodes(nodes)
-                .links(edges)
-                .size([w, h])
-                .start();
-
-            link = vis.selectAll("line.link")
-                .data(edges)
-                .enter().append("svg:line")
-                .attr("class", "link")
-                //.style("stroke-width", function (d) { return Math.sqrt(d.value); })
-                .attr("x1", function (d) { return d.source.x; })
-                .attr("y1", function (d) { return d.source.y; })
-                .attr("x2", function (d) { return d.target.x; })
-                .attr("y2", function (d) { return d.target.y; });
-
-            node = vis.selectAll("g.node")
-                .data(nodes)
-                .enter().append("svg:g")
-                .attr("class", "node")
-                .call(force.drag);
-
-            node.append("svg:circle")
-                .style("fill", function (d) { return colors(d.color); })
-                .attr("class", "node")
-                .attr("r", function (d) { return d.size; });
-
-            node.append("svg:title")
-                .text(function (d) { return d.name; });
-
-            node.append("svg:text")
-                .attr("class", "nodetext")
-                .attr("dx", 12)
-                .attr("dy", ".35em")
-                .text(function (d) { return d.name; });
-
-            ticks = 0;
-            force.on("tick", function () {
-                ticks += 1;
-                if (ticks > 250) {
-                    force.stop();
-                    force.charge(0)
-                        .linkStrength(0)
-                        .linkDistance(0)
-                        .gravity(0)
-                        .start();
-                }
-
-                link.attr("x1", function (d) { return d.source.x; })
-                    .attr("y1", function (d) { return d.source.y; })
-                    .attr("x2", function (d) { return d.target.x; })
-                    .attr("y2", function (d) { return d.target.y; });
-
-                node.attr("transform", function (d) {
-                    return "translate(" + d.x + "," + d.y + ")";
-                });
-            });
-        }
-    };
-
-
-    /*global Graph */
-    /** rdGraph **
-
-      Original version written by Magnus Stuhr.
-
-      Draws a graph with clickable and movable nodes. 
-
-      Input format:
-      - 7 columns, last three are optional.
-      - each row represents a source node, a target node and an edge from source to target.
-      - the URIs are the id's for the nodes, and make the nodes clickable.
-      
-      1             2         3         4             5           6             7
-      sourceURI sourceLabel   targetURI targetLabel   edgeLabel   sourceColor   targetColor
-
-    */
-    sgvizler.chart.rdGraph = function (container) { this.container = container; };
-    sgvizler.chart.rdGraph.prototype = {
-        id: "rdGraph",
-        draw: function (data, chartOpt) {
-
-            var numberOfColumns = data.getNumberOfColumns(),
-                numberOfRows = data.getNumberOfRows(),
-
-                // set defaults.
-                opt = $.extend({
-                    noderadius: 0.5,
-                    nodefontsize: "10px",
-                    nodeheight: 20,
-                    nodestrokewidth: "1px",
-                    nodecornerradius: "1px",
-                    nodepadding: 7,
-                    nodecolor: "green",
-                    edgestroke: "blue",
-                    edgefill: "blue",
-                    edgestrokewidth: 1,
-                    edgefontsize: "10px",
-                    edgeseparator: ", "
-                }, chartOpt),
-
-                graph = new Graph(),
-                layouter,
-                renderer,
-                row,
-                i,
-                edge,
-                source,
-                target,
-                label,
-
-                // custom node rendering using Raphael.
-                nodeRenderer = function (color, URL) {
-                    return function (r, n) {
-                        return r.set()
-                            // rectangle
-                            .push(r.rect(n.point[0],
-                                        n.point[1],
-                                        n.label.length * opt.nodepadding,
-                                        opt.nodeheight)
-                                 .attr({"fill": color,
-                                        "stroke-width": opt.nodestrokewidth,
-                                        "r" : opt.nodecornerradius}))
-                           // label inside rectangle
-                            .push(r.text(n.point[0] + n.label.length * opt.nodepadding / 2,
-                                        n.point[1] + opt.nodeheight / 2,
-                                        n.label)
-                                 .attr({"font-size": opt.nodefontsize})
-                                 .click(function () { if (URL) { window.open(sgvizler.parser.unprefixify(URL)); } })
-                                );
-                    };
-                },
-
-                // helper function.
-                addNode = function (URL, name, color) {
-                    graph.addNode(URL, {label: name, render: nodeRenderer(color, URL)});
-                    //console.log("add node - name: " + name + ", URL: " + URL);
-                },
-                edges = {},
-                keys_edges = [];
-
-            for (row = 0; row < numberOfRows; row += 1) {
-                source = data.getValue(row, 0);
-                target = data.getValue(row, 2);
-
-                // add source node
-                // Note: dracula library takes care of duplicates?
-                if (source) {
-                    addNode(source,
-                            data.getValue(row, 1) || source,
-                            numberOfColumns > 5 ? data.getValue(row, 5) : opt.nodecolor);
-                }
-                // add target node
-                if (target) {
-                    addNode(target,
-                            data.getValue(row, 3) || target,
-                            numberOfColumns > 6 ? data.getValue(row, 6) : opt.nodecolor);
-                }
-
-                // collect edge labels. Only one edge per pair of nodes,
-                // so we concatinate labels of multiple edges into one.
-                if (source && target) {
-                    label = "";
-                    // test if source--target pair is seen before:
-                    if (typeof edges[source + target] !== 'undefined') {
-                        label = edges[source + target].label; // retrieve accumulated label.
-                    } else {
-                        keys_edges.push(source + target);
-                    }
-
-                    if (numberOfColumns > 4 && data.getValue(row, 4).length > 0) {
-                        if (label.length > 0) {
-                            label += opt.edgeseparator;
-                        }
-                        label += data.getValue(row, 4);
-                    }
-
-                    edges[source + target] = {
-                        'source': source,
-                        'target': target,
-                        'label': label
-                    };
-                }
-            }
-
-            // add edges
-            for (i = 0; i < keys_edges.length; i += 1) {
-                edge = edges[keys_edges[i]];
-                //console.log("add edge - source: " + edge.source + ", target " + edge.target);
-                graph.addEdge(edge.source, edge.target,
-                              { "stroke": opt.edgestroke,
-                                "fill": opt.edgefill,
-                                "label": edge.label,
-                                "width": opt.edgestrokewidth,
-                                "fontsize": opt.edgefontsize
-                              });
-            }
-
-            layouter = new Graph.Layout.Spring(graph);
-            layouter.layout();
-
-            $(this.container).empty();
-            renderer = new Graph.Renderer.Raphael(this.container, graph, opt.width, opt.height, {"noderadius": opt.nodeheight * opt.noderadius});
-            renderer.draw();
-        }
-    };    /** sDefList **
-
-
-     Make a html dt list.
-
-
-     Format, 2--N columns:
-     1. Term
-     2--N. Definition
-
-
-     Available options:
-     'cellSep'   :  string (can be html) to separate cells in definition columns. (default: ' ')
-     'termPrefix  :  string (can be html) to prefix each term with. (default: '')
-     'termPostfix :  string (can be html) to postfix each term with. (default: ':')
-     'definitionPrefix  :  string (can be html) to prefix each definition with. (default: '')
-     'definitionPostfix :  string (can be html) to postfix each definition with. (default: '')
-    */
-    sgvizler.chart.DefList = function (container) { this.container = container; };
-    sgvizler.chart.DefList.prototype = {
-        id:   "sDefList",
-        draw: function (data, chartOpt) {
-            var r,
-                c,
-                term,
-                definition,
-                noColumns = data.getNumberOfColumns(),
-                noRows = data.getNumberOfRows(),
-                opt = $.extend({ cellSep: ' ', termPrefix: '', termPostfix: ':', definitionPrefix: '', definitionPostfix: '' }, chartOpt),
-                list = $(document.createElement('dl'));
-
-
-            for (r = 0; r < noRows; r += 1) {
-                term = opt.termPrefix + data.getValue(r, 0) + opt.termPostfix;
-                list.append($(document.createElement('dt')).html(term));
-                definition = opt.definitionPrefix;
-                for (c = 1; c < noColumns; c += 1) {
-                    definition += data.getValue(r, c);
-                    if (c + 1 !== noColumns) {
-                        definition += opt.cellSep;
-                    }
-                }
-                definition += opt.definitionPostfix;
-                list.append($(document.createElement('dd')).html(definition));
-            }
-            $(this.container).empty();
-            $(this.container).append(list);
-        }
-    };
-    /** sList **
-
-
-     Make a html list, either numbered (ol) or bullets (ul). Each row
-     becomes a list item.
-
-
-     Any number of columns in any format. Everything is displayed as text.
-
-
-     Available options:
-     'list'      :  "ol" / "ul"  (default: "ul")
-     'cellSep'   :  string (can be html) to separate cells in row. (default: ', ')
-     'rowPrefix  :  string (can be html) to prefix each row with. (default: '')
-     'rowPostfix :  string (can be html) to postfix each row with. (default: '')
-    */
-    sgvizler.chart.List = function (container) { this.container = container; };
-    sgvizler.chart.List.prototype = {
-        id:   "sList",
-        draw: function (data, chartOpt) {
-            var noColumns = data.getNumberOfColumns(),
-                noRows = data.getNumberOfRows(),
-                opt = $.extend({ list: 'ul', cellSep: ', ', rowPrefix: '', rowPostfix: '' }, chartOpt),
-                list = $(document.createElement(opt.list)),
-                r,
-                c,
-                rowtext;
-
-
-            for (r = 0; r < noRows; r += 1) {
-                rowtext = opt.rowPrefix;
-                for (c = 0; c < noColumns; c += 1) {
-                    rowtext += data.getValue(r, c);
-                    if (c + 1 !== noColumns) {
-                        rowtext += opt.cellSep;
-                    }
-                }
-                rowtext += opt.rowPostfix;
-                list.append($(document.createElement('li')).html(rowtext));
-            }
-            $(this.container).empty();
-            $(this.container).append(list);
-        }
-    };
-
-
-    /** sMap **
-
-
-     Extends gMap in markers dataMode. Draws textboxes with heading,
-     paragraph, link and image. The idea is to put all columns > 2 into
-     the 3. column with html formatting.
-
-
-     - Data Format 2--6 columns:
-       1. lat
-       2. long
-       3. name  (optional)
-       4. text  (optional)
-       5. link  (optional)
-       6. image (optional)
-
-
-     - If < 4 columns, then behaves just as gMap
-     - Only 6 columns will be read, columns > 6 are ignored.
-    */
-    sgvizler.chart.sMap = function (container) { this.container = container; };
-    sgvizler.chart.sMap.prototype = {
-        id:   "sMap",
-        draw: function (data, chartOpt) {
-            var chart,
-                newData,
-                newValue,
-                noColumns = data.getNumberOfColumns(),
-                r,
-                c;
-
-
-            if (noColumns > 3) {
-                newData = data.clone();
-                // drop columns > 3 from new
-                for (c = noColumns - 1; c > 2; c -= 1) {
-                    newData.removeColumn(c);
-                }
-
-
-                // build new 3. column
-                for (r = 0; r < data.getNumberOfRows(); r += 1) {
-                    newValue = "<div class='sgvizler sgvizler-sMap'>";
-                    newValue += "<h1>" + data.getValue(r, 2) + "</h1>";
-                    if (5 < noColumns && data.getValue(r, 5) !== null) {
-                        newValue += "<div class='img'><img src='" + data.getValue(r, 5) + "'/></div>";
-                    }
-                    if (3 < noColumns && data.getValue(r, 3) !== null) {
-                        newValue += "<p class='text'>" + data.getValue(r, 3) + "</p>";
-                    }
-                    if (4 < noColumns && data.getValue(r, 4) !== null) {
-                        newValue += "<p class='link'><a href='" + sgvizler.parser.unprefixify(data.getValue(r, 4)) + "'>" + data.getValue(r, 4) + "</a></p>";
-                    }
-                    newValue += "</div>";
-                    newData.setCell(r, 2, newValue);
-                }
-            } else { // do nothing.
-                newData = data;
-            }
-
-
-            chart = new google.visualization.Map(this.container);
-            chart.draw(newData, chartOpt);
-        }
-    };
-
-
-    /** sTable **
-
-
-     Make a html table.
-
-
-     Available options:
-     'headings'   :  "true" / "false"  (default: "true")
-    */
-    sgvizler.chart.Table = function (container) { this.container = container; };
-    sgvizler.chart.Table.prototype = {
-        id:   "sTable",
-        draw: function (data, chartOpt) {
-            var noColumns = data.getNumberOfColumns(),
-                noRows = data.getNumberOfRows(),
-                opt = $.extend({'headings': true }, chartOpt),
-                table = $(document.createElement('table')),
-                c,
-                r,
-                row;
-
-
-            if (opt.headings) {
-                row = $(document.createElement('tr'));
-                for (c = 0; c < noColumns; c += 1) {
-                    row.append($(document.createElement('th')).html(data.getColumnLabel(c)));
-                }
-                table.append(row);
-            }
-
-
-            for (r = 0; r < noRows; r += 1) {
-                row = $(document.createElement('tr'));
-                for (c = 0; c < noColumns; c += 1) {
-                    row.append($(document.createElement('td')).html(data.getValue(r, c)));
-                }
-                table.append(row);
-            }
-            $(this.container).empty();
-            $(this.container).append(table);
-        }
-    };
-
-    /** sText **
-
-
-     Write text.
-
-
-     Any number of columns. Everything is displayed as text.
-
-
-     Available options:
-     'cellSep'       :  string (can be html) to separate cells in each column. (default: ', ')
-     'cellPrefix     :  string (can be html) to prefix each cell with. (default: '')
-     'cellPostfix    :  string (can be html) to postfix each cell  with. (default: '')
-     'rowPrefix      :  string (can be html) to prefix each row with. (default: '<p>')
-     'rowPostfix     :  string (can be html) to postfix each row with. (default: '</p>')
-     'resultsPrefix  :  string (can be html) to prefix the results with. (default: '<div>')
-     'resultsPostfix :  string (can be html) to postfix the results with. (default: '</div>')
-    */
-    sgvizler.chart.Text = function (container) { this.container = container; };
-    sgvizler.chart.Text.prototype = {
-        id:   "sText",
-        draw: function (data, chartOpt) {
-            var noColumns = data.getNumberOfColumns(),
-                noRows = data.getNumberOfRows(),
-                opt = $.extend({ cellSep: ', ',
-                                 cellPrefix: '', cellPostfix: '',
-                                 rowPrefix: '<p>', rowPostfix: '</p>',
-                                 resultsPrefix: '<div>', resultsPostfix: '</div>' },
-                               chartOpt),
-                text = opt.resultsPrefix,
-                r,
-                c,
-                row;
-
-
-            for (r = 0; r < noRows; r += 1) {
-                row = opt.rowPrefix;
-                for (c = 0; c < noColumns; c += 1) {
-                    row += opt.cellPrefix + data.getValue(r, c) + opt.cellPostfix;
-                    if (c + 1 !== noColumns) {
-                        row += opt.cellSep;
-                    }
-                }
-                text += row + opt.rowPostfix;
-            }
-            text += opt.resultsPostfix;
-
-
-            $(this.container).empty();
-            $(this.container).html(text);
-        }
-    };
-    global.sgvizler = sgvizler;
-}(window));

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/system.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/system.html b/platform/marmotta-core/src/main/resources/web/admin/system.html
index fd1a3bb..7d982cb 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/system.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/system.html
@@ -24,7 +24,7 @@
     var _SERVER_URL = "http://localhost:8080/Marmotta/";
 </script>
 <!--###BEGIN_HEAD###-->
-<script type="text/javascript" src="../public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
 <script type="text/javascript" src="../public/js/lib/strftime.js"></script>
 <script type="text/javascript" src="js/widgets/system.js"></script>
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/admin/tasks.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/tasks.html b/platform/marmotta-core/src/main/resources/web/admin/tasks.html
index e0e4030..39a4e9e 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/tasks.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/tasks.html
@@ -21,7 +21,7 @@
 <head>
     <!--###BEGIN_HEAD###-->
     <title>Marmotta - Current Tasks</title>
-    <script type="text/javascript" src="../public/js/lib/jquery-1.6.4.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="../public/js/lib/strftime.js"></script>
     <script type="text/javascript">
     $(function() {

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-core/src/main/resources/web/public/html/reasoning.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/html/reasoning.html b/platform/marmotta-core/src/main/resources/web/public/html/reasoning.html
index 818e632..5a9fa95 100644
--- a/platform/marmotta-core/src/main/resources/web/public/html/reasoning.html
+++ b/platform/marmotta-core/src/main/resources/web/public/html/reasoning.html
@@ -25,7 +25,7 @@
            font-size: 0.95em;
         }
     </style>
-    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript">
         var hash;
         var baseURI;


[08/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
new file mode 100644
index 0000000..4d80b02
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <!--###BEGIN_HEAD###-->
+    <title>Sgvizler</title>
+    <meta charset="UTF-8"/>
+    <link rel="stylesheet" type="text/css" href="../../../core/public/style/center.css"/>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+    <script type="text/javascript" src="../../webjars/sgvizler/0.5.1/sgvizler.js" id="sgvzlr_script" ></script>
+    <script type="text/javascript" src="../../webjars/codemirror/2.24/codemirror.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/2.24/simple-hint.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/2.24/sparql.js"></script>
+    <script type="text/javascript">
+        // CONFIGURATION Sgvizler 0.5: Set variables to fit your setup.
+        // NB! Do not let the last item in a list end with a comma.
+
+        //// Query settings. The defaults settings are listed.
+        sgvizler.option.query = {
+            // Default query.
+            'query':                "SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?instance a ?class }\nGROUP BY ?class\nORDER BY ?class",
+
+            // Endpoint URL.
+            'endpoint':             _BASIC_URL + 'sparql/select',
+
+            // Endpoint output format.
+            'endpoint_output':      'json'  // 'xml' or 'json'
+
+            // This string is appended the 'endpoint' variable and the query to it again to give a link to the "raw" query results.
+            //'endpoint_query_url':   "?output=text&amp;query=",
+
+            // URL to SPARQL validation service. The query is appended to it.
+            //'validator_query_url':  "http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=",
+
+            // Default chart type.
+            //'chart':                'gLineChart',
+
+            // Default log level. Must be either 0, 1, or 2.
+            //'loglevel':             2
+        };
+
+        //// Prefixes
+        // Add convenient prefixes for your dataset. rdf, rdfs, xsd, owl
+        // are already set.  Examples:
+        //sgvizler.option.namespace['wd'] = 'http://sws.ifi.uio.no/d2rq/resource/';
+        //sgvizler.option.namespace['w']  = 'http://sws.ifi.uio.no/ont/world.owl#';
+
+        //// Your chart drawing preferences. The defaults are listed.
+        // See the Google visualization API for available options for
+        // Google charts, and the Sgvizler homepage for other
+        // options. Options applicable to all charts are put in the
+        // "root" of sgvizler.chartOptions. Chart specific options are
+        // put in a "child" with the chart's id as name,
+        // e.g. 'gGeoMap'.
+        sgvizler.option.chart = {
+            //'width':           '800',
+            //'height':          '400',
+            //'chartArea':       { left: '5%', top: '5%', width: '75%', height: '80%' },
+            //     'gGeoMap': {
+            //	 'dataMode':           'markers'
+            //     },
+            //     'gMap': {
+            //	 'dataMode':           'markers',
+            //     },
+            //     'sMap': {
+            //	 'dataMode':           'markers',
+            //	 'showTip':            true,
+            //	 'useMapTypeControl':  true
+            //     }
+        };
+
+        var editor;
+        $(document).ready(function(){
+            jQuery("#sgvzlr_cQuery").addClass("editor_cm");
+
+        });
+
+        sgvizler.ui.setElementValue = function (elementID, value) {
+            if (sgvizler.ui.isElement(elementID)) {
+                $('#' + elementID).val(value);
+            }
+            if(elementID == "sgvzlr_cQuery") {
+                if(editor) editor.toTextArea();
+                editor = CodeMirror.fromTextArea(document.getElementById("sgvzlr_cQuery"),{
+                    lineNumbers : true,
+                    matchBrackets : true,
+                    extraKeys: {"Ctrl-Space": "sparqlAutocomplete"},
+                    mode: "application/x-sparql-query"
+                });
+            }
+        };
+
+        //// Leave this as is. Ready, steady, GO!
+        $(document).ready(sgvizler.go());
+
+    </script>
+    <link rel="stylesheet" href="../../../cm/codemirror.css" />
+    <link rel="stylesheet" href="../../../cm/simple-hint.css" />
+    <style type="text/css">
+        .CodeMirror {
+            background-color: #fff;
+        }
+    </style>
+    <!--###END_HEAD###-->
+</head>
+<body>
+<!--###BEGIN_CONTENT###-->
+<h2>Visualize SPARQL Query Results</h2>
+
+This page allows you to enter custom SPARQL queries and visualize their results in different kinds of charts.
+The implementation is based on <a href="http://code.google.com/p/sgvizler/">Sqvizler</a>, so you can evaluate query
+visualisations here and then build your own custom LMF+Sgvizler applications.
+
+<div id="queryarea">
+    <pre id="sgvzlr_cPrefix"></pre>
+    <textarea id="sgvzlr_cQuery" rows="10" cols="80"></textarea>
+    <form method="get" id="sgvzlr_formQuery">
+        <p>
+            <input type="hidden" value="" name="query" id="sgvzlr_strQuery"/>
+            Width:  <input name="width" id="sgvzlr_strWidth" type="text" size="3"/>
+            Height: <input name="height" id="sgvzlr_strHeight" type="text" size="3"/>
+            Chart Type: <select name="chart" id="sgvzlr_optChart"></select>
+            <input type="button" value="GO!" onclick="editor.save(); sgvizler.ui.submitQuery()"/>
+        </p>
+    </form>
+    <div id="sgvzlr_cMessage"></div>
+</div>
+<div id="sgvzlr_gchart" style="width:800px; height:400px;"></div>
+<div style="font-size: 80%; font-style: italic; margin-top: 10px;">
+    <!-- Please leave a link to the Sgvizler homepage -->
+    <p>
+        Sgvizler visualizes the result of SPARQL SELECT queries using
+        javascript and the Google Visualization API. For more
+        information, see
+        the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
+        homepage. (c) 2011 Martin G. Skj&#230;veland.
+    </p>
+</div>
+<!--###END_CONTENT###-->
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/LICENSE
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/LICENSE b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/LICENSE
deleted file mode 100644
index 0e50dba..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/LICENSE
+++ /dev/null
@@ -1,16 +0,0 @@
-Copyright (c) 2011 Martin G. Skjæveland
-
-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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.chart.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.chart.css b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.chart.css
deleted file mode 100644
index 3f0026e..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.chart.css
+++ /dev/null
@@ -1,37 +0,0 @@
-
-/*** sMap ***/
-
-div.sgvizler-sMap{
-    padding: 0;
-    margin: 0;
-    font-family: sans-serif;
-}
-div.sgvizler-sMap h1, div.sgvizler-sMap p{
-    font-size: 11pt;
-    margin: 2px 0 1px 0;
-}
-div.sgvizler-sMap p.text{
-    font-family: serif;
-}
-div.sgvizler-sMap div.img{
-    float: right;
-    padding: 10px;
-}
-
-/*** pForce ***/
-
-circle.node {
-  stroke: #999;
-  stroke-width: 0.5px;
-}
-
-line.link {
-  stroke: #999;
-  stroke-opacity: .6;
-}
-
-.nodetext { 
-    pointer-events: none; 
-    font: 10px sans-serif; 
-    color: black;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.html
deleted file mode 100644
index f986a6a..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.html
+++ /dev/null
@@ -1,141 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-      <!--###BEGIN_HEAD###-->
-      <title>Sgvizler</title>
-    <meta charset="UTF-8"/>
-    <link rel="stylesheet" type="text/css" href="../../../../core/public/style/center.css"/>
-    <script type="text/javascript" src="../../../../core/public/js/lib/jquery-1.6.4.js"></script>
-    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
-    <script type="text/javascript" id="sgvzlr_script" src="sgvizler.js"></script>
-      <script type="text/javascript" src="../../../cm/codemirror.js"></script>
-      <script type="text/javascript" src="../../../cm/simple-hint.js"></script>
-      <script type="text/javascript" src="../../../cm/sparql.js"></script>
-      <script type="text/javascript">
-      // CONFIGURATION Sgvizler 0.5: Set variables to fit your setup.
-      // NB! Do not let the last item in a list end with a comma.
-
-       //// Query settings. The defaults settings are listed.
-       sgvizler.option.query = {
-           // Default query. 
-           'query':                "SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?instance a ?class }\nGROUP BY ?class\nORDER BY ?class",
-    
-           // Endpoint URL. 
-           'endpoint':             _BASIC_URL + 'sparql/select',
-    
-           // Endpoint output format. 
-           'endpoint_output':      'json'  // 'xml' or 'json'
-    
-           // This string is appended the 'endpoint' variable and the query to it again to give a link to the "raw" query results.
-           //'endpoint_query_url':   "?output=text&amp;query=",
-    
-           // URL to SPARQL validation service. The query is appended to it. 
-           //'validator_query_url':  "http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=",
-    
-           // Default chart type. 
-           //'chart':                'gLineChart',
-    
-           // Default log level. Must be either 0, 1, or 2. 
-           //'loglevel':             2
-       };
-
-       //// Prefixes
-       // Add convenient prefixes for your dataset. rdf, rdfs, xsd, owl
-       // are already set.  Examples: 
-       //sgvizler.option.namespace['wd'] = 'http://sws.ifi.uio.no/d2rq/resource/';
-       //sgvizler.option.namespace['w']  = 'http://sws.ifi.uio.no/ont/world.owl#';
-
-       //// Your chart drawing preferences. The defaults are listed.
-       // See the Google visualization API for available options for
-       // Google charts, and the Sgvizler homepage for other
-       // options. Options applicable to all charts are put in the
-       // "root" of sgvizler.chartOptions. Chart specific options are
-       // put in a "child" with the chart's id as name,
-       // e.g. 'gGeoMap'. 
-       sgvizler.option.chart = { 
-           //'width':           '800',
-           //'height':          '400',
-           //'chartArea':       { left: '5%', top: '5%', width: '75%', height: '80%' },
-           //     'gGeoMap': {
-           //	 'dataMode':           'markers'
-           //     },
-           //     'gMap': {
-           //	 'dataMode':           'markers',
-           //     },
-           //     'sMap': {
-           //	 'dataMode':           'markers',
-           //	 'showTip':            true,
-           //	 'useMapTypeControl':  true
-           //     } 
-       };
-
-      var editor;
-      $(document).ready(function(){
-          jQuery("#sgvzlr_cQuery").addClass("editor_cm");
-
-      });
-
-      sgvizler.ui.setElementValue = function (elementID, value) {
-          if (sgvizler.ui.isElement(elementID)) {
-              $('#' + elementID).val(value);
-          }
-          if(elementID == "sgvzlr_cQuery") {
-              if(editor) editor.toTextArea();
-              editor = CodeMirror.fromTextArea(document.getElementById("sgvzlr_cQuery"),{
-                  lineNumbers : true,
-                  matchBrackets : true,
-                  extraKeys: {"Ctrl-Space": "sparqlAutocomplete"},
-                  mode: "application/x-sparql-query"
-              });
-          }
-      };
-
-       //// Leave this as is. Ready, steady, GO!
-      $(document).ready(sgvizler.go());
-
-      </script>
-      <link rel="stylesheet" href="../../../cm/codemirror.css" />
-      <link rel="stylesheet" href="../../../cm/simple-hint.css" />
-      <style type="text/css">
-          .CodeMirror {
-              background-color: #fff;
-          }
-      </style>
-      <!--###END_HEAD###-->
-  </head>
-  <body>
-  <!--###BEGIN_CONTENT###-->
-    <h2>Visualize SPARQL Query Results</h2>
-
-    This page allows you to enter custom SPARQL queries and visualize their results in different kinds of charts.
-    The implementation is based on <a href="http://code.google.com/p/sgvizler/">Sqvizler</a>, so you can evaluate query
-    visualisations here and then build your own custom LMF+Sgvizler applications.
-
-    <div id="queryarea">
-      <pre id="sgvzlr_cPrefix"></pre>
-      <textarea id="sgvzlr_cQuery" rows="10" cols="80"></textarea>
-      <form method="get" id="sgvzlr_formQuery">
-	<p>
-	  <input type="hidden" value="" name="query" id="sgvzlr_strQuery"/>
-	  Width:  <input name="width" id="sgvzlr_strWidth" type="text" size="3"/>
-	  Height: <input name="height" id="sgvzlr_strHeight" type="text" size="3"/>
-	  Chart Type: <select name="chart" id="sgvzlr_optChart"></select>
-	  <input type="button" value="GO!" onclick="editor.save(); sgvizler.ui.submitQuery()"/>
-	</p>
-      </form>
-      <div id="sgvzlr_cMessage"></div>
-    </div>
-    <div id="sgvzlr_gchart" style="width:800px; height:400px;"></div>
-    <div style="font-size: 80%; font-style: italic; margin-top: 10px;">
-      <!-- Please leave a link to the Sgvizler homepage --> 
-      <p>
-	Sgvizler visualizes the result of SPARQL SELECT queries using
-	javascript and the Google Visualization API. For more
-	information, see
-	the <a href="http://code.google.com/p/sgvizler/">Sgvizler</a>
-	homepage. (c) 2011 Martin G. Skj&#230;veland.
-      </p>
-    </div>
-  <!--###END_CONTENT###-->
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.js b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.js
deleted file mode 100644
index f563ed7..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/sgvizler.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*  Sgvizler JavaScript SPARQL result set visualizer, version 0.5.0
- *  (c) 2011 Martin G. Skjæveland
- *
- *  Sgvizler is freely distributable under the terms of an MIT-style license.
- *  Sgvizler web site: https://code.google.com/p/sgvizler/
- *--------------------------------------------------------------------------*/var sgvizler={go:function(){this.loadLibs(),google.load("visualization","1.0",{packages:["annotatedtimeline","corechart","gauge","geomap","geochart","imagesparkline","map","orgchart","table","motionchart","treemap"]}),google.setOnLoadCallback(function(){sgvizler.charts.loadCharts(),sgvizler.drawFormQuery(),sgvizler.drawContainerQueries()})},loadLibs:function(){sgvizler.ui.isElement(sgvizler.ui.id.script)&&(this.option.homefolder=$("#"+sgvizler.ui.id.script).attr("src").replace(/sgvizler\.js$/,""),this.option.libfolder=this.option.homefolder+"/lib/"),$.ajax(this.option.libfolder+"d3.min.js",{dataType:"script",async:!1}),$.ajax(this.option.libfolder+"d3.layout.min.js",{dataType:"script",async:!1}),$.ajax(this.option.libfolder+"d3.geom.min.js",{dataType:"script",async:!1}),$("head").append('<link rel="stylesheet" href="'+this.option.homefolder+'sgvizler.chart.css" type="text/css" />')},drawFormQuery:function(
 ){var a=new sgvizler.query(sgvizler.ui.id.chartCon),b=sgvizler.ui.getUrlParams();$.extend(a,sgvizler.option.query,{query:b.query,chart:b.chart}),sgvizler.ui.displayUI(a),sgvizler.ui.isElement(a.container)&&a.query&&($.extend(a.chartOptions,{width:b.width,height:b.height}),a.draw())},drawContainerQueries:function(){$("["+this.ui.attr.prefix+"query]").each(function(){var a=new sgvizler.query;$.extend(a,sgvizler.option.query,sgvizler.ui.getQueryOptionAttr(this)),$.extend(a.chartOptions,sgvizler.ui.getChartOptionAttr(this)),a.draw()})},option:{},chart:{},charts:{},parser:{},ui:{}};jQuery.ajaxSetup({accepts:{xml:"application/sparql-results+xml",json:"application/sparql-results+json"}}),sgvizler.option={home:window.location.href.replace(window.location.search,""),homefolder:"",libfolder:this.homefolder+"/lib/",namespace:{rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",owl:"http://www.w3.org/2002/07/owl#",xsd:"http://www.w3.org/2001/XMLSchema#
 "},query:{},chart:{}},sgvizler.ui={id:{script:"sgvzlr_script",chartCon:"sgvzlr_gchart",queryForm:"sgvzlr_formQuery",queryTxt:"sgvzlr_cQuery",formQuery:"sgvzlr_strQuery",formWidth:"sgvzlr_strWidth",formHeight:"sgvzlr_strHeight",formChart:"sgvzlr_optChart",prefixCon:"sgvzlr_cPrefix",messageCon:"sgvzlr_cMessage"},attr:{prefix:"data-sgvizler-",prefixChart:"data-sgvizler-chart-options",valueAssign:"=",valueSplit:"|"},params:["query","chart","width","height"],displayUI:function(a){this.displayPrefixes(),this.displayChartTypesMenu(),this.displayUserInput(a)},displayPrefixes:function(){this.setElementText(this.id.prefixCon,sgvizler.query.prototype.getPrefixes())},displayUserInput:function(a){this.setElementValue(this.id.queryTxt,a.query),this.setElementValue(this.id.formChart,a.chart),this.setElementValue(this.id.formWidth,a.width),this.setElementValue(this.id.formHeight,a.height)},displayChartTypesMenu:function(){if(this.isElement(this.id.formChart)){var a=sgvizler.charts.all;for(var b=0;b
 <a.length;b++)$("#"+this.id.formChart).append($("<option/>").val(a[b].id).html(a[b].id))}},displayFeedback:function(a,b){var c="",d=a.container;a.container===this.id.chartCon&&this.isElement(this.id.messageCon)&&(d=this.id.messageCon);if(a.loglevel===0)return;if(a.loglevel===1){if(b==="LOADING")c="Loading...";else if(b==="ERROR_ENDPOINT"||b==="ERROR_UNKNOWN")c="Error."}else b==="LOADING"?c="Sending query...":b==="ERROR_ENDPOINT"?c="Error querying endpoint. Possible errors:"+this.html.ul(this.html.a(a.endpoint,"SPARQL endpoint")+" down? "+this.html.a(a.endpoint+a.endpoint_query_url+a.encodedQuery,"Check if query runs at the endpoint")+".","Malformed SPARQL query? "+this.html.a(a.validator_query_url+a.encodedQuery,"Check if it validates")+".","CORS supported and enabled? Read more about "+this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility","CORS and compatibility")+".","Is your "+this.html.a("http://code.google.com/p/sgvizler/wiki/Compatibility","browser support")+"ed?"
 ,"Hmm.. it might be a bug! Please file a report to "+this.html.a("http://code.google.com/p/sgvizler/issues/","the issues")+"."):b==="ERROR_UNKNOWN"?c="Unknown error.":b==="NO_RESULTS"?c="Query returned no results.":b==="DRAWING"&&(c="Received "+a.noRows+" rows. Drawing chart...<br/>"+this.html.a(a.endpoint+a.endpoint_query_url+a.encodedQuery,"View query results","target='_blank'")+" (in new window).");this.setElementHTML(d,this.html.tag("p",c))},setElementValue:function(a,b){this.isElement(a)&&$("#"+a).val(b)},setElementText:function(a,b){this.isElement(a)&&$("#"+a).text(b)},setElementHTML:function(a,b){this.isElement(a)&&$("#"+a).html(b)},isElement:function(a){return $("#"+a).length>0},getQueryOptionAttr:function(a){var b={container:$(a).attr("id")},c=a.attributes;for(var d=0;d<c.length;d++)c[d].name.lastIndexOf(this.attr.prefix,0)===0&&(b[c[d].name.substring(this.attr.prefix.length)]=c[d].value);return b},getChartOptionAttr:function(a){var b={},c=$(a).attr(sgvizler.ui.attr.prefixC
 hart);if(typeof c!="undefined"){options=c.split(this.attr.valueSplit);for(var d in options){var e=options[d].split(this.attr.valueAssign),f=e[0].split("."),g=b;for(var h=0;h<f.length-1;h++)typeof g[f[h]]=="undefined"&&(g[f[h]]={}),g=g[f[h]];g[f[h]]=e[1]}}return b.width=/(\d+)/.exec($(a).css("width"))[1],b.height=/(\d+)/.exec($(a).css("height"))[1],b},getUrlParams:function(){var a={},b,c=/([^&=]+)=?([^&]*)/g,d=function(a){return decodeURIComponent(a.replace(/\+/g," "))},e=window.location.search.substring(1);while(b=c.exec(e))b[2].length>0&&$.inArray(b[1],this.params!==-1)&&(a[d(b[1])]=d(b[2]));return a},resetPage:function(){document.location=sgvizler.home},submitQuery:function(){$("#"+this.id.formQuery).val($("#"+this.id.queryTxt).val()),$("#"+this.id.queryForm).submit()},html:{a:function(a,b,c){typeof c=="undefined"&&(c="");if(typeof a!="undefined"&&typeof b!="undefined")return"<a "+c+" href='"+a+"'>"+b+"</a>"},ul:function(){var a=this.ul.arguments;if(a.length){var b="<ul>";for(var 
 c=0;c<a.length;c++)b+="<li>"+a[c]+"</li>";return b+"</ul>"}},tag:function(a,b){return"<"+a+">"+b+"</"+a+">"}}},sgvizler.parser={defaultGDatatype:"string",countRowsSparqlXML:function(a){return $(a).find("sparql").find("results").find("result").length},countRowsSparqlJSON:function(a){if(typeof a.results.bindings!="undefined")return a.results.bindings.length},SparqlXML2GoogleJSON:function(a){var b=[],c=[],d=[],e=$(a).find("sparql").find("results").find("result"),f=0;$(a).find("sparql").find("head").find("variable").each(function(){var a=null,c=null,g=$(this).attr("name"),h=$(e).find('binding[name="'+g+'"]');if(h.length){var i=$(h).first().children().first()[0];a=i.nodeName,c=$(i).attr("datatype")}d[f]=sgvizler.parser.getGoogleJsonDatatype(a,c),b[f]={id:g,label:g,type:d[f]},f++});var g=0;return $(e).each(function(){var a=[];for(var e=0;e<b.length;e++){var f=null,h=$(this).find('binding[name="'+b[e].id+'"]');if(h.length&&typeof $(h).first().children().first()!="undefined"&&$(h).first().c
 hildren().first().firstChild!==null){var i=$(h).first().children().first()[0],j=i.nodeName,k=$(i).first().text();f=sgvizler.parser.getGoogleJsonValue(k,d[e],j)}a[e]={v:f}}c[g]={c:a},g++}),{cols:b,rows:c}},SparqlJSON2GoogleJSON:function(a){var b=[],c=[],d=[],e=a.head.vars,f=a.results.bindings;for(var g=0;g<e.length;g++){var h=0,i=null,j=null;while(typeof f[h][e[g]]=="undefined"&&h+1<f.length)h++;typeof f[h][e[g]]!="undefined"&&(i=f[h][e[g]].type,j=f[h][e[g]].datatype),d[g]=this.getGoogleJsonDatatype(i,j),b[g]={id:e[g],label:e[g],type:d[g]}}for(var h=0;h<f.length;h++){var k=f[h],l=[];for(var g=0;g<e.length;g++){var m=null;typeof k[e[g]]!="undefined"&&typeof k[e[g]].value!="undefined"&&(m=this.getGoogleJsonValue(k[e[g]].value,d[g],k[e[g]].type)),l[g]={v:m}}c[h]={c:l}}return{cols:b,rows:c}},getGoogleJsonValue:function(a,b,c){return b==="number"?Number(a):b==="date"?new Date(a.substr(0,4),a.substr(5,2),a.substr(8,2)):b==="datetime"?new Date(a.substr(0,4),a.substr(5,2),a.substr(8,2),a.sub
 str(11,2),a.substr(14,2),a.substr(17,2)):b==="timeofday"?[a.substr(0,2),a.substr(3,2),a.substr(6,2)]:c==="uri"?this.prefixify(a):a},getGoogleJsonDatatype:function(a,b){var c=sgvizler.option.namespace.xsd;if(typeof a!="undefined"&&(a==="typed-literal"||a==="literal")){if(b===c+"float"||b===c+"double"||b===c+"decimal"||b===c+"int"||b===c+"long"||b===c+"integer")return"number";if(b===c+"boolean")return"boolean";if(b===c+"date")return"date";if(b===c+"dateTime")return"datetime";if(b===c+"time")return"timeofday"}return this.defaultGDatatype},prefixify:function(a){for(var b in sgvizler.option.namespace)if(a.lastIndexOf(sgvizler.option.namespace[b],0)===0)return a.replace(sgvizler.option.namespace[b],b+":");return a},unprefixify:function(a){for(var b in sgvizler.option.namespace)if(a.lastIndexOf(b+":",0)===0)return a.replace(b+":",sgvizler.option.namespace[b]);return a}},sgvizler.query=function(a){this.container=a,this.query="SELECT ?class (count(?instance) AS ?noOfInstances)\nWHERE{ ?insta
 nce a ?class }\nGROUP BY ?class\nORDER BY ?class",this.endpoint="http://sws.ifi.uio.no/sparql/world",this.endpoint_output="json",this.endpoint_query_url="?output=text&amp;query=",this.validator_query_url="http://www.sparql.org/query-validator?languageSyntax=SPARQL&amp;outputFormat=sparql&amp;linenumbers=true&amp;query=",this.chart="gLineChart",this.loglevel=2,this.chartOptions={width:"800",height:"400",chartArea:{left:"5%",top:"5%",width:"75%",height:"80%"},gGeoMap:{dataMode:"markers"},gMap:{dataMode:"markers"},sMap:{dataMode:"markers",showTip:!0,useMapTypeControl:!0},gSparkline:{showAxisLines:!1}}},sgvizler.query.prototype.draw=function(){var a=this,b=sgvizler.charts.getChart(this.container,this.chart);this.setChartSpecificOptions(),this.insertFrom(),this.runQuery(function(c){b.draw(new google.visualization.DataTable(a.processQueryResults(c)),a.chartOptions)})},sgvizler.query.prototype.runQuery=function(a){var b=this.endpoint_output;sgvizler.ui.displayFeedback(this,"LOADING"),this.
 encodedQuery=encodeURIComponent(this.getPrefixes()+this.query);if(this.endpoint_output!=="jsonp"&&$.browser.msie&&window.XDomainRequest){var c=new XDomainRequest,d=this.endpoint+"?query="+this.encodedQuery+"&output="+this.endpoint_output;c.open("GET",d),c.onload=function(){var d;b==="xml"?d=$.parseXML(c.responseText):d=$.parseJSON(c.responseText),a(d)},c.send()}else $.get(this.endpoint,{query:this.getPrefixes()+this.query,output:this.endpoint_output==="jsonp"?"json":this.endpoint_output},function(b){a(b)},this.endpoint_output).error(function(){sgvizler.ui.displayFeedback(this,"ERROR_ENDPOINT")})},sgvizler.query.prototype.processQueryResults=function(a){this.setResultRowCount(a);if(this.noRows===null)sgvizler.ui.displayFeedback(this,"ERROR_UNKNOWN");else if(this.noRows===0)sgvizler.ui.displayFeedback(this,"NO_RESULTS");else return sgvizler.ui.displayFeedback(this,"DRAWING"),this.getGoogleJSON(a)},sgvizler.query.prototype.setResultRowCount=function(a){this.endpoint_output==="xml"?this
 .noRows=sgvizler.parser.countRowsSparqlXML(a):this.noRows=sgvizler.parser.countRowsSparqlJSON(a)},sgvizler.query.prototype.getGoogleJSON=function(a){return this.endpoint_output==="xml"?a=sgvizler.parser.SparqlXML2GoogleJSON(a):a=sgvizler.parser.SparqlJSON2GoogleJSON(a),a},sgvizler.query.prototype.insertFrom=function(){if(typeof this.rdf!="undefined"){var a=this.rdf.split(sgvizler.ui.attr.valueSplit),b="";for(var c in a)b+="FROM <"+a[c]+">\n";this.query=this.query.replace(/(WHERE)?(\s)*\{/,"\n"+b+"WHERE {")}},sgvizler.query.prototype.getPrefixes=function(){var a="";for(var b in sgvizler.option.namespace)a+="PREFIX "+b+": <"+sgvizler.option.namespace[b]+">\n";return a},sgvizler.query.prototype.setChartSpecificOptions=function(){for(var a in this.chartOptions)if(a===this.chart)for(var b in this.chartOptions[a])this.chartOptions[b]=this.chartOptions[a][b]},sgvizler.charts={all:[],loadCharts:function(){var a=[{id:"gLineChart",func:google.visualization.LineChart},{id:"gAreaChart",func:goo
 gle.visualization.AreaChart},{id:"gSteppedAreaChart",func:google.visualization.SteppedAreaChart},{id:"gPieChart",func:google.visualization.PieChart},{id:"gBubbleChart",func:google.visualization.BubbleChart},{id:"gColumnChart",func:google.visualization.ColumnChart},{id:"gBarChart",func:google.visualization.BarChart},{id:"gSparkline",func:google.visualization.ImageSparkLine},{id:"gScatterChart",func:google.visualization.ScatterChart},{id:"gCandlestickChart",func:google.visualization.CandlestickChart},{id:"gGauge",func:google.visualization.Gauge},{id:"gOrgChart",func:google.visualization.OrgChart},{id:"gTreeMap",func:google.visualization.TreeMap},{id:"gTimeline",func:google.visualization.AnnotatedTimeLine},{id:"gMotionChart",func:google.visualization.MotionChart},{id:"gGeoChart",func:google.visualization.GeoChart},{id:"gGeoMap",func:google.visualization.GeoMap},{id:"gMap",func:google.visualization.Map},{id:"gTable",func:google.visualization.Table}];$.merge(this.all,a);for(var b in sgvi
 zler.chart)this.register(sgvizler.chart[b].prototype.id,sgvizler.chart[b])},register:function(a,b){this.all.push({id:a,func:b})},getChart:function(a,b){var c=document.getElementById(a);for(var d=0;d<this.all.length;d++)if(b===this.all[d].id)return new this.all[d].func(c)}},sgvizler.chart.dForceGraph=function(a){this.container=a},sgvizler.chart.dForceGraph.prototype={id:"dForceGraph",draw:function(a,b){function t(){s.attr("transform","translate("+d3.event.translate+")"+" scale("+d3.event.scale+")")}var c=a.getNumberOfColumns(),d=a.getNumberOfRows(),e=$.extend({maxnodesize:15,minnodesize:2},b);colors=d3.scale.category20(),w=b.width,h=b.height,isNumber=function(a){return!isNaN(parseFloat(a))&&isFinite(a)};var f=[],g=[],i={},j={},k=0;for(var l=0;l<d;l++){var m=a.getValue(l,0),n=a.getValue(l,1);m!==null&&$.inArray(m,f)===-1&&(f.push(m),j[m]=c>2?Math.sqrt(a.getValue(l,2)):0,i[m]=c>3?a.getValue(l,3):0,j[m]>k&&(k=j[m])),n!==null&&$.inArray(n,f)===-1&&f.push(n),m!==null&&n!==null&&g.push({so
 urce:$.inArray(m,f),target:$.inArray(n,f)})}k===0&&(k=1);var o=e.maxnodesize/k;for(var p=0;p<f.length;p++){var q=typeof i[f[p]]!="undefined"?i[f[p]]:1,r=isNumber(j[f[p]])?e.minnodesize+j[f[p]]*o:e.minnodesize;f[p]={name:f[p],color:q,size:r}}$(this.container).empty();var s=d3.select(this.container).append("svg:svg").attr("width",w).attr("height",h).attr("pointer-events","all").append("svg:g").call(d3.behavior.zoom().on("zoom",t)).append("svg:g");s.append("svg:rect").attr("width",w).attr("height",h).attr("fill","white");var u=d3.layout.force().gravity(.05).distance(100).charge(-100).nodes(f).links(g).size([w,h]).start(),v=s.selectAll("line.link").data(g).enter().append("svg:line").attr("class","link").attr("x1",function(a){return a.source.x}).attr("y1",function(a){return a.source.y}).attr("x2",function(a){return a.target.x}).attr("y2",function(a){return a.target.y}),x=s.selectAll("g.node").data(f).enter().append("svg:g").attr("class","node").call(u.drag);x.append("svg:circle").style("
 fill",function(a){return colors(a.color)}).attr("class","node").attr("r",function(a){return a.size}),x.append("svg:title").text(function(a){return a.name}),x.append("svg:text").attr("class","nodetext").attr("dx",12).attr("dy",".35em").text(function(a){return a.name});var y=0;u.on("tick",function(){y++,y>250&&(u.stop(),u.charge(0).linkStrength(0).linkDistance(0).gravity(0).start()),v.attr("x1",function(a){return a.source.x}).attr("y1",function(a){return a.source.y}).attr("x2",function(a){return a.target.x}).attr("y2",function(a){return a.target.y}),x.attr("transform",function(a){return"translate("+a.x+","+a.y+")"})})}},sgvizler.chart.DefList=function(a){this.container=a},sgvizler.chart.DefList.prototype={id:"sDefList",draw:function(a,b){var c=a.getNumberOfColumns(),d=a.getNumberOfRows(),e=$.extend({cellSep:" ",termPrefix:"",termPostfix:":",definitionPrefix:"",definitionPostfix:""},b),f=$(document.createElement("dl"));for(var g=0;g<d;g++){var h=e.termPrefix+a.getValue(g,0)+e.termPostf
 ix;f.append($(document.createElement("dt")).html(h));var i=e.definitionPrefix;for(var j=1;j<c;j++)i+=a.getValue(g,j),j+1!==c&&(i+=e.cellSep);i+=e.definitionPostfix,f.append($(document.createElement("dd")).html(i))}$(this.container).empty(),$(this.container).append(f)}},sgvizler.chart.List=function(a){this.container=a},sgvizler.chart.List.prototype={id:"sList",draw:function(a,b){var c=a.getNumberOfColumns(),d=a.getNumberOfRows(),e=$.extend({list:"ul",cellSep:", ",rowPrefix:"",rowPostfix:""},b),f=$(document.createElement(e.list));for(var g=0;g<d;g++){var h=e.rowPrefix;for(var i=0;i<c;i++)h+=a.getValue(g,i),i+1!==c&&(h+=e.cellSep);h+=e.rowPostfix,f.append($(document.createElement("li")).html(h))}$(this.container).empty(),$(this.container).append(f)}},sgvizler.chart.sMap=function(a){this.container=a},sgvizler.chart.sMap.prototype={id:"sMap",draw:function(a,b){var c,d=a.getNumberOfColumns();if(d>3){c=a.clone();for(var e=d-1;e>2;e--)c.removeColumn(e);for(var f=0;f<a.getNumberOfRows();f++)
 {var g="<div class='sgvizler sgvizler-sMap'>";g+="<h1>"+a.getValue(f,2)+"</h1>",5<d&&a.getValue(f,5)!==null&&(g+="<div class='img'><img src='"+a.getValue(f,5)+"'/></div>"),3<d&&a.getValue(f,3)!==null&&(g+="<p class='text'>"+a.getValue(f,3)+"</p>"),4<d&&a.getValue(f,4)!==null&&(g+="<p class='link'><a href='"+sgvizler.parser.unprefixify(a.getValue(f,4))+"'>"+a.getValue(f,4)+"</a></p>"),g+="</div>",c.setCell(f,2,g)}}else c=dDataTable;chart=new google.visualization.Map(this.container),chart.draw(c,b)}},sgvizler.chart.Text=function(a){this.container=a},sgvizler.chart.Text.prototype={id:"sText",draw:function(a,b){var c=a.getNumberOfColumns(),d=a.getNumberOfRows(),e=$.extend({cellSep:", ",cellPrefix:"",cellPostfix:"",rowPrefix:"<p>",rowPostfix:"</p>",resultsPrefix:"<div>",resultsPostfix:"</div>"},b),f=e.resultsPrefix;for(var g=0;g<d;g++){var h=e.rowPrefix;for(var i=0;i<c;i++)h+=e.cellPrefix+a.getValue(g,i)+e.cellPostfix,i+1!==c&&(h+=e.cellSep);f+=h+e.rowPostfix}f+=e.resultsPostfix,$(this.c
 ontainer).empty(),$(this.container).html(f)}};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html b/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
new file mode 100755
index 0000000..ec22217
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <!--###BEGIN_HEAD###-->
+    <title>Snorql: A SPARQL Explorer</title>
+    <link rel="stylesheet" type="text/css" href="../../webjars/snorql/1.0/snorql.css" />
+    <link rel="stylesheet" type="text/css" href="../../webjars/codemirror/2.24/codemirror.css" />
+    <style type="text/css">
+        .CodeMirror {
+            background-color: #fff;
+        }
+    </style>
+    <!--###END_HEAD###-->
+</head>
+
+<body>
+<!--###BEGIN_CONTENT###-->
+<h1>SPARQL Query Form</h1>
+
+<p id="title">Query</p>
+
+<div class="snorql">    
+
+    <div class="section" style="float: right; width: 8em">
+        <h2 style="color:#464646;font-size:18px">Browse:</h2>
+        <ul style="margin:10px 0 0;list-style:none;padding:0;font-size:12px; font-family: Courier;">
+            <li><a class="graph-link" href="?browse=classes">Classes</a></li>
+            <li><a class="graph-link" href="?browse=properties">Properties</a></li>
+            <li id="browse-named-graphs-link"><a href="?browse=graphs">Named Graphs</a></li>
+        </ul>
+    </div>
+
+    <div id="default-graph-section" class="section" style="margin-right: 12em">
+        <h2 style="display: inline;color:#464646;font-size:18px">GRAPH:</h2>
+        <p style="display: inline">
+            Default graph.
+            <a href="?browse=graphs">List named graphs</a>
+        </p>
+    </div>
+
+    <div id="named-graph-section" class="section" style="margin-right: 12em">
+        <h2 style="display: inline;font-size:18px;color:#464646;">GRAPH:</h2>
+        <p style="display: inline">
+            <span id="selected-named-graph">Named graph goes here</span>.
+            <a href="javascript:snorql.switchToDefaultGraph()">Switch back to default graph</a>
+        </p>
+    </div>
+
+    <div class="section">
+        <pre id="prefixestext"></pre>
+        <form id="queryform" action="#" method="get">
+          <div>
+            <input type="hidden" name="prefixes" value="" id="prefixes" />
+            <input type="hidden" name="query" value="" id="query" />
+            <input type="hidden" name="output" value="json" id="jsonoutput" disabled="disabled" />
+            <input type="hidden" name="stylesheet" value="" id="stylesheet" disabled="disabled" />
+            <input type="hidden" name="graph" value="" id="graph-uri" disabled="disabled" />
+          </div>
+        </form>
+        <div>
+            <textarea name="query" rows="9" cols="80" id="querytext"></textarea>
+            <span style="color:#464646;">Results:</span>
+            <select id="selectoutput" onchange="snorql.updateOutputMode()">
+                <option selected="selected" value="browse">Browse</option>
+                <option value="json">as JSON</option>
+                <option value="xml">as XML</option>
+                <option value="html">as HTML</option>
+                <option value="csv">as CSV</option>
+            </select>
+        <span id="xsltcontainer"><span id="xsltinput">
+          XSLT stylesheet URL:
+          <input id="xsltstylesheet" type="text" value="snorql/xml-to-html.xsl" size="30" />
+        </span></span>
+            <input type="button" value="Go!" onclick="editor.save(); snorql.submitQuery()" />
+        </div>
+    </div>
+
+    <div class="section">
+        <div id="result"><span></span></div>
+    </div>
+
+    <!-- <div id="footer_snorql">Powered by <a id="poweredby" href="#">Snorql</a></div>  -->
+
+    <script type="text/javascript" src="../../webjars/snorql/1.0/snorql.js"></script>
+    <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/2.24/codemirror.js"></script>
+    <script type="text/javascript">
+        jQuery.noConflict();
+    </script>
+
+    <script type="text/javascript">
+        var editor;
+        jQuery(document).ready(function(){
+            jQuery("#querytext").addClass("editor_cm");
+
+            snorql.start();
+
+            editor = CodeMirror.fromTextArea(document.getElementById("querytext"),{
+                lineNumbers : true,
+                matchBrackets : true,
+                tabMode: "indent",
+                extraKeys: {"Ctrl-Space": "sparqlAutocomplete"},
+                mode: "application/x-sparql-query",
+                firstLineNumber: Object.keys(D2R_namespacePrefixes).length + 1
+            });
+
+            jQuery.getJSON("../../../prefix", function(data) {
+                var ns = {};
+                jQuery.each(data, function(prefix, namespace) {
+                    ns[prefix] = namespace;
+                });
+                snorql.setNamespaces(ns);
+                editor.setOption("firstLineNumber", Object.keys(ns).length + 1);
+            });   
+            
+        });
+    </script>    
+    
+</div>
+<!--###END_CONTENT###-->
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/LICENSE
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/LICENSE b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/LICENSE
deleted file mode 100755
index d645695..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/README
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/README b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/README
deleted file mode 100755
index 87a5827..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/README
+++ /dev/null
@@ -1,11 +0,0 @@
-SNORQL is an AJAXy front-end for exploring RDF SPARQL endpoints
-
-It was originally created by Richard Cyganaik ( http://richard.cyganiak.de/ )
-for the D2R server project ( http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/ ).
-
-SNORQL can be used with just about any SPARQL endpoint that supports JSON. To
-use SNORQL simply put the ./snorql directory somwhere sensible in the Apache
-web directory and modify ./snorql/snorql.js to conform with your setup.  You
-can also modify the pre-defined namespaces in ./snorql/namespaces.js
-
-SNORQL is licensed under Apache-2 license (see ./LICENSE ).
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/link.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/link.png b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/link.png
deleted file mode 100755
index 419c06f..0000000
Binary files a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/link.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/snorql/namespaces.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/namespaces.js b/platform/marmotta-sparql/src/main/resources/web/admin/snorql/namespaces.js
deleted file mode 100755
index 7db1f83..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql/namespaces.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var D2R_namespacePrefixes = {
-    rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
-    rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
-    owl: 'http://www.w3.org/2002/07/owl#',
-    skos: 'http://www.w3.org/2004/02/skos/core#',
-    dc: 'http://purl.org/dc/elements/1.1/',
-    foaf: 'http://xmlns.com/foaf/0.1/',
-    xsd: 'http://www.w3.org/2001/XMLSchema#'
-};


[11/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlParser.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlParser.js b/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlParser.js
deleted file mode 100644
index 2827a9f..0000000
--- a/platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/sparqlParser.js
+++ /dev/null
@@ -1,11461 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-sparqlParser = (function(){
-  /* Generated by PEG.js (http://pegjs.majda.cz/). */
-  
-  var result = {
-    /*
-     * Parses the input with a generated parser. If the parsing is successfull,
-     * returns a value explicitly or implicitly specified by the grammar from
-     * which the parser was generated (see |PEG.buildParser|). If the parsing is
-     * unsuccessful, throws |PEG.grammarParser.SyntaxError| describing the error.
-     */
-    parse: function(input) {
-      var pos = 0;
-      var rightmostMatchFailuresPos = 0;
-      var rightmostMatchFailuresExpected = [];
-      var cache = {};
-      
-      function padLeft(input, padding, length) {
-        var result = input;
-        
-        var padLength = length - input.length;
-        for (var i = 0; i < padLength; i++) {
-          result = padding + result;
-        }
-        
-        return result;
-      }
-      
-      function escape(ch) {
-        var charCode = ch.charCodeAt(0);
-        
-        if (charCode <= 0xFF) {
-          var escapeChar = 'x';
-          var length = 2;
-        } else {
-          var escapeChar = 'u';
-          var length = 4;
-        }
-        
-        return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
-      }
-      
-      function quoteString(s) {
-        /*
-         * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
-         * string literal except for the closing quote character, backslash,
-         * carriage return, line separator, paragraph separator, and line feed.
-         * Any character may appear in the form of an escape sequence.
-         */
-        return '"' + s
-          .replace(/\\/g, '\\\\')        // backslash
-          .replace(/"/g, '\\"')          // closing quote character
-          .replace(/\r/g, '\\r')         // carriage return
-          .replace(/\u2028/g, '\\u2028') // line separator
-          .replace(/\u2029/g, '\\u2029') // paragraph separator
-          .replace(/\n/g, '\\n')         // line feed
-          .replace(/[\x80-\uFFFF]/g, escape) // non-ASCII characters
-          + '"';
-      }
-      
-      function arrayContains(array, value) {
-        /*
-         * Stupid IE does not have Array.prototype.indexOf, otherwise this
-         * function would be a one-liner.
-         */
-        var length = array.length;
-        for (var i = 0; i < length; i++) {
-          if (array[i] === value) {
-            return true;
-          }
-        }
-        return false;
-      }
-      
-      function matchFailed(failure) {
-        if (pos < rightmostMatchFailuresPos) {
-          return;
-        }
-        
-        if (pos > rightmostMatchFailuresPos) {
-          rightmostMatchFailuresPos = pos;
-          rightmostMatchFailuresExpected = [];
-        }
-        
-        if (!arrayContains(rightmostMatchFailuresExpected, failure)) {
-          rightmostMatchFailuresExpected.push(failure);
-        }
-      }
-      
-      function parse_query(context) {
-        var cacheKey = "query" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result2 = parse__(context);
-        if (result2 !== null) {
-          var result3 = parse_prologue(context);
-          if (result3 !== null) {
-            var result12 = parse_selectQuery(context);
-            var result11 = result12 !== null
-              ? (function() {return "select";})()
-              : null;
-            if (result11 !== null) {
-              var result4 = result11;
-            } else {
-              var result10 = parse_constructQuery(context);
-              var result9 = result10 !== null
-                ? (function() {return "construct";})()
-                : null;
-              if (result9 !== null) {
-                var result4 = result9;
-              } else {
-                var result8 = parse_describeQuery(context);
-                var result7 = result8 !== null
-                  ? (function() {return "describe";})()
-                  : null;
-                if (result7 !== null) {
-                  var result4 = result7;
-                } else {
-                  var result6 = parse_askQuery(context);
-                  var result5 = result6 !== null
-                    ? (function() {return "ask";})()
-                    : null;
-                  if (result5 !== null) {
-                    var result4 = result5;
-                  } else {
-                    var result4 = null;;
-                  };
-                };
-              };
-            }
-            if (result4 !== null) {
-              var result1 = [result2, result3, result4];
-            } else {
-              var result1 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result1 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result1 = null;
-          pos = savedPos0;
-        }
-        var result0 = result1 !== null
-          ? (function(q) {return q;})(result1[2])
-          : null;
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_prologue(context) {
-        var cacheKey = "prologue" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var savedPos2 = pos;
-        var result7 = parse_baseDecl(context);
-        if (result7 !== null) {
-          var result8 = parse__(context);
-          if (result8 !== null) {
-            var result6 = [result7, result8];
-          } else {
-            var result6 = null;
-            pos = savedPos2;
-          }
-        } else {
-          var result6 = null;
-          pos = savedPos2;
-        }
-        var result1 = result6 !== null ? result6 : '';
-        if (result1 !== null) {
-          var result2 = [];
-          var savedPos1 = pos;
-          var result4 = parse_prefixDecl(context);
-          if (result4 !== null) {
-            var result5 = parse__(context);
-            if (result5 !== null) {
-              var result3 = [result4, result5];
-            } else {
-              var result3 = null;
-              pos = savedPos1;
-            }
-          } else {
-            var result3 = null;
-            pos = savedPos1;
-          }
-          while (result3 !== null) {
-            result2.push(result3);
-            var savedPos1 = pos;
-            var result4 = parse_prefixDecl(context);
-            if (result4 !== null) {
-              var result5 = parse__(context);
-              if (result5 !== null) {
-                var result3 = [result4, result5];
-              } else {
-                var result3 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result3 = null;
-              pos = savedPos1;
-            }
-          }
-          if (result2 !== null) {
-            var result0 = [result1, result2];
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_baseDecl(context) {
-        var cacheKey = "baseDecl" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_BASE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_IRI_REF(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_prefixDecl(context) {
-        var cacheKey = "prefixDecl" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_PREFIX(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_PNAME_NS(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = parse_IRI_REF(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_selectQuery(context) {
-        var cacheKey = "selectQuery" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_SELECT(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos5 = pos;
-            var result25 = parse_DISTINCT(context);
-            if (result25 !== null) {
-              var result26 = parse__(context);
-              if (result26 !== null) {
-                var result24 = [result25, result26];
-              } else {
-                var result24 = null;
-                pos = savedPos5;
-              }
-            } else {
-              var result24 = null;
-              pos = savedPos5;
-            }
-            if (result24 !== null) {
-              var result20 = result24;
-            } else {
-              var savedPos4 = pos;
-              var result22 = parse_REDUCED(context);
-              if (result22 !== null) {
-                var result23 = parse__(context);
-                if (result23 !== null) {
-                  var result21 = [result22, result23];
-                } else {
-                  var result21 = null;
-                  pos = savedPos4;
-                }
-              } else {
-                var result21 = null;
-                pos = savedPos4;
-              }
-              if (result21 !== null) {
-                var result20 = result21;
-              } else {
-                var result20 = null;;
-              };
-            }
-            var result3 = result20 !== null ? result20 : '';
-            if (result3 !== null) {
-              var savedPos3 = pos;
-              var result18 = parse_var(context);
-              if (result18 !== null) {
-                var result19 = parse__(context);
-                if (result19 !== null) {
-                  var result17 = [result18, result19];
-                } else {
-                  var result17 = null;
-                  pos = savedPos3;
-                }
-              } else {
-                var result17 = null;
-                pos = savedPos3;
-              }
-              if (result17 !== null) {
-                var result16 = [];
-                while (result17 !== null) {
-                  result16.push(result17);
-                  var savedPos3 = pos;
-                  var result18 = parse_var(context);
-                  if (result18 !== null) {
-                    var result19 = parse__(context);
-                    if (result19 !== null) {
-                      var result17 = [result18, result19];
-                    } else {
-                      var result17 = null;
-                      pos = savedPos3;
-                    }
-                  } else {
-                    var result17 = null;
-                    pos = savedPos3;
-                  }
-                }
-              } else {
-                var result16 = null;
-              }
-              if (result16 !== null) {
-                var result4 = result16;
-              } else {
-                var savedPos2 = pos;
-                var result14 = parse_ASTERISK(context);
-                if (result14 !== null) {
-                  var result15 = parse__(context);
-                  if (result15 !== null) {
-                    var result13 = [result14, result15];
-                  } else {
-                    var result13 = null;
-                    pos = savedPos2;
-                  }
-                } else {
-                  var result13 = null;
-                  pos = savedPos2;
-                }
-                if (result13 !== null) {
-                  var result4 = result13;
-                } else {
-                  var result4 = null;;
-                };
-              }
-              if (result4 !== null) {
-                var result5 = [];
-                var savedPos1 = pos;
-                var result11 = parse_datasetClause(context);
-                if (result11 !== null) {
-                  var result12 = parse__(context);
-                  if (result12 !== null) {
-                    var result10 = [result11, result12];
-                  } else {
-                    var result10 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result10 = null;
-                  pos = savedPos1;
-                }
-                while (result10 !== null) {
-                  result5.push(result10);
-                  var savedPos1 = pos;
-                  var result11 = parse_datasetClause(context);
-                  if (result11 !== null) {
-                    var result12 = parse__(context);
-                    if (result12 !== null) {
-                      var result10 = [result11, result12];
-                    } else {
-                      var result10 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result10 = null;
-                    pos = savedPos1;
-                  }
-                }
-                if (result5 !== null) {
-                  var result6 = parse_whereClause(context);
-                  if (result6 !== null) {
-                    var result7 = parse__(context);
-                    if (result7 !== null) {
-                      var result8 = parse_solutionModifier(context);
-                      if (result8 !== null) {
-                        var result9 = parse__(context);
-                        if (result9 !== null) {
-                          var result0 = [result1, result2, result3, result4, result5, result6, result7, result8, result9];
-                        } else {
-                          var result0 = null;
-                          pos = savedPos0;
-                        }
-                      } else {
-                        var result0 = null;
-                        pos = savedPos0;
-                      }
-                    } else {
-                      var result0 = null;
-                      pos = savedPos0;
-                    }
-                  } else {
-                    var result0 = null;
-                    pos = savedPos0;
-                  }
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_constructQuery(context) {
-        var cacheKey = "constructQuery" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_CONSTRUCT(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_constructTemplate(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = [];
-                var savedPos1 = pos;
-                var result11 = parse_datasetClause(context);
-                if (result11 !== null) {
-                  var result12 = parse__(context);
-                  if (result12 !== null) {
-                    var result10 = [result11, result12];
-                  } else {
-                    var result10 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result10 = null;
-                  pos = savedPos1;
-                }
-                while (result10 !== null) {
-                  result5.push(result10);
-                  var savedPos1 = pos;
-                  var result11 = parse_datasetClause(context);
-                  if (result11 !== null) {
-                    var result12 = parse__(context);
-                    if (result12 !== null) {
-                      var result10 = [result11, result12];
-                    } else {
-                      var result10 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result10 = null;
-                    pos = savedPos1;
-                  }
-                }
-                if (result5 !== null) {
-                  var result6 = parse_whereClause(context);
-                  if (result6 !== null) {
-                    var result7 = parse__(context);
-                    if (result7 !== null) {
-                      var result8 = parse_solutionModifier(context);
-                      if (result8 !== null) {
-                        var result9 = parse__(context);
-                        if (result9 !== null) {
-                          var result0 = [result1, result2, result3, result4, result5, result6, result7, result8, result9];
-                        } else {
-                          var result0 = null;
-                          pos = savedPos0;
-                        }
-                      } else {
-                        var result0 = null;
-                        pos = savedPos0;
-                      }
-                    } else {
-                      var result0 = null;
-                      pos = savedPos0;
-                    }
-                  } else {
-                    var result0 = null;
-                    pos = savedPos0;
-                  }
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_describeQuery(context) {
-        var cacheKey = "describeQuery" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_DESCRIBE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos4 = pos;
-            var result19 = parse_varOrIRIref(context);
-            if (result19 !== null) {
-              var result20 = parse__(context);
-              if (result20 !== null) {
-                var result18 = [result19, result20];
-              } else {
-                var result18 = null;
-                pos = savedPos4;
-              }
-            } else {
-              var result18 = null;
-              pos = savedPos4;
-            }
-            if (result18 !== null) {
-              var result17 = [];
-              while (result18 !== null) {
-                result17.push(result18);
-                var savedPos4 = pos;
-                var result19 = parse_varOrIRIref(context);
-                if (result19 !== null) {
-                  var result20 = parse__(context);
-                  if (result20 !== null) {
-                    var result18 = [result19, result20];
-                  } else {
-                    var result18 = null;
-                    pos = savedPos4;
-                  }
-                } else {
-                  var result18 = null;
-                  pos = savedPos4;
-                }
-              }
-            } else {
-              var result17 = null;
-            }
-            if (result17 !== null) {
-              var result3 = result17;
-            } else {
-              var savedPos3 = pos;
-              var result15 = parse_ASTERISK(context);
-              if (result15 !== null) {
-                var result16 = parse__(context);
-                if (result16 !== null) {
-                  var result14 = [result15, result16];
-                } else {
-                  var result14 = null;
-                  pos = savedPos3;
-                }
-              } else {
-                var result14 = null;
-                pos = savedPos3;
-              }
-              if (result14 !== null) {
-                var result3 = result14;
-              } else {
-                var result3 = null;;
-              };
-            }
-            if (result3 !== null) {
-              var result4 = [];
-              var savedPos2 = pos;
-              var result12 = parse_datasetClause(context);
-              if (result12 !== null) {
-                var result13 = parse__(context);
-                if (result13 !== null) {
-                  var result11 = [result12, result13];
-                } else {
-                  var result11 = null;
-                  pos = savedPos2;
-                }
-              } else {
-                var result11 = null;
-                pos = savedPos2;
-              }
-              while (result11 !== null) {
-                result4.push(result11);
-                var savedPos2 = pos;
-                var result12 = parse_datasetClause(context);
-                if (result12 !== null) {
-                  var result13 = parse__(context);
-                  if (result13 !== null) {
-                    var result11 = [result12, result13];
-                  } else {
-                    var result11 = null;
-                    pos = savedPos2;
-                  }
-                } else {
-                  var result11 = null;
-                  pos = savedPos2;
-                }
-              }
-              if (result4 !== null) {
-                var savedPos1 = pos;
-                var result9 = parse_whereClause(context);
-                if (result9 !== null) {
-                  var result10 = parse__(context);
-                  if (result10 !== null) {
-                    var result8 = [result9, result10];
-                  } else {
-                    var result8 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result8 = null;
-                  pos = savedPos1;
-                }
-                var result5 = result8 !== null ? result8 : '';
-                if (result5 !== null) {
-                  var result6 = parse_solutionModifier(context);
-                  if (result6 !== null) {
-                    var result7 = parse__(context);
-                    if (result7 !== null) {
-                      var result0 = [result1, result2, result3, result4, result5, result6, result7];
-                    } else {
-                      var result0 = null;
-                      pos = savedPos0;
-                    }
-                  } else {
-                    var result0 = null;
-                    pos = savedPos0;
-                  }
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_askQuery(context) {
-        var cacheKey = "askQuery" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_ASK(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = [];
-            var savedPos1 = pos;
-            var result7 = parse_datasetClause(context);
-            if (result7 !== null) {
-              var result8 = parse__(context);
-              if (result8 !== null) {
-                var result6 = [result7, result8];
-              } else {
-                var result6 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result6 = null;
-              pos = savedPos1;
-            }
-            while (result6 !== null) {
-              result3.push(result6);
-              var savedPos1 = pos;
-              var result7 = parse_datasetClause(context);
-              if (result7 !== null) {
-                var result8 = parse__(context);
-                if (result8 !== null) {
-                  var result6 = [result7, result8];
-                } else {
-                  var result6 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result6 = null;
-                pos = savedPos1;
-              }
-            }
-            if (result3 !== null) {
-              var result4 = parse_whereClause(context);
-              if (result4 !== null) {
-                var result5 = parse__(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_datasetClause(context) {
-        var cacheKey = "datasetClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_FROM(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result5 = parse_iriRef(context);
-            if (result5 !== null) {
-              var result3 = result5;
-            } else {
-              var result4 = parse_namedGraphClause(context);
-              if (result4 !== null) {
-                var result3 = result4;
-              } else {
-                var result3 = null;;
-              };
-            }
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_namedGraphClause(context) {
-        var cacheKey = "namedGraphClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_NAMED(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_iriRef(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_whereClause(context) {
-        var cacheKey = "whereClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var savedPos1 = pos;
-        var result4 = parse_WHERE(context);
-        if (result4 !== null) {
-          var result5 = parse__(context);
-          if (result5 !== null) {
-            var result3 = [result4, result5];
-          } else {
-            var result3 = null;
-            pos = savedPos1;
-          }
-        } else {
-          var result3 = null;
-          pos = savedPos1;
-        }
-        var result1 = result3 !== null ? result3 : '';
-        if (result1 !== null) {
-          var result2 = parse_groupGraphPattern(context);
-          if (result2 !== null) {
-            var result0 = [result1, result2];
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_solutionModifier(context) {
-        var cacheKey = "solutionModifier" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result5 = parse_orderClause(context);
-        var result1 = result5 !== null ? result5 : '';
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result4 = parse_limitOffsetClauses(context);
-            var result3 = result4 !== null ? result4 : '';
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_limitOffsetClauses(context) {
-        var cacheKey = "limitOffsetClauses" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos1 = pos;
-        var result7 = parse_limitClause(context);
-        if (result7 !== null) {
-          var result8 = parse__(context);
-          if (result8 !== null) {
-            var savedPos2 = pos;
-            var result11 = parse_offsetClause(context);
-            if (result11 !== null) {
-              var result12 = parse__(context);
-              if (result12 !== null) {
-                var result10 = [result11, result12];
-              } else {
-                var result10 = null;
-                pos = savedPos2;
-              }
-            } else {
-              var result10 = null;
-              pos = savedPos2;
-            }
-            var result9 = result10 !== null ? result10 : '';
-            if (result9 !== null) {
-              var result6 = [result7, result8, result9];
-            } else {
-              var result6 = null;
-              pos = savedPos1;
-            }
-          } else {
-            var result6 = null;
-            pos = savedPos1;
-          }
-        } else {
-          var result6 = null;
-          pos = savedPos1;
-        }
-        if (result6 !== null) {
-          var result0 = result6;
-        } else {
-          var savedPos0 = pos;
-          var result2 = parse_offsetClause(context);
-          if (result2 !== null) {
-            var result3 = parse__(context);
-            if (result3 !== null) {
-              var result5 = parse_limitClause(context);
-              var result4 = result5 !== null ? result5 : '';
-              if (result4 !== null) {
-                var result1 = [result2, result3, result4];
-              } else {
-                var result1 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result1 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result1 = null;
-            pos = savedPos0;
-          }
-          if (result1 !== null) {
-            var result0 = result1;
-          } else {
-            var result0 = null;;
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_orderClause(context) {
-        var cacheKey = "orderClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_ORDER(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_BY(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result6 = parse_orderCondition(context);
-                if (result6 !== null) {
-                  var result5 = [];
-                  while (result6 !== null) {
-                    result5.push(result6);
-                    var result6 = parse_orderCondition(context);
-                  }
-                } else {
-                  var result5 = null;
-                }
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_orderCondition(context) {
-        var cacheKey = "orderCondition" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result9 = parse_ASC(context);
-        if (result9 !== null) {
-          var result5 = result9;
-        } else {
-          var result8 = parse_DESC(context);
-          if (result8 !== null) {
-            var result5 = result8;
-          } else {
-            var result5 = null;;
-          };
-        }
-        if (result5 !== null) {
-          var result6 = parse__(context);
-          if (result6 !== null) {
-            var result7 = parse_brackettedExpression(context);
-            if (result7 !== null) {
-              var result4 = [result5, result6, result7];
-            } else {
-              var result4 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result4 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result4 = null;
-          pos = savedPos0;
-        }
-        if (result4 !== null) {
-          var result0 = result4;
-        } else {
-          var result3 = parse_constraint(context);
-          if (result3 !== null) {
-            var result1 = result3;
-          } else {
-            var result2 = parse_var(context);
-            if (result2 !== null) {
-              var result1 = result2;
-            } else {
-              var result1 = null;;
-            };
-          }
-          if (result1 !== null) {
-            var result0 = result1;
-          } else {
-            var result0 = null;;
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_limitClause(context) {
-        var cacheKey = "limitClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_LIMIT(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_INTEGER(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_offsetClause(context) {
-        var cacheKey = "offsetClause" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OFFSET(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_INTEGER(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_groupGraphPattern(context) {
-        var cacheKey = "groupGraphPattern" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPEN_CURLY_BRACE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos6 = pos;
-            var result23 = parse_triplesBlock(context);
-            if (result23 !== null) {
-              var result24 = parse__(context);
-              if (result24 !== null) {
-                var result22 = [result23, result24];
-              } else {
-                var result22 = null;
-                pos = savedPos6;
-              }
-            } else {
-              var result22 = null;
-              pos = savedPos6;
-            }
-            var result3 = result22 !== null ? result22 : '';
-            if (result3 !== null) {
-              var result4 = [];
-              var savedPos1 = pos;
-              var savedPos5 = pos;
-              var result20 = parse_graphPatternNotTriples(context);
-              if (result20 !== null) {
-                var result21 = parse__(context);
-                if (result21 !== null) {
-                  var result19 = [result20, result21];
-                } else {
-                  var result19 = null;
-                  pos = savedPos5;
-                }
-              } else {
-                var result19 = null;
-                pos = savedPos5;
-              }
-              if (result19 !== null) {
-                var result7 = result19;
-              } else {
-                var savedPos4 = pos;
-                var result17 = parse_filter(context);
-                if (result17 !== null) {
-                  var result18 = parse__(context);
-                  if (result18 !== null) {
-                    var result16 = [result17, result18];
-                  } else {
-                    var result16 = null;
-                    pos = savedPos4;
-                  }
-                } else {
-                  var result16 = null;
-                  pos = savedPos4;
-                }
-                if (result16 !== null) {
-                  var result7 = result16;
-                } else {
-                  var result7 = null;;
-                };
-              }
-              if (result7 !== null) {
-                var savedPos3 = pos;
-                var result14 = parse_DOT(context);
-                if (result14 !== null) {
-                  var result15 = parse__(context);
-                  if (result15 !== null) {
-                    var result13 = [result14, result15];
-                  } else {
-                    var result13 = null;
-                    pos = savedPos3;
-                  }
-                } else {
-                  var result13 = null;
-                  pos = savedPos3;
-                }
-                var result8 = result13 !== null ? result13 : '';
-                if (result8 !== null) {
-                  var savedPos2 = pos;
-                  var result11 = parse_triplesBlock(context);
-                  if (result11 !== null) {
-                    var result12 = parse__(context);
-                    if (result12 !== null) {
-                      var result10 = [result11, result12];
-                    } else {
-                      var result10 = null;
-                      pos = savedPos2;
-                    }
-                  } else {
-                    var result10 = null;
-                    pos = savedPos2;
-                  }
-                  var result9 = result10 !== null ? result10 : '';
-                  if (result9 !== null) {
-                    var result6 = [result7, result8, result9];
-                  } else {
-                    var result6 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result6 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result6 = null;
-                pos = savedPos1;
-              }
-              while (result6 !== null) {
-                result4.push(result6);
-                var savedPos1 = pos;
-                var savedPos5 = pos;
-                var result20 = parse_graphPatternNotTriples(context);
-                if (result20 !== null) {
-                  var result21 = parse__(context);
-                  if (result21 !== null) {
-                    var result19 = [result20, result21];
-                  } else {
-                    var result19 = null;
-                    pos = savedPos5;
-                  }
-                } else {
-                  var result19 = null;
-                  pos = savedPos5;
-                }
-                if (result19 !== null) {
-                  var result7 = result19;
-                } else {
-                  var savedPos4 = pos;
-                  var result17 = parse_filter(context);
-                  if (result17 !== null) {
-                    var result18 = parse__(context);
-                    if (result18 !== null) {
-                      var result16 = [result17, result18];
-                    } else {
-                      var result16 = null;
-                      pos = savedPos4;
-                    }
-                  } else {
-                    var result16 = null;
-                    pos = savedPos4;
-                  }
-                  if (result16 !== null) {
-                    var result7 = result16;
-                  } else {
-                    var result7 = null;;
-                  };
-                }
-                if (result7 !== null) {
-                  var savedPos3 = pos;
-                  var result14 = parse_DOT(context);
-                  if (result14 !== null) {
-                    var result15 = parse__(context);
-                    if (result15 !== null) {
-                      var result13 = [result14, result15];
-                    } else {
-                      var result13 = null;
-                      pos = savedPos3;
-                    }
-                  } else {
-                    var result13 = null;
-                    pos = savedPos3;
-                  }
-                  var result8 = result13 !== null ? result13 : '';
-                  if (result8 !== null) {
-                    var savedPos2 = pos;
-                    var result11 = parse_triplesBlock(context);
-                    if (result11 !== null) {
-                      var result12 = parse__(context);
-                      if (result12 !== null) {
-                        var result10 = [result11, result12];
-                      } else {
-                        var result10 = null;
-                        pos = savedPos2;
-                      }
-                    } else {
-                      var result10 = null;
-                      pos = savedPos2;
-                    }
-                    var result9 = result10 !== null ? result10 : '';
-                    if (result9 !== null) {
-                      var result6 = [result7, result8, result9];
-                    } else {
-                      var result6 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result6 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result6 = null;
-                  pos = savedPos1;
-                }
-              }
-              if (result4 !== null) {
-                var result5 = parse_CLOSE_CURLY_BRACE(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_triplesBlock(context) {
-        var cacheKey = "triplesBlock" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_triplesSameSubject(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos1 = pos;
-            var result5 = parse_DOT(context);
-            if (result5 !== null) {
-              var result6 = parse__(context);
-              if (result6 !== null) {
-                var savedPos2 = pos;
-                var result9 = parse_triplesBlock(context);
-                if (result9 !== null) {
-                  var result10 = parse__(context);
-                  if (result10 !== null) {
-                    var result8 = [result9, result10];
-                  } else {
-                    var result8 = null;
-                    pos = savedPos2;
-                  }
-                } else {
-                  var result8 = null;
-                  pos = savedPos2;
-                }
-                var result7 = result8 !== null ? result8 : '';
-                if (result7 !== null) {
-                  var result4 = [result5, result6, result7];
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result4 = null;
-              pos = savedPos1;
-            }
-            var result3 = result4 !== null ? result4 : '';
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_graphPatternNotTriples(context) {
-        var cacheKey = "graphPatternNotTriples" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var result3 = parse_optionalGraphPattern(context);
-        if (result3 !== null) {
-          var result0 = result3;
-        } else {
-          var result2 = parse_groupOrUnionGraphPattern(context);
-          if (result2 !== null) {
-            var result0 = result2;
-          } else {
-            var result1 = parse_graphGraphPattern(context);
-            if (result1 !== null) {
-              var result0 = result1;
-            } else {
-              var result0 = null;;
-            };
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_optionalGraphPattern(context) {
-        var cacheKey = "optionalGraphPattern" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPTIONAL(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_groupGraphPattern(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_graphGraphPattern(context) {
-        var cacheKey = "graphGraphPattern" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_GRAPH(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_varOrIRIref(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = parse_groupGraphPattern(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_groupOrUnionGraphPattern(context) {
-        var cacheKey = "groupOrUnionGraphPattern" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_groupGraphPattern(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = [];
-            var savedPos1 = pos;
-            var result5 = parse_UNION(context);
-            if (result5 !== null) {
-              var result6 = parse__(context);
-              if (result6 !== null) {
-                var result7 = parse_groupGraphPattern(context);
-                if (result7 !== null) {
-                  var result8 = parse__(context);
-                  if (result8 !== null) {
-                    var result4 = [result5, result6, result7, result8];
-                  } else {
-                    var result4 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result4 = null;
-              pos = savedPos1;
-            }
-            while (result4 !== null) {
-              result3.push(result4);
-              var savedPos1 = pos;
-              var result5 = parse_UNION(context);
-              if (result5 !== null) {
-                var result6 = parse__(context);
-                if (result6 !== null) {
-                  var result7 = parse_groupGraphPattern(context);
-                  if (result7 !== null) {
-                    var result8 = parse__(context);
-                    if (result8 !== null) {
-                      var result4 = [result5, result6, result7, result8];
-                    } else {
-                      var result4 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result4 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            }
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_filter(context) {
-        var cacheKey = "filter" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_FILTER(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_constraint(context);
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_constraint(context) {
-        var cacheKey = "constraint" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var result3 = parse_brackettedExpression(context);
-        if (result3 !== null) {
-          var result0 = result3;
-        } else {
-          var result2 = parse_builtInCall(context);
-          if (result2 !== null) {
-            var result0 = result2;
-          } else {
-            var result1 = parse_functionCall(context);
-            if (result1 !== null) {
-              var result0 = result1;
-            } else {
-              var result0 = null;;
-            };
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_functionCall(context) {
-        var cacheKey = "functionCall" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_iriRef(context);
-        if (result1 !== null) {
-          var result2 = parse_argList(context);
-          if (result2 !== null) {
-            var result0 = [result1, result2];
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_argList(context) {
-        var cacheKey = "argList" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPEN_BRACE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos1 = pos;
-            var result6 = parse_conditionalOrExpression(context);
-            if (result6 !== null) {
-              var result7 = parse__(context);
-              if (result7 !== null) {
-                var result8 = [];
-                var savedPos2 = pos;
-                var result10 = parse_COMMA(context);
-                if (result10 !== null) {
-                  var result11 = parse__(context);
-                  if (result11 !== null) {
-                    var result12 = parse_conditionalOrExpression(context);
-                    if (result12 !== null) {
-                      var result13 = parse__(context);
-                      if (result13 !== null) {
-                        var result9 = [result10, result11, result12, result13];
-                      } else {
-                        var result9 = null;
-                        pos = savedPos2;
-                      }
-                    } else {
-                      var result9 = null;
-                      pos = savedPos2;
-                    }
-                  } else {
-                    var result9 = null;
-                    pos = savedPos2;
-                  }
-                } else {
-                  var result9 = null;
-                  pos = savedPos2;
-                }
-                while (result9 !== null) {
-                  result8.push(result9);
-                  var savedPos2 = pos;
-                  var result10 = parse_COMMA(context);
-                  if (result10 !== null) {
-                    var result11 = parse__(context);
-                    if (result11 !== null) {
-                      var result12 = parse_conditionalOrExpression(context);
-                      if (result12 !== null) {
-                        var result13 = parse__(context);
-                        if (result13 !== null) {
-                          var result9 = [result10, result11, result12, result13];
-                        } else {
-                          var result9 = null;
-                          pos = savedPos2;
-                        }
-                      } else {
-                        var result9 = null;
-                        pos = savedPos2;
-                      }
-                    } else {
-                      var result9 = null;
-                      pos = savedPos2;
-                    }
-                  } else {
-                    var result9 = null;
-                    pos = savedPos2;
-                  }
-                }
-                if (result8 !== null) {
-                  var result5 = [result6, result7, result8];
-                } else {
-                  var result5 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result5 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result5 = null;
-              pos = savedPos1;
-            }
-            var result3 = result5 !== null ? result5 : '';
-            if (result3 !== null) {
-              var result4 = parse_CLOSE_BRACE(context);
-              if (result4 !== null) {
-                var result0 = [result1, result2, result3, result4];
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_constructTemplate(context) {
-        var cacheKey = "constructTemplate" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPEN_CURLY_BRACE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result6 = parse_constructTriples(context);
-            var result3 = result6 !== null ? result6 : '';
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = parse_CLOSE_CURLY_BRACE(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_constructTriples(context) {
-        var cacheKey = "constructTriples" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_triplesSameSubject(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos1 = pos;
-            var result5 = parse_DOT(context);
-            if (result5 !== null) {
-              var result6 = parse__(context);
-              if (result6 !== null) {
-                var savedPos2 = pos;
-                var result9 = parse_constructTriples(context);
-                if (result9 !== null) {
-                  var result10 = parse__(context);
-                  if (result10 !== null) {
-                    var result8 = [result9, result10];
-                  } else {
-                    var result8 = null;
-                    pos = savedPos2;
-                  }
-                } else {
-                  var result8 = null;
-                  pos = savedPos2;
-                }
-                var result7 = result8 !== null ? result8 : '';
-                if (result7 !== null) {
-                  var result4 = [result5, result6, result7];
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result4 = null;
-              pos = savedPos1;
-            }
-            var result3 = result4 !== null ? result4 : '';
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_triplesSameSubject(context) {
-        var cacheKey = "triplesSameSubject" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos1 = pos;
-        var result6 = parse_varOrTerm(context);
-        if (result6 !== null) {
-          var result7 = parse__(context);
-          if (result7 !== null) {
-            var result8 = parse_propertyListNotEmpty(context);
-            if (result8 !== null) {
-              var result5 = [result6, result7, result8];
-            } else {
-              var result5 = null;
-              pos = savedPos1;
-            }
-          } else {
-            var result5 = null;
-            pos = savedPos1;
-          }
-        } else {
-          var result5 = null;
-          pos = savedPos1;
-        }
-        if (result5 !== null) {
-          var result0 = result5;
-        } else {
-          var savedPos0 = pos;
-          var result2 = parse_triplesNode(context);
-          if (result2 !== null) {
-            var result3 = parse__(context);
-            if (result3 !== null) {
-              var result4 = parse_propertyList(context);
-              if (result4 !== null) {
-                var result1 = [result2, result3, result4];
-              } else {
-                var result1 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result1 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result1 = null;
-            pos = savedPos0;
-          }
-          if (result1 !== null) {
-            var result0 = result1;
-          } else {
-            var result0 = null;;
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_propertyListNotEmpty(context) {
-        var cacheKey = "propertyListNotEmpty" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_verb(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_objectList(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = [];
-                var savedPos1 = pos;
-                var result7 = parse_SEMICOLON(context);
-                if (result7 !== null) {
-                  var result8 = parse__(context);
-                  if (result8 !== null) {
-                    var savedPos2 = pos;
-                    var result11 = parse_verb(context);
-                    if (result11 !== null) {
-                      var result12 = parse__(context);
-                      if (result12 !== null) {
-                        var result13 = parse_objectList(context);
-                        if (result13 !== null) {
-                          var result14 = parse__(context);
-                          if (result14 !== null) {
-                            var result10 = [result11, result12, result13, result14];
-                          } else {
-                            var result10 = null;
-                            pos = savedPos2;
-                          }
-                        } else {
-                          var result10 = null;
-                          pos = savedPos2;
-                        }
-                      } else {
-                        var result10 = null;
-                        pos = savedPos2;
-                      }
-                    } else {
-                      var result10 = null;
-                      pos = savedPos2;
-                    }
-                    var result9 = result10 !== null ? result10 : '';
-                    if (result9 !== null) {
-                      var result6 = [result7, result8, result9];
-                    } else {
-                      var result6 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result6 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result6 = null;
-                  pos = savedPos1;
-                }
-                while (result6 !== null) {
-                  result5.push(result6);
-                  var savedPos1 = pos;
-                  var result7 = parse_SEMICOLON(context);
-                  if (result7 !== null) {
-                    var result8 = parse__(context);
-                    if (result8 !== null) {
-                      var savedPos2 = pos;
-                      var result11 = parse_verb(context);
-                      if (result11 !== null) {
-                        var result12 = parse__(context);
-                        if (result12 !== null) {
-                          var result13 = parse_objectList(context);
-                          if (result13 !== null) {
-                            var result14 = parse__(context);
-                            if (result14 !== null) {
-                              var result10 = [result11, result12, result13, result14];
-                            } else {
-                              var result10 = null;
-                              pos = savedPos2;
-                            }
-                          } else {
-                            var result10 = null;
-                            pos = savedPos2;
-                          }
-                        } else {
-                          var result10 = null;
-                          pos = savedPos2;
-                        }
-                      } else {
-                        var result10 = null;
-                        pos = savedPos2;
-                      }
-                      var result9 = result10 !== null ? result10 : '';
-                      if (result9 !== null) {
-                        var result6 = [result7, result8, result9];
-                      } else {
-                        var result6 = null;
-                        pos = savedPos1;
-                      }
-                    } else {
-                      var result6 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result6 = null;
-                    pos = savedPos1;
-                  }
-                }
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_propertyList(context) {
-        var cacheKey = "propertyList" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var result1 = parse_propertyListNotEmpty(context);
-        var result0 = result1 !== null ? result1 : '';
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_objectList(context) {
-        var cacheKey = "objectList" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_graphNode(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = [];
-            var savedPos1 = pos;
-            var result5 = parse_COMMA(context);
-            if (result5 !== null) {
-              var result6 = parse__(context);
-              if (result6 !== null) {
-                var result7 = parse_graphNode(context);
-                if (result7 !== null) {
-                  var result8 = parse__(context);
-                  if (result8 !== null) {
-                    var result4 = [result5, result6, result7, result8];
-                  } else {
-                    var result4 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result4 = null;
-              pos = savedPos1;
-            }
-            while (result4 !== null) {
-              result3.push(result4);
-              var savedPos1 = pos;
-              var result5 = parse_COMMA(context);
-              if (result5 !== null) {
-                var result6 = parse__(context);
-                if (result6 !== null) {
-                  var result7 = parse_graphNode(context);
-                  if (result7 !== null) {
-                    var result8 = parse__(context);
-                    if (result8 !== null) {
-                      var result4 = [result5, result6, result7, result8];
-                    } else {
-                      var result4 = null;
-                      pos = savedPos1;
-                    }
-                  } else {
-                    var result4 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result4 = null;
-                  pos = savedPos1;
-                }
-              } else {
-                var result4 = null;
-                pos = savedPos1;
-              }
-            }
-            if (result3 !== null) {
-              var result0 = [result1, result2, result3];
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_verb(context) {
-        var cacheKey = "verb" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var result2 = parse_varOrIRIref(context);
-        if (result2 !== null) {
-          var result0 = result2;
-        } else {
-          var result1 = parse_A(context);
-          if (result1 !== null) {
-            var result0 = result1;
-          } else {
-            var result0 = null;;
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_triplesNode(context) {
-        var cacheKey = "triplesNode" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var result2 = parse_collection(context);
-        if (result2 !== null) {
-          var result0 = result2;
-        } else {
-          var result1 = parse_blankNodePropertyList(context);
-          if (result1 !== null) {
-            var result0 = result1;
-          } else {
-            var result0 = null;;
-          };
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_blankNodePropertyList(context) {
-        var cacheKey = "blankNodePropertyList" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPEN_SQUARE_BRACE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var result3 = parse_propertyListNotEmpty(context);
-            if (result3 !== null) {
-              var result4 = parse__(context);
-              if (result4 !== null) {
-                var result5 = parse_CLOSE_SQUARE_BRACE(context);
-                if (result5 !== null) {
-                  var result0 = [result1, result2, result3, result4, result5];
-                } else {
-                  var result0 = null;
-                  pos = savedPos0;
-                }
-              } else {
-                var result0 = null;
-                pos = savedPos0;
-              }
-            } else {
-              var result0 = null;
-              pos = savedPos0;
-            }
-          } else {
-            var result0 = null;
-            pos = savedPos0;
-          }
-        } else {
-          var result0 = null;
-          pos = savedPos0;
-        }
-        
-        
-        
-        cache[cacheKey] = {
-          nextPos: pos,
-          result:  result0
-        };
-        return result0;
-      }
-      
-      function parse_collection(context) {
-        var cacheKey = "collection" + '@' + pos;
-        var cachedResult = cache[cacheKey];
-        if (cachedResult) {
-          pos = cachedResult.nextPos;
-          return cachedResult.result;
-        }
-        
-        
-        var savedPos0 = pos;
-        var result1 = parse_OPEN_BRACE(context);
-        if (result1 !== null) {
-          var result2 = parse__(context);
-          if (result2 !== null) {
-            var savedPos1 = pos;
-            var result6 = parse_graphNode(context);
-            if (result6 !== null) {
-              var result7 = parse__(context);
-              if (result7 !== null) {
-                var result5 = [result6, result7];
-              } else {
-                var result5 = null;
-                pos = savedPos1;
-              }
-            } else {
-              var result5 = null;
-              pos = savedPos1;
-            }
-            if (result5 !== null) {
-              var result3 = [];
-              while (result5 !== null) {
-                result3.push(result5);
-                var savedPos1 = pos;
-                var result6 = parse_graphNode(context);
-                if (result6 !== null) {
-                  var result7 = parse__(context);
-                  if (result7 !== null) {
-                    var result5 = [result6, result7];
-                  } else {
-                    var result5 = null;
-                    pos = savedPos1;
-                  }
-                } else {
-                  var result5 = null;
-                  pos = savedPos1;
-                }
-              }
-            } else {
-              var result3 = null;
-            }
-            if (result3 !== null) {
-              var result4 = parse_CLOSE_BRACE(context);
-              if (result4 !== null) {
-                var result0 = [result1, result2, result3, result4];
-              } else {
-                var result0 = null;
-                p

<TRUNCATED>