From 45665f54cc941eadacd737060bbbf7829a8aa58f Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Mon, 20 Aug 2012 12:03:13 +0000
Subject: [PATCH] Javascript and template cleanup

Mainly removal of the javascript code for the menu, this is now all CSS
driven and much simplified.


git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@599 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
---
 mutalyzer/templates/base/css/style.css      |  95 ++----
 mutalyzer/templates/base/js/index.js        |  58 ----
 mutalyzer/templates/base/js/m.js            |  12 -
 mutalyzer/templates/base/js/menu.js         | 169 ----------
 mutalyzer/templates/check.html              |   3 +-
 mutalyzer/templates/converter.html          |   7 +-
 mutalyzer/templates/descriptionExtract.html |   9 +-
 mutalyzer/templates/menu.html               | 334 +++++---------------
 mutalyzer/templates/parse.html              |  21 +-
 mutalyzer/templates/snp.html                |  19 +-
 mutalyzer/website.py                        |  16 +-
 11 files changed, 137 insertions(+), 606 deletions(-)
 delete mode 100644 mutalyzer/templates/base/js/index.js
 delete mode 100644 mutalyzer/templates/base/js/m.js
 delete mode 100644 mutalyzer/templates/base/js/menu.js

diff --git a/mutalyzer/templates/base/css/style.css b/mutalyzer/templates/base/css/style.css
index 1368c1bb..23e5c2b0 100644
--- a/mutalyzer/templates/base/css/style.css
+++ b/mutalyzer/templates/base/css/style.css
@@ -31,7 +31,7 @@ a:hover {
 	font-weight : bold;
 	text-decoration : none;
 	}
-	
+
 .importanttext {
 	border : 1px solid black;
 	background-color : #717B9D;
@@ -51,7 +51,7 @@ body, div, span, font, td {
 .raTable tr td {
   text-align : right;
   border : 1px solid grey;
-  padding : 0px 4px; 
+  padding : 0px 4px;
 }
 .raTable {
   border : 1px solid grey;
@@ -60,7 +60,7 @@ body, div, span, font, td {
 
 .laTable tr td {
   border : 1px solid grey;
-  padding : 0px 4px; 
+  padding : 0px 4px;
 }
 
 .laTable {
@@ -94,11 +94,6 @@ ul {
 	color: white;
 }
 
-.bullet{
-	left : -15px;
-	position : absolute;
-}
-
 .faculteitsonderdeel {
 	color : #002E65;
 	font-size : 18px;
@@ -165,89 +160,43 @@ ul {
 	padding-top : 1px;
 }
 
-.vertnav {
-	color : #C2C6D5;
-	font-weight : bold;
-	line-height : 18px;
-	text-decoration : none;
-}
-
-.vertnav:link {
-	color : #FFFFFF;
-}
-
-.vertnav:hover {
-	color : #FFFFFF;
-}
-
-.vertnavactive {
-	color : #FFFFFF;
-	font-weight : bold;
-	line-height : 18px;
-	text-decoration : none;
-}
-
-.vertnavactive:hover {
-	color : #FFFFFF;
-	font-weight : bold;
+.menu {
 	line-height : 18px;
-	text-decoration : none;
 }
 
-.vertnavsub {
+.menu a {
 	color : #002E65;
-	line-height : 18px;
 	text-decoration : none;
 }
 
-.vertnavsub:visited {
-	color : #002E65;
-}
-
-.vertnavsub:hover {
+.menu:hover a, .menu a:hover {
 	color : #FFFFFF;
 }
 
-.vertnavsubother {
-	color : #B2D6F5;
-	line-height : 18px;
-	text-decoration : none;
-}
-
-.vertnavsubother:visited {
-	color : #92b6c5;
-}
-
-.vertnavsubother:hover {
+.menu.active a {
 	color : #FFFFFF;
+    font-weight: bold;
 }
 
-.vertnavsubactive {
-	color : #FFFFFF;
-	font-weight : normal;
-	line-height : 18px;
-	text-decoration : none;
+.menu .bullet {
+    height: 22px;
+	background: url('../images/bullitdonker.gif') no-repeat top left;
 }
 
-.vertnavsubactive:hover {
-	color : #FFFFFF;
-	font-weight : normal;
-	line-height : 18px;
-	text-decoration : none;
+.menu .bullet.sub {
+	background-image: url('../images/bullitmiddel.gif');
 }
 
-.vertnavsubinternal {
-	color : #F5D6B2;
-	line-height : 18px;
-	text-decoration : none;
+.menu.active .bullet, .menu:hover .bullet {
+	background-image: url('../images/bullitlicht1.gif');
 }
 
-.vertnavsubinternal:visited {
-	color : #c2b695;
+.menu.active .bullet.sub, .menu:hover .bullet.sub {
+	background-image: url('../images/bullitlicht2.gif');
 }
 
-.vertnavsubinternal:hover {
-	color : #FFFFFF;
+.menu.inactive:hover .bullet {
+	background-image: url('../images/bullitdonker.gif');
 }
 
 #content{
@@ -326,9 +275,9 @@ i {
     background-image: url('../images/error.png');
 }
 
-.thnormal {  
-	font-family: Arial, Helvetica, sans-serif; 
-	font-weight: bold; 
+.thnormal {
+	font-family: Arial, Helvetica, sans-serif;
+	font-weight: bold;
 	color: #FFFFFF;
 	background-color : #002E65;
 }
diff --git a/mutalyzer/templates/base/js/index.js b/mutalyzer/templates/base/js/index.js
deleted file mode 100644
index 06a6d24e..00000000
--- a/mutalyzer/templates/base/js/index.js
+++ /dev/null
@@ -1,58 +0,0 @@
-<!--
-
-// --- GET ELEMENT(LAYERREFERENCE) ---
-function getElt ()
-{
-  if (document.layers)
-  { var currentLayer = document.layers[getElt.arguments[0]];
-    for (var i = 1; i < getElt.arguments.length && currentLayer; i++)
-    { currentLayer = currentLayer.document.layers[getElt.arguments[i]];
-    }
-    return currentLayer;
-  }
-  else if (document.all)
-  { var elt = eval('document.all.' + getElt.arguments[getElt.arguments.length - 1]);
-    return(elt);
-  }
-  else if (document.getElementById)
-  { var elt = document.getElementById(getElt.arguments[getElt.arguments.length - 1]);
-    return(elt);
-  }
-}
-
-// --- IMAGE SWAP ---
-function swapImage(imgSrc, imgID, elt)
-{
-  if (document.getElementsByName)
-  { var img = document.getElementsByName(imgID);
-    img[0].src = imgSrc;
-  }
-  else
-  { if (swapImage.arguments.length == 3)
-    { eval("elt.document." + imgID + ".src = '" + imgSrc + "'");
-    }
-    else
-    { eval("document." + imgID + ".src = '" + imgSrc + "'");
-    }
-  }
-}
-
-// --- IMAGE PRELOAD ---
-function preloadImages()
-{
-  if (document.images)
-  { var imgStr = preloadImages.arguments;
-    if (!document.preloadArray)
-    { document.preloadArray = new Array();
-    }
-
-    var n = document.preloadArray.length;
-    for (var i = 0; i < preloadImages.arguments.length; i++)
-    { document.preloadArray[n] = new Image;
-      document.preloadArray[n].src = imgStr[i];
-      n++;
-    }
-  }
-}
-
-// -->
diff --git a/mutalyzer/templates/base/js/m.js b/mutalyzer/templates/base/js/m.js
deleted file mode 100644
index 9ad5ceed..00000000
--- a/mutalyzer/templates/base/js/m.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function s(p0, p1, p2)
-{
-  parent.location = 'm' + 'ailto:' + p1 + '@' + p0 + '.' + p2;
-  return true;
-}
-
-function ms(p0, p1, p2)
-{
-  window.status = 'm'+'ail'+'to:' + p1 + '@' + p0 + '.' + p2;
-  return true;
-}
-
diff --git a/mutalyzer/templates/base/js/menu.js b/mutalyzer/templates/base/js/menu.js
deleted file mode 100644
index 563bd5c4..00000000
--- a/mutalyzer/templates/base/js/menu.js
+++ /dev/null
@@ -1,169 +0,0 @@
-var a_Act;
-var a_navAct;
-var timerID;
-var timerImg;
-
-function setFont(font, hrefID) {
-  document.getElementById(hrefID).className = font;
-}//setFont
-
-function setImage(imgSrc, imgID) {
-  document.getElementById(imgID).src = imgSrc;
-}//setImage
-
-function setSub(state, subID) {
-  var subElt = document.getElementById(subID + "_0");
-  var i = 1;
-
-  while (subElt) {
-    subElt.style.display = state;
-    subElt = document.getElementById(subID + "_" + i);
-    i++;
-  }//while
-}//setSub
-
-function setActive(newAct) {
-  if (document.getElementById("page_" + newAct)) {
-    if (newAct.match("_")) {
-      setFont("vertnavsubactive", "page_" + newAct);
-      setImage("base/images/bullitlicht2.gif", "b_" + newAct);
-    }//if
-    else {
-      setFont("vertnavactive", "page_" + newAct);
-      setImage("base/images/bullitlicht1.gif", "b_" + newAct);
-    }//else
-  
-    setSub("", newAct);
-  }//if
-}//setActive
-
-function setNavActive(newAct) {
-  if (document.getElementById("page_" + newAct)) {
-    if (newAct.match("_"))
-      setImage("base/images/bullitlicht2.gif", "b_" + newAct);
-    else
-      setImage("base/images/bullitlicht1.gif", "b_" + newAct);
-  
-    setSub("", newAct);
-  }//if
-}//setNavActive
-
-function setDeActive(oldAct) {
-  if (document.getElementById("page_" + oldAct)) {
-    setFont("vertnavsub", "page_" + oldAct);
-  
-    if (oldAct.match("_"))
-      setImage("base/images/bullitmiddel.gif", "b_" + oldAct);
-    else
-      setImage("base/images/bullitdonker.gif", "b_" + oldAct);
-  }//if
-}//setDeActive
-
-function alterActive(a_Alter, method) {
-  var Label = a_Alter[0];
-  var i;
-
-  for (i = 1; i <= a_Alter.length; i++) {
-    if (method)
-      setActive(Label);
-    else {
-      setDeActive(Label);
-      setSub("none", Label);
-    }//else
-    Label = Label + "_" + a_Alter[i];
-  }//for
-}//alterActive
-
-function alterNavActive(a_Alter, method) {
-  var Label = a_Alter[0];
-  var i;
-
-  for (i = 1; i <= a_Alter.length; i++) {
-    if (method)
-      setNavActive(Label);
-    else
-      setDeActive(Label);
-    Label = Label + "_" + a_Alter[i];
-  }//for
-}//alterNavActive
-
-function navPartDeAct() {
-  alterNavActive(a_navAct, 0);
-  alterActive(a_Act, 1);
-}//navPartDeAct
-
-function swapActive(newAct) {
-  var a_newAct = newAct.split("_");
-
-  alterActive(a_Act, 0);
-  alterActive(a_newAct, 1);
-
-  a_Act = a_newAct;
-  a_navAct = a_newAct;
-}//swapActive
-
-function swapNavActive() {
-  var a_newAct = timerImg.split("_");
-
-  navPartDeAct();
-  alterActive(a_newAct, 1);
-
-  a_navAct = a_newAct;
-}//swapNavActive
-
-function navAct(imgSrc, imgID) {
-  clearTimeout(timerID);
-
-  timerImg = imgID;
-  timerID = setTimeout("swapNavActive();", 500);
-}//navAct
-
-function navDeAct(imgSrc, imgID) {
-  clearTimeout(timerID);
-
-  timerID = setTimeout("navPartDeAct();", 2000);
-}//navDeAct
-
-function initActive() {
-  var winLoc;
-
-  winLoc = window.location.href;
-  winLoc = winLoc.replace(/https?:\/\/[^\/]*\//, "");
-
-  if (winLoc.match("~"))
-    winLoc = winLoc.replace(/[^\/]*\//, "");
-  else
-    winLoc = winLoc.replace(/[^\/]*\/[^\/]*\//, "");
-
-  winLoc = winLoc.replace(/\.cgi$/, "");
-  winLoc = winLoc.replace(/index\.shtml/, "");
-  winLoc = winLoc.replace(/\/$/, "");
-  winLoc = winLoc.replace("#", "");
-
-  a_Act = winLoc.split("/");
-  // This is a Quick Hack (tm)
-  if (a_Act[0] == '2.0' || a_Act[0] == 'mutalyzer')
-    a_Act.shift();
-  a_navAct = a_Act;
-
-  alterActive(a_Act, 1);
-}//initActive
-
-function resetAll() {
-  var a_Menu = document.getElementsByTagName("tr");
-  var i;
-
-  for (i = 0; i < a_Menu.length; i++)
-    if (a_Menu[i].id.match("_"))
-      a_Menu[i].style.display = "none";
-
-  navPartDeAct();
-}//resetAll
-
-function clearForm(form, elementName) {
-  for (i = 0; i < form.elements.length; i++) {
-    if (form.elements[i].name == elementName) {
-      form.elements[i].value = "";
-    }//if
-  }//for
-}//clearForm
diff --git a/mutalyzer/templates/check.html b/mutalyzer/templates/check.html
index 89da7bb0..b666ecd5 100644
--- a/mutalyzer/templates/check.html
+++ b/mutalyzer/templates/check.html
@@ -31,8 +31,7 @@
               style = "width:100%"
             ><br>
             <input type="submit" value="Submit">
-            <input type="button" value="Clear field"
-                   onClick = "clearForm(this.form, 'name');">
+            <input type="reset" value="Clear field">
           </form>
         </div>
         <div tal:condition = "visualisation">
diff --git a/mutalyzer/templates/converter.html b/mutalyzer/templates/converter.html
index d1bc1c4b..c238eb6f 100644
--- a/mutalyzer/templates/converter.html
+++ b/mutalyzer/templates/converter.html
@@ -30,16 +30,15 @@
                 </tr>
                 <tr>
                     <td><b>Variant</b></td>
-                    <td><input type = "text" 
-                               name = "variant" 
+                    <td><input type = "text"
+                               name = "variant"
                                tal:attributes = "value variant"
                                style = "width:500px"></td>
                 </tr>
                 <tr>
                     <td colspan="2">
                       <input type="submit" value="Submit">
-                      <input type="button" value="Clear field" 
-                             onClick = "clearForm(this.form, 'variant');">
+                      <input type="reset" value="Clear field">
                     </td>
 
                 </tr>
diff --git a/mutalyzer/templates/descriptionExtract.html b/mutalyzer/templates/descriptionExtract.html
index 26c5f8a8..0a3794c0 100644
--- a/mutalyzer/templates/descriptionExtract.html
+++ b/mutalyzer/templates/descriptionExtract.html
@@ -47,9 +47,7 @@
               name = "referenceSeq"
               tal:attributes = "value lastReferenceSeq"
               style = "width:100%"
-            ><br>
-          <input type="button" value="Clear field"
-                 onClick = "clearForm(this.form, 'referenceSeq');"><br>
+            >
           </div>
           <br>
           <div style="border: 1px solid grey; padding: 20px">
@@ -62,12 +60,11 @@
               name = "variantSeq"
               tal:attributes = "value lastVariantSeq"
               style = "width:100%"
-            ><br>
-            <input type="button" value="Clear field"
-                   onClick = "clearForm(this.form, 'variantSeq');"><br>
+            >
           </div>
           <br>
           <input type="submit" value="Submit">
+          <input type="reset" value="Clear fields">
         </form>
       </div>
       <div tal:condition = "description">
diff --git a/mutalyzer/templates/menu.html b/mutalyzer/templates/menu.html
index 38544d0e..cd1665f3 100644
--- a/mutalyzer/templates/menu.html
+++ b/mutalyzer/templates/menu.html
@@ -6,16 +6,6 @@
     <link rel="stylesheet"
       type="text/css"
       href="base/css/style.css">
-    <script
-      type="text/javascript"
-      language="JavaScript"
-      src="base/js/index.js">
-    </script>
-    <script
-      type="text/javascript"
-      language="javascript"
-      src="base/js/menu.js">
-    </script>
     <script
       type="text/javascript"
       language="javascript"
@@ -36,12 +26,7 @@
     leftmargin="0"
     topmargin="0"
     marginwidth="0"
-    marginheight="0"
-    onload="initActive();
-            preloadImages('base/images/bullitlicht1.gif',
-                          'base/images/bullitlicht2.gif',
-                          'base/images/mutalyzer_logo_bw.png',
-                          'base/images/mutalyzer_logo.png');">
+    marginheight="0">
     <!-- Header -->
     <a id = "top" name = "top"></a>
 
@@ -126,353 +111,186 @@
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_index">
-        </td>
+      <tr tal:attributes="class active/index">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_index"
-            onclick="swapActive('index');"
-            href="index"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'index');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'index');"
-            class="vertnavsub">Home</a>
+          <a href="index">Home</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_check">
-        </td>
+      <tr tal:attributes="class active/check">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_check"
-            onclick="swapActive('check');"
-            href="check"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'check');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'check');"
-            class="vertnavsub">Name Checker</a>
+          <a href="check">Name Checker</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_syntaxCheck">
-        </td>
+      <tr tal:attributes="class active/parse">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_syntaxCheck"
-            onclick="swapActive('syntaxCheck');"
-            href="syntaxCheck"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'syntaxCheck');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'syntaxCheck');"
-            class="vertnavsub">Syntax Checker</a>
+          <a href="syntaxCheck">Syntax Checker</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_positionConverter">
-        </td>
+      <tr tal:attributes="class active/converter">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_positionConverter"
-            onclick="swapActive('positionConverter');"
-            href="positionConverter"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'positionConverter');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'positionConverter');"
-            class="vertnavsub">Position Converter</a>
+          <a href="positionConverter">Position Converter</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_snp">
-        </td>
+      <tr tal:attributes="class active/snp">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_snp"
-            onclick="swapActive('snp');"
-            href="snp"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'snp');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'snp');"
-            class="vertnavsub">SNP Converter</a>
+          <a href="snp">SNP Converter</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_nameGenerator">
-        </td>
+      <tr tal:attributes="class active/nameGenerator">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_nameGenerator"
-            onclick="swapActive('nameGenerator');"
-            href="nameGenerator"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'nameGenerator');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'nameGenerator');"
-            class="vertnavsub">Name Generator</a>
+          <a href="nameGenerator">Name Generator</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_descriptionExtract">
-        </td>
+      <tr tal:attributes="class active/descriptionExtract">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_descriptionExtract"
-            onclick="swapActive('descriptionExtract');"
-            href="descriptionExtract"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'descriptionExtract');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'descriptionExtract');"
-            class="vertnavsub">Description Extractor</a>
+          <a href="descriptionExtract">Description Extractor</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_upload">
-        </td>
+      <tr tal:attributes="class active/gbupload">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_upload"
-            onclick="swapActive('upload');"
-            href="upload"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'upload');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'upload');"
-            class="vertnavsub">Reference File Loader</a>
+          <a href="upload">Reference File Loader</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_batch">
-        </td>
+      <tr tal:attributes="class active/batch">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_batch"
-            onclick="swapActive('batch');"
-            href="batch"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'batch');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'batch');"
-            class="vertnavsub">Batch Jobs</a>
+          <a href="batch">Batch Jobs</a>
         </td>
       </tr>
 
-      <tr>
+      <tr tal:attributes="class active/batchNameChecker">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_batchNameChecker">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_batchNameChecker"
-            href="batchNameChecker"
-            class="vertnavsub">Name Checker</a>
+          <a href="batchNameChecker">Name Checker</a>
         </td>
       </tr>
 
-      <tr>
+      <tr tal:attributes="class active/batchSyntaxChecker">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_batchSyntaxChecker">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_batchSyntaxChecker"
-            href="batchSyntaxChecker"
-            class="vertnavsub">Syntax Checker</a>
+          <a href="batchSyntaxChecker">Syntax Checker</a>
         </td>
       </tr>
 
-      <tr>
+      <tr tal:attributes="class active/batchPositionConverter">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_batchPositionConverter">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_batchPositionConverter"
-            href="batchPositionConverter"
-            class="vertnavsub">Position Converter</a>
+          <a href="batchPositionConverter">Position Converter</a>
         </td>
       </tr>
 
-      <tr>
+      <tr tal:attributes="class active/batchSnpConverter">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_batchSnpConverter">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_batchSnpConverter"
-            href="batchSnpConverter"
-            class="vertnavsub">SNP Converter</a>
+          <a href="batchSnpConverter">SNP Converter</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_webservices">
-        </td>
+      <tr tal:attributes="class active/webservices">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_webservices"
-            onclick="swapActive('webservices');"
-            href="webservices"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'webservices');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'webservices');"
-            class="vertnavsub">Webservices</a>
+          <a href="webservices">Webservices</a>
         </td>
       </tr>
 
       <tr><td>&nbsp;</td></tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_help">
-        </td>
+      <tr tal:attributes="class active/help">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_help"
-            onclick="swapActive('help');"
-            href="help"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'help');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'help');"
-            class="vertnavsub">Help</a>
+          <a href="help">Help</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_faq">
-        </td>
+      <tr tal:attributes="class active/faq">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_faq"
-            onclick="swapActive('faq');"
-            href="faq"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'faq');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'faq');"
-            class="vertnavsub">FAQ</a>
+          <a href="faq">FAQ</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_exercise">
-        </td>
+      <tr tal:attributes="class active/exercise">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_exercise"
-            onclick="swapActive('exercise');"
-            href="exercise"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'exercise');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'exercise');"
-            class="vertnavsub">Exercise</a>
+          <a href="exercise">Exercise</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_disclaimer">
-        </td>
+      <tr tal:attributes="class active/disclaimer">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_disclaimer"
-            onclick="swapActive('disclaimer');"
-            href="disclaimer"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'disclaimer');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'disclaimer');"
-            class="vertnavsub">Disclaimer</a>
+          <a href="disclaimer">Disclaimer</a>
         </td>
       </tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_bugTrack">
-        </td>
+      <tr class="menu">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
-          <a id="page_bugTrack"
-            onclick="swapActive('bugTrack');"
-            href="https://humgenprojects.lumc.nl/trac/mutalyzer"
-            onmouseover="navAct('base/images/bullitlicht1.gif',
-                                'bugTrack');"
-            onmouseout="navDeAct('base/images/bullitdonker.gif',
-                                 'bugTrack');"
-            class="vertnavsub">Feedback</a>
+          <a href="https://humgenprojects.lumc.nl/trac/mutalyzer">Feedback</a>
         </td>
       </tr>
 
       <tr><td>&nbsp;</td></tr>
 
-      <tr>
-        <td valign="top" width="20">
-          <img src="base/images/bullitdonker.gif" id="b_external">
-        </td>
+      <tr class="menu inactive">
+        <td valign="top" width="20" class="bullet"></td>
         <td colspan="3">
           External Links
         </td>
       </tr>
 
-      <tr>
+      <tr class="menu">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_external_hgb">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_external_hgb"
-            href="http://www.genenames.org/guidelines.html"
-            class="vertnavsub">Human Gene Nomenclature</a>
+          <a href="http://www.genenames.org/guidelines.html"
+           >Human Gene Nomenclature</a>
         </td>
       </tr>
 
-      <tr>
+      <tr class="menu">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_external_hgvs">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_external_hgvs"
-            href="http://www.hgvs.org/mutnomen/"
-            class="vertnavsub">HGVS Variation Nomenclature</a>
+          <a href="http://www.hgvs.org/mutnomen/"
+           >HGVS Variation Nomenclature</a>
         </td>
       </tr>
 
-      <tr>
+      <tr class="menu">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_external_hgvsext">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_external_hgvsext"
-            href="http://www.hgvs.org/mutnomen/HGVS_extend_PT.doc"
-            class="vertnavsub">HGVS Nomenclature Extension Proposal</a>
+          <a href="http://www.hgvs.org/mutnomen/HGVS_extend_PT.doc"
+           >HGVS Nomenclature Extension Proposal</a>
         </td>
       </tr>
 
-      <tr>
+      <tr class="menu">
         <td></td>
-        <td valign="baseline" width="10">
-          <img src="base/images/bullitmiddel.gif" id="b_external_lovd">
-        </td>
+        <td valign="baseline" width="10" class="bullet sub"></td>
         <td colspan="2">
-          <a id="page_external_lovd"
-            onclick="swapActive('external_lovd');"
-            href="http://www.lovd.nl/"
-            class="vertnavsub">LOVD</a>
+          <a href="http://www.lovd.nl/">LOVD</a>
         </td>
       </tr>
 
@@ -516,7 +334,7 @@
     <!-- Content -->
 
     <table cellpadding="0" cellspacing="0" width="100%" border="0">
-    <tbody onMouseover="resetAll();"><tr>
+    <tbody><tr>
     <td width="0"></td>
     <td width="0">
 
diff --git a/mutalyzer/templates/parse.html b/mutalyzer/templates/parse.html
index 9a530dec..a0d1a696 100644
--- a/mutalyzer/templates/parse.html
+++ b/mutalyzer/templates/parse.html
@@ -12,27 +12,26 @@
       </center>
       <div style="border: 1px solid grey; background-color: aliceblue; padding: 20px;">
         <div>
-        Please insert the mutation name using the 
+        Please insert the mutation name using the
         <span class = "helper" title =
           "Human Genome Variation Society standard variant nomenclature">
           <a href = "http://www.hgvs.org/mutnomen">HGVS</a> format</span>:<br>
-          &lt;Accession Number&gt;.&lt;version 
-          number&gt;(&lt;Gene symbol&gt;):&lt;sequence 
+          &lt;Accession Number&gt;.&lt;version
+          number&gt;(&lt;Gene symbol&gt;):&lt;sequence
           type&gt;.&lt;mutation&gt;
         </div><br>
         Example: AB026906.1:c.274G&gt;T<br>
         <br>
         <form action = "" method = "post">
-          <input 
-            type = "text" 
-            name = "variant" 
+          <input
+            type = "text"
+            name = "variant"
             tal:attributes = "value variant"
             style = "width:100%"><br>
-          <input 
-            type="submit" 
+          <input
+            type="submit"
             value="Submit">
-          <input type="button" value="Clear field" 
-                 onClick = "clearForm(this.form, 'variant');">
+          <input type="reset" value="Clear field">
         </form>
         <br>
       </div>
@@ -47,7 +46,7 @@
             <br>
           </div>
           <h4>Details of the parse error:</h4>
-          <pre tal:content = 
+          <pre tal:content =
             "structure string:${parseError/0}<br>${parseError/1}">
           </pre>
           The &quot;^&quot; indicates the position where the error occurred.
diff --git a/mutalyzer/templates/snp.html b/mutalyzer/templates/snp.html
index 1b3c513d..9f7086c4 100644
--- a/mutalyzer/templates/snp.html
+++ b/mutalyzer/templates/snp.html
@@ -1,7 +1,7 @@
 <html>
   <head>
-    <link rel="stylesheet" 
-      type="text/css" 
+    <link rel="stylesheet"
+      type="text/css"
       href="base/css/style.css">
     <title></title>
   </head>
@@ -11,7 +11,7 @@
         <h3>SNP converter</h3>
       </center>
       <div style="border: 1px solid grey; background-color: aliceblue; padding: 20px;">
-        Please insert the 
+        Please insert the
         <a href = "http://www.ncbi.nlm.nih.gov/projects/SNP/">dbSNP</a> rs
         number below. Mutalyzer will retrieve the HGVS description of the SNP
         specified on the reference sequence(s) used by dbSNP.<br>
@@ -19,17 +19,16 @@
         Example: rs9919552<br>
         <br>
         <form action = "" method = "post">
-          <input 
-            type = "text" 
-            name = "rsId" 
+          <input
+            type = "text"
+            name = "rsId"
             style = "width:25%"
           ><br>
-          <input 
-            type="submit" 
+          <input
+            type="submit"
             value="Submit"
           >
-          <input type="button" value="Clear field" 
-                 onClick = "clearForm(this.form, 'rsId');">
+          <input type="reset" value="Clear field">
         </form>
       </div>
       <div tal:condition = "lastpost">
diff --git a/mutalyzer/website.py b/mutalyzer/website.py
index 89ee649d..98700930 100644
--- a/mutalyzer/website.py
+++ b/mutalyzer/website.py
@@ -24,6 +24,7 @@ import os
 import bz2
 import web
 import urllib
+from collections import defaultdict
 
 from lxml import etree
 from cStringIO import StringIO
@@ -109,7 +110,7 @@ class render_tal:
         filename = name
 
         def template(args={}, scheme='html', standalone=False,
-                     prevent_caching=False):
+                     prevent_caching=False, page=None):
             """
             Template render function.
 
@@ -126,6 +127,7 @@ class render_tal:
                                argument for template.
             @return: Render of template.
             """
+            page = page or filename
             file = filename
             if scheme == 'html':
                 file += '.html'
@@ -150,6 +152,11 @@ class render_tal:
             # Wrap in site layout with menu
             if scheme == 'html' and not standalone:
                 context.addGlobal('sitemacros', template)
+                # The following three lines are a hack to get class="active"
+                # on the active menu item, working around TAL.
+                active = defaultdict(lambda: 'menu')
+                active[page] = 'menu active'
+                context.addGlobal('active', active)
                 templateFile = open(os.path.join(self.path, 'menu.html'), 'r')
                 template = simpleTAL.compileHTMLTemplate(templateFile)
                 templateFile.close()
@@ -1133,7 +1140,10 @@ class BatchChecker:
         }
 
         # Make sure the correct page is displayed for an entrypoint
-        if not batchType:
+        if batchType:
+            page = 'batch' + batchType
+        else:
+            page = 'batch'
             batchType = 'NameChecker'
 
         if batchType in attr["batchTypes"]:
@@ -1186,7 +1196,7 @@ class BatchChecker:
 
             attr["errors"].extend(map(util.message_info, O.getMessages()))
 
-        return render.batch(attr)
+        return render.batch(attr, page=page)
     #batch
 #BatchChecker
 
-- 
GitLab