2 // Javascript for page elements.
4 // Part of the Routino routing software.
6 // This file Copyright 2008,2009 Andrew M. Bishop
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 // Display one of the tabs and associated DIV and hide the others
27 function tab_select(name)
29 var tab=document.getElementById("tab_" + name);
31 if(tab.className=="tab_selected")
34 // Hide the deslected tabs and DIVs
36 var parent=tab.parentNode;
37 var child=parent.firstChild;
41 if(String(child.id).substr(0,4)=="tab_")
43 var div=document.getElementById(child.id + "_div");
45 child.className="tab_unselected";
46 div.style.display="none";
49 child=child.nextSibling;
53 // Display the newly selected tab and DIV
55 var div=document.getElementById(tab.id + "_div");
57 tab.className="tab_selected";
63 // Show the associated DIV
66 function hideshow_show(name)
68 var span1=document.getElementById("hideshow_" + name + "_show");
69 var span2=document.getElementById("hideshow_" + name + "_hide");
70 var div=document.getElementById("hideshow_" + name + "_div");
73 span1.className="hideshow_hide";
74 span2.className="hideshow_show";
79 // Hide the associated DIV
82 function hideshow_hide(name)
84 var span1=document.getElementById("hideshow_" + name + "_show");
85 var span2=document.getElementById("hideshow_" + name + "_hide");
86 var div=document.getElementById("hideshow_" + name + "_div");
88 div.style.display="none";
89 span2.className="hideshow_hide";
90 span1.className="hideshow_show";