new version (removed slice2.php, nodes2.php, fixed bug related to
[plewww.git] / plekit / table / columns.js
1
2 /* $Id: column.js Panos $ */
3
4 var filtered_color = "grey";
5 var normal_color = "black";
6
7 //Descriptions overriding the default ones set in Accessors_site.py and configuration 
8
9 var sourceComon = '<a target="source_window" href="http://comon.cs.princeton.edu/">CoMon</a>';
10 var sourceTophat = '<b><a target="source_window" href="http://www.top-hat.info/">TopHat</a></b>';
11 var sourceTophatAPI = '<b><a target="source_window" href="http://www.top-hat.info/API/">TopHat API</a></b>';
12 var sourceMySlice = '<b><a target="source_window" href="http://myslice.info/">MySlice</a></b>';
13 var sourceCymru = '<b><a target="source_window" href="http://www.team-cymru.org/">Team Cymru</a></b>';
14 var sourceMyPLC = '<b><a target="source_window" href="https://www.planet-lab.eu/db/doc/PLCAPI.php">MyPLC API</a></b>';
15 var sourceManiacs = '<b><a target="source_window" href="http://www.ece.gatech.edu/research/labs/MANIACS/as_taxonomy/">MANIACS</a></b>';
16 var sourceMaxmind = '<b><a target="source_window" href="http://www.maxmind.com/app/geolitecity">MaxMind</a></b>';
17 var sourceMonitor = '<b><a target="source_window" href="http://monitor.planet-lab.org/">Monitor</a></b>';
18 var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateDefaultConf(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option></select>';
19 var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
20 var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
21
22 var descHOSTNAME = "test";
23
24 var titleA = 'Architecture name';
25 var detailA = '<i>The node architecture.</i>';
26 var sourceA = '<b>Source:</b> '+sourceMyPLC;
27 var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>';
28 var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
29
30 var titlef = 'Operating system';
31 var detailf = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
32 var sourcef = '<b>Source:</b> '+sourceMyPLC;
33 var descf = '<span class="myslice title">'+titlef+'</span><p>'+detailf+'<p>'+sourcef;
34
35 var titleAU = 'Authority';
36 var detailAU = '<i>The authority of the global PlanetLab federation that the site of the node belongs to.</i>';
37 var valuesAU = 'Values: <b>PLC</b> (PlanetLab Central), <b>PLE</b> (PlanetLab Europe)';
38 var sourceAU = '<b>Source:</b> '+sourceMyPLC;
39 var descAU = '<span class="myslice title">'+titleAU+'</span><p>'+detailAU+'<p>'+valuesAU+'<p>'+sourceAU;
40
41 var titleAS = 'Autonomous system ID';
42 var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')';
43 var valuesAS = 'Unit: <b>Integer between 0 and 65535</b>';
44 var descAS = '<span class="myslice title">'+titleAS+'</span><p>'+valuesAS+'<p>' + sourceAS;
45
46 var titleAST = 'Autonomous system type';
47 var sourceAST = 'Source: '+sourceManiacs;
48 var valuesAST = 'Values: <b>t1</b> (tier-1), <b>t2</b> (tier-2), <b>edu</b> (university), <b>comp</b> (company), <b>nic</b> (network information centre -- old name for a domain name registry operator), <b>ix</b> (IXP), <b>n/a</b>';
49 var descAST = '<span class="myslice title">'+titleAST+'</span><p>'+valuesAST+'<p>'+sourceAST;
50
51 var titleASN = 'Autonomous system name';
52 var sourceASN = 'Source: '+sourceTophat;
53 var descASN = '<span class="myslice title">'+titleASN+'</span><p>'+sourceASN;
54
55 var selectPeriodBU = 'Select period: <select id="selectperiodBU" onChange=updatePeriod("BU",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
56 var titleBU = 'Bandwidth utilization ';
57 var sourceBU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
58 var valuesBU ='Unit: <b>Kbps</b>';
59 var detailBU = '<i>The average transmited bandwidh over the selected period. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>'
60 var descBU = '<span class="myslice title">'+titleBU+'</span><p>'+detailBU+'<p>'+selectPeriodBU+'<p>'+valuesBU+'<p>'+sourceBU; 
61
62 var titleBW= 'Bandwidth limit';
63 var sourceBW = 'Source: '+sourceComon;
64 var valuesBW = 'Unit: <b>Kbps</b>';
65 var detailBW = '<i>The bandwidth limit is a cap on the total outbound bandwidth usage of a node. It is set by the site administrator (PI). For more details see <a targe="source_window" href="http://www.planet-lab.org/doc/BandwidthLimits">Bandwidth Limits (planet-lab.org)</a></i>.';
66 var descBW = '<span class="myslice title">'+titleBW+'</span><p>'+detailBW+'<p>'+valuesBW+'<p>'+sourceBW;
67
68 var titleCC = 'Number of CPU cores';
69 var sourceCC = 'Source: '+sourceComon;
70 var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min. <br><i>(Older nodes may have fewer cores)</i>.';
71 var descCC = '<span class="myslice title">'+titleCC+'</span><p>'+valuesCC+'<p>'+sourceCC;
72
73 var titleCN = 'Number of CPUs';
74 var sourceCN = 'Source: '+sourceComon;
75 var valuesCN = 'Current PlanetLab hardware requirements: <b>1 (if quad core) or 2 (if dual core)</b>';
76 var descCN = '<span class="myslice title">'+titleCN+'</span><p>'+valuesCN+'<p>'+sourceCN;
77
78 var titleCR = 'CPU clock rate';
79 var sourceCR = 'Source: '+sourceComon;
80 var valuesCR = 'Unit: <b>GHz</b><p>Current PlanetLab hardware requirements: <b>2.4 GHz</b>';
81 var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+valuesCR+'<p>'+sourceCR;
82
83 var selectPeriodCF = 'Select period: <select id="selectperiodCF" onChange=updatePeriod("CF",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
84 var titleCF = 'Free CPU';
85 var sourceCF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
86 var valuesCF = 'Unit: <b>%</b>';
87 var detailCF = '<i> The average CPU percentage that gets allocated to a test slice named burb that is periodically run by CoMon.</i>';
88 var descCF = '<span class="myslice title">'+titleCF+'</span><p>'+detailCF+'<p>'+selectPeriodCF+'<p>'+valuesCF+'<p>'+sourceCF; 
89
90 var titleDN = 'Toplevel domain name';
91 var sourceDN = 'Source: '+sourceMyPLC;
92 var descDN = '<span class="myslice title">'+titleDN+'</span><p>'+sourceDN;
93
94 var titleDS = 'Disk size';
95 var sourceDS = 'Source: '+sourceComon;
96 var valuesDS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>500 GB</b>';
97 var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+valuesDS+'<p>'+sourceDS;
98
99 var titleDU = 'Current disk utilization';
100 var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
101 var valuesDU = 'Unit: <b>GB</b>';
102 var detailDU = '<i> The amount of disk space currently consumed (checked daily).</i>';
103 var descDU = '<span class="myslice title">'+titleDU+'</span><p>'+detailDU+'<p>'+valuesDU+'<p>'+sourceDU;
104
105 var titleDF = 'Disk space free';
106 var sourceDF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
107 var valuesDF = 'Unit: <b>GB</b>';
108 var detailDF = '<i> The amount of disk space currently available (checked daily).</i>';
109 var descDF = '<span class="myslice title">'+titleDF+'</span><p>'+detailDF+'<p>'+valuesDF+'<p>'+sourceDF;
110
111 var titleHC = 'Hop count (pairwise)';
112 var sourceHC = 'Source: '+sourceTophat;
113 var detailHC = '<i>TopHat conducts traceroutes every five minutes in a full mesh between all PlanetLab nodes. The hop count is the length of the traceroute from the node to the reference node, based upon the most recently reported traceroute</i>.';
114 var descHC = '<span class="myslice title">'+titleHC+'</span><p>'+detailHC+'<p>'+selectReferenceNode+'<p>'+sourceHC;
115
116 var titleIP = 'IP address';
117 var sourceIP = 'Source: '+sourceMyPLC;
118 var descIP = '<span class="myslice title">'+titleIP+'</span><p>'+sourceIP;
119
120 var selectPeriodL = 'Select period: <select id="selectperiodL" onChange=updatePeriod("L",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
121 var titleL= 'Load ';
122 var sourceL = 'Source: '+sourceComon;
123 var valuesL = 'Unit: <b>5-minute load</b>';
124 var detailL = '<i>The average 5-minute load (as reported by the Unix uptime command) over the selected period.</i>';
125 var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+selectPeriodL+'<p>'+valuesL+'<p>'+sourceL; 
126
127 var titleLON= 'Longitude';
128 var sourceLON = 'Source: '+sourceTophat;
129 var descLON = '<span class="myslice title">'+titleLON+'</span><p>'+sourceLON;
130
131 var titleLAT= 'Latitude';
132 var sourceLAT = 'Source: '+sourceTophat;
133 var descLAT = '<span class="myslice title">'+titleLAT+'</span><p>'+sourceLAT;
134
135 var titleLCN= 'Location (Country)';
136 var sourceLCN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
137 var detailLCN = '<i>Based on the latitude and longitude information.</i>';
138 var descLCN = '<span class="myslice title">'+titleLCN+'</span><p>'+detailLCN+'<p>'+sourceLCN;
139
140 var titleLCT= 'Location (Continent)';
141 var sourceLCT = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
142 var detailLCT = '<i>Based on the latitude and longitude information.</i>';
143 var descLCT = '<span class="myslice title">'+titleLCT+'</span><p>'+detailLCT+'<p>'+sourceLCT;
144
145 var titleLCY= 'Location (City)';
146 var sourceLCY = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
147 var detailLCY = '<i>Based on the latitude and longitude information.</i>';
148 var descLCY = '<span class="myslice title">'+titleLCY+'</span><p>'+detailLCY+'<p>'+sourceLCY;
149
150 var titleLPR= 'Location precision radius';
151 var sourceLPR = 'Source: '+sourceTophat;
152 var valuesLPR = 'Unit: <b>float</b>';
153 var detailLPR = '<i>The radius of the circle corresponding to the error in precision of the geolocalization estimate.</i>';
154 var descLPR = '<span class="myslice title">'+titleLPR+'</span><p>'+detailLPR+'<p>'+valuesLPR+'<p>'+sourceLPR;
155
156 var titleLRN= 'Location (Region)';
157 var sourceLRN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
158 var detailLRN = '<i>Based on the latitude and longitude information.</i>';
159 var descLRN = '<span class="myslice title">'+titleLRN+'</span><p>'+detailLRN+'<p>'+sourceLRN;
160
161 var titleMS= 'Memory size';
162 var sourceMS = 'Source: '+sourceComon;
163 var valuesMS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>4 GB</b>.';
164 var descMS = '<span class="myslice title">'+titleMS+'</span><p>'+valuesMS+'<p>'+sourceMS;
165
166 var selectPeriodMU = 'Select period: <select id="selectperiodMU" onChange=updatePeriod("MU",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
167 var titleMU = 'Memory utilization';
168 var sourceMU = 'Source: '+sourceComon;
169 var valuesMU = '<p>Unit: <b>%</b>';
170 var detailMU = '<i>The average active memory utilization as reported by CoMon.</i>';
171 var descMU = '<span class="myslice title">'+titleMU+'</span><p>'+detailMU+'<p>'+selectPeriodMU+'<p>'+valuesMU+'<p>'+sourceMU; 
172
173 var titleNEC= 'Network information (ETOMIC)';
174 var sourceNEC = 'Source: '+sourceTophat;
175 var valuesNEC = 'Values: <b>yes/no</b>';
176 var detailNEC = '<i>The existence of a colocated ETOMIC box. When an ETOMIC box is present, you have the possibility to conduct high-precision measurements through the '+sourceTophatAPI+'.</i>';
177 var descNEC = '<span class="myslice title">'+titleNEC+'</span><p>'+detailNEC+'<p>'+valuesNEC+'<p>'+sourceNEC;
178
179 var titleNSN= 'Network information (SONoMA)';
180 var sourceNSN = 'Source: '+sourceTophat;
181 var valuesNSN = 'Values: <b>yes/no</b>';
182 var detailNSN = '<i>The existence of a SONoMA agent. When an SONoMA is present, you have the possibility to have access to high-precision measurements through the '+sourceTophatAPI+'.</i>';
183 var descNSN = '<span class="myslice title">'+titleNSN+'</span><p>'+detailNSN+'<p>'+valuesNSN+'<p>'+sourceNSN;
184
185 var titleNTH= 'Network information (TopHat)';
186 var sourceNTH = 'Source: '+sourceTophat;
187 var valuesNTH = 'Values: <b>yes/no</b>';
188 var detailNTH = '<i>The existence of a colocated TDMI (TopHat Dedicated Measurement Infrastructure) agent. When a TDMI agent is present, you have access to a wide variety of network topology measurements through the '+sourceTophatAPI+'.</i>';
189 var descNTH = '<span class="myslice title">'+titleNTH+'</span><p>'+detailNTH+'<p>'+valuesNTH+'<p>'+sourceNTH;
190
191 var titleNDS= 'Network information (DIMES)';
192 var sourceNDS = 'Source: '+sourceTophat;
193 var valuesNDS = 'Values: <b>yes/no</b>';
194 var detailNDS = '<i>The existence of a colocated DIMES agent. When a DIMES agent is present, you have access to DIMES measurements through the '+sourceTophatAPI+'.</i>';
195 var descNDS = '<span class="myslice title">'+titleNDS+'</span><p>'+detailNDS+'<p>'+valuesNDS+'<p>'+sourceNDS;
196
197 var titleNSF= 'Network information (spoof)';
198 var sourceNSF = 'Source: '+sourceTophat;
199 var valuesNSF = '<p>Values: <b>yes/no</b>';
200 var detailNSF = '<i> Whether the node can send packets successfully (or not) with a spoofed IP source address.</i>';
201 var descNSF = '<span class="myslice title">'+titleNSF+'</span><p>'+detailNSF+'<p>'+valuesNSF+'<p>'+sourceNSF;
202
203 var titleNSR= 'Network information (source route)';
204 var sourceNSR = 'Source: '+sourceTophat;
205 var valuesNSR = '<p>Values: <b>yes/no</b>';
206 var detailNSR = '<i> Whether the node can send packets packets using the IP source route option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option003.htm">here</a>for more info.</i>';
207 var descNSR = '<span class="myslice title">'+titleNSR+'</span><p>'+detailNSR+'<p>'+valuesNSR+'<p>'+sourceNSR;
208
209 var titleNTP= 'Network information (timestamp)';
210 var sourceNTP = 'Source: '+sourceTophat;
211 var valuesNTP = '<p>Values: <b>yes/no</b>';
212 var detailNTP = '<i> Whether the node can send packets packets using the IP timestamp option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option004.htm">here</a>for more info.</i>';
213 var descNTP = '<span class="myslice title">'+titleNTP+'</span><p>'+detailNTP+'<p>'+valuesNTP+'<p>'+sourceNTP;
214
215 var titleNRR= 'Network information (record route)';
216 var sourceNRR = 'Source: '+sourceTophat;
217 var valuesNRR = '<p>Values: <b>yes/no</b>';
218 var detailNRR = '<i> Whether the node can send packets packets using the IP record route option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option007.htm">here</a>for more info.</i>';
219 var descNRR = '<span class="myslice title">'+titleNRR+'</span><p>'+detailNRR+'<p>'+valuesNRR+'<p>'+sourceNRR;
220
221 var titleOS = 'Operating system';
222 var sourceOS = 'Source: '+sourceMyPLC;
223 var valuesOS = 'Values: <b>Fedora, Cent/OS, other, n/a</b>';
224 var descOS = '<span class="myslice title">'+titleOS+'</span><p>'+valuesOS+'<p>'+sourceOS;
225
226 var selectPeriodR = 'Select period: <select id="selectperiodR" onChange=updatePeriod("R",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
227 var titleR = 'Reliability';
228 var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
229 var detailR = '<i>CoMon queries nodes every 5 minutes, for 255 queries per day. The average reliability is the percentage of queries over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
230 var valuesR = 'Unit: <b>%</b>';
231 var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+selectPeriodR+'<p>'+valuesR+'<p>'+sourceR; 
232
233 var titleRES = 'Reservation capabilities';
234 var sourceRES = 'Source: '+sourceMyPLC;
235 //var valuesRES = 'Values: <b>yes/no</b>';
236 var valuesRES = 'Values: <b>-R-</b> (if yes)';
237 var detailRES = '<i> Whether the node can be reserved for a certain duration.<br>Your slivers will be available <span class=bold>only during timeslots where you have obtained leases (see tab above)</span></i>.  <p>Please note that as of August 2010 this feature is experimental.  Feedback is appreciated at <a href="mailto:devel@planet-lab.org">devel@planet-lab.org</a>';
238 var descRES = '<span class="myslice title">'+titleRES+'</span><p>'+detailRES+'<p>'+valuesRES+'<p>'+sourceRES;
239
240 var selectPeriodS = 'Select period: <select id="selectperiodS" onChange=updatePeriod("S",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
241 var titleS = 'Active slices';
242 var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
243 var valuesS = 'Unit: <b>%</b>';
244 var detailS = '<i>Average number of active slices over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
245 var descS = '<span class="myslice title">'+titleS+'</span><p>'+detailS+'<p>'+selectPeriodS+'<p>'+valuesS+'<p>'+sourceS; 
246
247 var titleSN = 'Site name';
248 var sourceSN = 'Source: '+sourceMyPLC;
249 var descSN = '<span class="myslice title">'+titleSN+'</span><p>'+sourceSN;
250
251 var selectPeriodSSH = 'Select period: <select id="selectperiodSSH" onChange=updatePeriod("SSH",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
252 var titleSSH = 'Average SSH response delay';
253 var valuesSSH = 'Unit: <b>%</b>';
254 var detailSSH = '<i>The average response delay of the node to SSH logins over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
255 var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
256 var descSSH = '<span class="myslice title">'+titleSSH+'</span><p>'+detailSSH+'<p>'+selectPeriodSSH+'<p>'+valuesSSH+'<p>'+sourceSSH; 
257
258 var titleST = 'Status';
259 var sourceST = 'Source: '+sourceMonitor;
260 var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
261 var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
262
263
264 //Categorization of columns in different types, useful for filtering 
265
266 function inTypeA(header_name) {
267         var typeA = ['ST','SN','RES','OS','NRR','NTP','NSR','NSF','NDS','NTH','NEC','LRN','LCY','LPR','LCN','LAT','LON','IP','ASN','AST'];
268         return typeA.indexOf(header_name);
269 }
270
271 function inTypeB(header_name) {
272         var typeB = ['BW','DS','MS','CC','CR','AS','MU','DU','CN'];
273         return typeB.indexOf(header_name);
274 }
275
276 function inTypeC(header_name) {
277         var typeC = ['Rw','Rm','Ry','BWw','BWm','BWy','Lw','Lm','Ly','Sw','Sm','Sy','CFw','CFm','CFy','BUw','BUm','BUy','MUw','MUm','MUy','SSHw','SSHm','SSHy'];
278         return typeC.indexOf(header_name);
279 }
280
281 function inTypeD(header_name) {
282         var typeD = ['HC'];
283         return typeD.indexOf(header_name);
284 }
285
286
287 //Debugging
288 function debugfilter(s) {
289         document.getElementById('debug').innerHTML+=s;
290 }
291
292
293 //Called when a column is selected. It displays the detailed description
294 //on the right panel
295
296 function highlightOption(divid) {
297
298         //debugfilter("highlighting option "+divid);
299
300         var columns = document.getElementsByName('columnlist');
301         for(var j = 0; j < columns.length; j++)
302                 columns[j].className = 'out'; 
303
304         document.getElementById(divid).className = 'selected';
305
306         showDescription(divid);
307
308 //panos: to IMPROVE 
309         if (document.getElementById('selectperiod'+divid))
310                 document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;
311
312 }
313
314
315 //Displays the detailed column description 
316
317 function showDescription(h) {
318
319         //debugfilter("showing description "+h);
320
321 //Checks if the detailed description div exists 
322         if (document.getElementById('selectdescr'))
323         {
324                 //Checks if there is a detailed description defined
325                 if (window['desc'+h])
326                         document.getElementById('selectdescr').innerHTML = ""+window['desc'+h];
327                 //else if (document.getElementById('fdesc'+h))
328                         //document.getElementById('selectdescr').innerHTML = document.getElementById('fdesc'+h).value;
329                 else 
330                         document.getElementById('selectdescr').innerHTML = "No detailed description provided";
331         }
332 }
333
334
335 //Overrides the titles of the columns as they are shown in the column selection panel.
336 //If no overriding variable exists the tag's description is used
337 function overrideTitles() {
338
339         var columns = document.getElementsByName('columnlist');
340
341         for(var j = 0; j < columns.length; j++)
342         {
343                 var kk = columns[j].id;
344                 if (window['title'+kk])
345                         document.getElementById('htitle'+kk).innerHTML = window['title'+kk];
346         }
347 }
348
349 //When the checkbox is clicked. Adds/removes column respectively
350 function changeCheckStatus(column) {
351
352         if (document.getElementById('selectdescr'))
353                 showDescription(document.getElementById(column).value);
354
355         if (document.getElementById(column).checked)
356                 addColumn(document.getElementById(column).value, true);
357         else
358                 deleteColumn(document.getElementById(column).value);
359 }
360
361 function removeSelectHandler(object)
362 {
363         debugfilter(object);
364         object.onclick = null;
365 }
366
367
368 //This function is used when the alternative "quick" selection list is used
369 function changeSelectStatus(column) {
370
371         var optionClass = "";
372         var selected_index = document.getElementById('quicklist').selectedIndex;
373
374         if (document.getElementById('quicklist') && selected_index != 0)
375         {
376
377                 optionClass = document.getElementById('quicklist').options[selected_index].className;
378
379                 if (optionClass == "in")
380                 {
381                         deleteColumn(document.getElementById('quicklist').value);
382                         document.getElementById('quicklist').options[selected_index].className = "out";
383                         document.getElementById('quicklist').value="0";
384                 }
385                 else
386                 {
387                         addColumn(document.getElementById('quicklist').value, true);
388                         document.getElementById('quicklist').options[selected_index].className = "in";
389                         document.getElementById('quicklist').value="0";
390                 }
391         }
392 }
393
394 //When the period of an already selected column is changed
395 function updatePeriod(h, new_period) {
396
397         var old_period = document.getElementById('period'+h).value;
398         document.getElementById('period'+h).value=new_period;
399
400         //debugfilter(h+''+old_period+'-'+h+''+new_period);
401         if (document.getElementById('check'+h).checked)
402         {
403                 deleteColumnCells(h+''+old_period);
404                 addColumnCells(h+''+new_period);
405                 addColumnAjax(h, h+''+new_period);
406
407                 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
408         }
409 }
410
411 /*
412  
413 RESET/SAVE CONFIGURATION
414 */
415
416 function getHTTPObject()
417 {
418         if (typeof XMLHttpRequest != 'undefined')
419         { return new XMLHttpRequest(); }
420
421         try
422         { return new ActiveXObject("Msxml2.XMLHTTP"); }
423         catch (e)
424         {
425                 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
426                 catch (e) {}
427         }
428         return false;
429 }
430
431 function closeMessage(tab)
432 {
433         var current_conf = document.getElementById('show_configuration').value;
434         var value = '';
435
436         if (current_conf != "")
437                 current_conf += ";";
438
439         if (tab == 'reservable') {      
440         document.getElementById('note_reservable_div').style.display = "none";
441         if (current_conf.indexOf('reservable') != -1)
442                 return;
443         value = current_conf+'reservable';
444         }
445
446         if (tab == 'columns') { 
447         document.getElementById('note_columns_div').style.display = "none";
448         if (current_conf.indexOf('columns') != -1)
449                 return;
450         value = current_conf+'columns';
451         }
452
453         var slice_id = document.getElementById('slice_id').value;
454         var person_id = document.getElementById('person_id').value;
455         var tag_id = document.getElementById('show_tag_id').value;
456         
457         var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
458         //debugfilter("updating conf with "+url);
459         document.getElementById('show_configuration').value = value;
460
461         var req = getHTTPObject();
462         req.open('GET', url, true);
463         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
464         req.onreadystatechange =
465         function() {
466                 if (req.readyState == 4)
467                 { debugfilter(req.responseText); }
468         }
469         req.send(null);
470
471 }
472
473
474 function updateColumnConfiguration(value, reload)
475 {
476         var person_id = document.getElementById('person_id').value;
477         var slice_id = document.getElementById('slice_id').value;
478         var tag_id = document.getElementById('conf_tag_id').value;
479         var full_column_configuration = document.getElementById('full_column_configuration').value;
480
481         //debugfilter("<br>OLD = "+full_column_configuration);
482         //debugfilter("<br>value = "+value);
483         //
484         
485         var old_columns = full_column_configuration.split(";");
486         var new_columns = new Array();
487
488         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
489                 new_columns.push(old_columns[column_index]);
490                 if (old_columns[column_index] != slice_id)
491                         new_columns.push(old_columns[++column_index]);
492                 else
493                 {
494                         if (value != "")
495                                 new_columns.push(value);
496                         else
497                                 new_columns.push("default");
498                                 
499                         column_index++;
500                 }
501         }
502
503         var new_configuration = new_columns.join(";");
504         //debugfilter("<br>NEW = "+new_configuration);
505
506         if (window.XMLHttpRequest)
507           {// code for IE7+, Firefox, Chrome, Opera, Safari
508           xmlhttp=new XMLHttpRequest();
509           }
510         else
511           {// code for IE6, IE5
512           xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
513           }
514         xmlhttp.onreadystatechange=function()
515           {
516           if (xmlhttp.readyState==4) // && xmlhttp.status==200)
517             {
518                 //value=xmlhttp.responseText;
519                 //debugfilter(value+"-----"+new_configuration);
520                 document.getElementById('column_configuration').value=value;
521                 document.getElementById('full_column_configuration').value=new_configuration;
522
523                 if (reload)
524                         window.location.reload(true);
525             }
526           }
527
528         xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true);
529         //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
530
531         xmlhttp.send();
532 }
533
534 function logSortingAction(person_id, slice_id, value)
535 {
536
537
538         var req = getHTTPObject();
539         var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id;
540
541         req.open('GET', url, true);
542         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
543         req.onreadystatechange =
544         function() {
545                 if (req.readyState == 4)
546                 { debugfilter(req.responseText); }
547         }
548         req.send(null);
549 }
550
551 function sortCompleteCallback(tableid) {
552
553         var slice_id = document.getElementById('slice_id').value;
554         var person_id = document.getElementById('person_id').value;
555
556         var ths = document.getElementById(tableid).getElementsByTagName("th");
557         for(var i = 0, th; th = ths[i]; i++) {
558         if (th.className.indexOf("Sort") != -1)
559         {
560                 var hclass = th.className;
561                 var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1);
562                 var sortdirection = hclass.substr(hclass.indexOf("Sort")-8,hclass.indexOf("Sort"));
563                 if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1)
564                         logSortingAction(person_id, slice_id, tableid+"|"+column+"|"+sortdirection);
565         }
566         }
567 }
568
569
570 function addColumnToConfiguration(column) {
571
572         var old_configuration = document.getElementById('column_configuration').value;
573
574         var new_configuration = "";
575
576         if (old_configuration != "")
577                 new_configuration = old_configuration += "|"+column;
578         else
579                 new_configuration = column;
580
581         //debugfilter("new configuration = "+new_configuration);
582
583         updateColumnConfiguration(new_configuration, false);
584 }
585
586
587 function deleteColumnFromConfiguration(column) {
588
589         var old_configuration = document.getElementById('column_configuration').value;
590
591         var old_columns = old_configuration.split("|");
592         var new_columns = new Array();
593
594         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
595                 var conf = old_columns[column_index].split(':');
596                 if (conf[0] != column)
597                         new_columns.push(old_columns[column_index]);
598         }
599
600         var new_configuration = new_columns.join("|");
601         updateColumnConfiguration(new_configuration, false);
602
603 }
604
605 function replaceColumnConfiguration(column_old, column_new) {
606
607         var old_configuration = document.getElementById('column_configuration').value;
608
609         var old_columns = old_configuration.split("|");
610         var new_columns = new Array();
611
612         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
613                 var conf = old_columns[column_index].split(':');
614                 if (conf[0] != column_old)
615                         new_columns.push(old_columns[column_index]);
616                 else
617                         new_columns.push(column_new);
618         }
619
620         var new_configuration = new_columns.join("|");
621         
622         updateColumnConfiguration(new_configuration);
623 }
624
625 /*
626  
627 ADD/REMOVE COLUMNS
628
629 */
630
631
632
633
634 function load_data(column, header, url) {
635
636         //debugfilter("<br>loading "+url);
637         var req = getHTTPObject();
638         var res;
639         req.open('GET', url, true);
640         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
641         req.onreadystatechange =
642         function() {
643                 if (req.readyState == 4)
644                 { updateColumnData(column, header, req.responseText); }
645         }
646         req.send(null);
647 }
648
649
650 function updateColumnData(column, header, data) {
651
652 var headers = header.split("|");
653 var data_table = data.split("|"); 
654
655 //debugfilter("<p>headers[0] = "+headers[0]);
656 //debugfilter("<p>data[2] = "+data_table[2]);
657
658 //debugfilter("data = "+data);
659
660 if (data != "")
661 {
662
663   var node_data;
664
665   var table_id1 = 'nodes';
666   var table=$(table_id1);
667   var css='#'+table_id1+'>tbody';
668   var rows = $$(css)[0].rows;
669
670   var data_array1 = new Array();
671
672   //debugfilter("COLUMN "+column+"<p>");
673
674   for (var node_index = 1; node_index < data_table.length; node_index++) {
675         if (data_table[node_index] == '---potential---')        
676                 break;
677         node_data = data_table[node_index].split(':');
678
679         data_array1[node_data[0]] = new Array();
680
681         for (var h_index=0; h_index < headers.length; h_index++) {
682                 
683                 if (node_data[h_index+1] == "")
684                         data_array1[node_data[0]][h_index] = "n/a";
685                 else
686                         data_array1[node_data[0]][h_index] = node_data[h_index+1];
687         }
688
689   }
690         
691
692   if (rows)
693   for (var row_index = 0; row_index < rows.length ; row_index++) {
694     var tr=rows[row_index];
695
696     for (var column_index=0; column_index < tr.cells.length; column_index++) {
697                 //debugfilter("<p>node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name'));
698                 if (tr.cells[column_index].getAttribute('name'))
699                 {
700                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
701                 if (found_index != -1)
702                         //debugfilter(tr.cells[0].innerHTML+"-"+found_index);
703                         tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index];
704                 }
705     }
706   }
707
708   fdTableSort.init(table_id1);
709   tablePaginater.init(table_id1);
710
711 //potential nodes
712 if (data_table[node_index] == '---potential---')        
713 {
714
715   var table_id2 = 'add_nodes';
716   var table2=$(table_id2);
717   var css2='#'+table_id2+'>tbody';
718   var rows2 = $$(css2)[0].rows;
719
720   var data_array2 = new Array();
721
722   //debugfilter("COLUMN "+column+"<p>");
723
724   for (; node_index < data_table.length; node_index++) {
725         if (data_table[node_index] == '')       
726                 continue;
727         node_data = data_table[node_index].split(':');
728
729         data_array2[node_data[0]] = new Array();
730
731         for (var h_index=0; h_index < headers.length; h_index++) {
732                 
733                 if (node_data[h_index+1] == "")
734                         data_array2[node_data[0]][h_index] = "n/a";
735                 else
736                         data_array2[node_data[0]][h_index] = node_data[h_index+1];
737         }
738   }
739         
740   if (rows)
741   for (var row_index = 0; row_index < rows2.length ; row_index++) {
742     var tr=rows2[row_index];
743
744     for (var column_index=0; column_index < tr.cells.length; column_index++) {
745                 if (tr.cells[column_index].getAttribute('name'))
746                 {
747                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
748                 if (found_index != -1)
749                         tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index];
750                 }
751     }
752   }
753
754   //fdTableSort.removeTableCache(table_id2);
755   fdTableSort.init(table_id2);
756   tablePaginater.init(table_id2);
757 }
758
759 }
760
761 document.getElementById('loading'+column).innerHTML = "";
762
763 }
764
765
766 function addColumnCells(header) {
767
768         var cells = document.getElementsByName(header);
769
770         //debugfilter("got cells -"+cells+"- for "+header);
771         for(var j = 0; j < cells.length; j++) 
772                 cells[j].style.display = "table-cell";
773 }
774
775 function addSampleCells(column) {
776
777         var cellsheader = document.getElementsByName("confheader"+column);
778         for(var j = 0; j < cellsheader.length; j++) 
779                 cellsheader[j].style.display = "table-cell";
780
781 }
782
783 function addColumnAjax(column, header) {
784
785         //var t = document.getElementById('check'+column).name;
786         var t = document.getElementById('tagname'+header).value;
787         var slice_id = document.getElementById('slice_id').value;
788
789         var selectedperiod = document.getElementById('period'+column).value;
790
791         var fetched = document.getElementById('fetched'+column).value;
792         var to_load = false;
793
794         //debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
795
796         if (fetched.indexOf("false")!=-1)
797         {
798                 to_load = true;
799                 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
800         }
801         else if (fetched.indexOf(','+selectedperiod+',')==-1)
802         {
803                         to_load = true;
804                         document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
805         }
806
807         if (to_load)
808         {
809                 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t;
810                 load_data(column, header, url);
811         }
812 }
813
814
815
816 function addColumn(column, fetch) {
817
818         var selectedperiod="";
819         var header=column;
820
821         document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
822
823         if (inTypeC(column)!=-1)
824         {
825                 column = column.substring(0,column.length-1);
826         }
827
828         selectedperiod = document.getElementById('period'+column).value;
829         header = column+""+selectedperiod;
830
831         //debugfilter("adding column "+column+" and header "+header);
832
833         addColumnCells(header);
834
835         if (fetch)
836                 addColumnAjax(column, header);
837         else
838                 document.getElementById('loading'+column).innerHTML = "";
839
840         addColumnToConfiguration(header);
841         
842 }
843
844
845 function deleteColumnCells(header) {
846
847         var cells = document.getElementsByName(header);
848         for(var j = 0; j < cells.length; j++) 
849                 cells[j].style.display = "none";
850
851 }
852
853
854
855 function deleteColumn(column) {
856
857         var selectedperiod="";
858         var header=column;
859
860         selectedperiod = document.getElementById('period'+column).value;
861         header = column+""+selectedperiod;
862
863         //debugfilter("deleting "+column+","+header);
864
865         deleteColumnCells(header);
866
867         deleteColumnFromConfiguration(header);
868
869         //document.getElementById('check'+column).checked = false;
870 }
871
872 function scrollList() {
873 debugfilter("here "+document.getElementById('scrolldiv').focused);
874 if (event.keyCode == 40)
875         debugfilter("down");
876 else if (event.keyCode == 38)
877         debugfilter("up");
878 }
879
880 /* 
881  
882 EXTRA
883
884 //to be used for scrolling the column list with down/up arrows 
885
886
887 function resetColumns() {
888
889         for (var kk in column_table) {
890
891         if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
892                 deleteColumn(kk);
893         else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true)
894                 addColumn(kk, true);
895         }
896
897 }
898
899 function resetCols(which_conf) {
900
901         var target_configuration = "|"+document.getElementById(which_conf).value+"|";
902         
903         //debugfilter("<p>Target configuration =  "+target_configuration);
904
905         for (var kk in column_table) {
906                 //debugfilter("in "+kk+" ");
907
908                 if (target_configuration.indexOf("|"+kk+"|")>=0)
909                 {
910                         if (document.getElementById('check'+kk))
911                         if (document.getElementById('check'+kk).checked == false)
912                         {
913                                 debugfilter("<p>Adding "+kk);
914                                 addColumn(kk, true);
915                         }
916                 }
917                 else
918                 {
919                         if (document.getElementById('check'+kk))
920                         if (document.getElementById('check'+kk).checked == true)
921                         {
922                                 debugfilter("<p>Deleting "+kk);
923                                 deleteColumn(kk);
924                         }
925                 }
926         }
927 }
928
929 function filterByType(selectedtype) {
930
931 var notselectedyet = true;
932
933 for (var kk in column_headers) {
934
935         if (document.getElementById(kk))
936         {
937                 if (window['type'+kk] == selectedtype)
938                 {
939                         document.getElementById(kk).className = 'in';
940                         if (notselectedyet)
941                                 highlightOption(kk);
942                         notselectedyet = false;
943                 }
944                 else
945                         document.getElementById(kk).className = 'out';
946         }
947 }
948 }
949
950
951 function deleteColumnSample() {
952         var cellsheader = document.getElementsByName("confheader"+column);
953         for(var j = 0; j < cellsheader.length; j++) 
954                 cellsheader[j].style.display = "none";
955
956 }
957
958 function checkDataToFetch() {
959
960 var dataExist = false;
961
962 for (var kk in column_table) {
963
964         if (document.getElementById(kk))
965         {
966                 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
967                 {
968                         document.getElementById('fetchbutton').disabled = false;
969                         document.getElementById('fetchbutton').style.color = 'red';
970                         dataExist = true;
971                 }
972         }
973 }
974
975 if (!dataExist)
976 {
977         document.getElementById('fetchbutton').disabled = true;
978         document.getElementById('fetchbutton').style.color = 'grey';
979 }
980
981 }
982
983
984 function fetchData() {
985
986 var tagnames = "";
987 var headers = "";
988
989 for (var kk in column_table) {
990
991 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
992         if (tagnames == "")
993         {       
994                 tagnames = column_table[kk]['tagname'];
995                 headers = kk;
996         }
997         else
998         {
999                 tagnames += "|"+column_table[kk]['tagname'];
1000                 headers += "|"+kk;
1001         }
1002 }
1003
1004 //debugfilter("fetching these columns: "+tagnames+ "("+headers+")");
1005
1006         var slice_id = document.getElementById('slice_id').value;
1007         document.getElementById('loadingDiv').innerHTML = "&nbsp;&nbsp;&nbsp;<img src=/plekit/icons/ajax-loader.gif>&nbsp;Loading data. Please wait ...";
1008         var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames;
1009         load_data(headers, url);
1010 }
1011
1012
1013 /*
1014  
1015
1016 HIGHLIGHTING
1017
1018
1019
1020 function updateColumnThreshold(column, minT, maxT) {
1021
1022 debugfilter("updating threshold for "+column+" with "+minT+" and "+maxT);
1023
1024 var cells = document.getElementsByName(column);
1025
1026 for(var j = 0; j < cells.length; j++) 
1027 {
1028 var val = parseFloat(cells[j].innerHTML);
1029
1030 if (val >= minT && val <= maxT)
1031         cells[j].style.color = filtered_color;
1032 else
1033         cells[j].style.color = normal_color;
1034 }
1035
1036 var old_configuration = document.getElementById('column_configuration').value;
1037 var slice_id = document.getElementById('slice_id').value;
1038
1039 var old_columns = old_configuration.split("|");
1040 var new_columns = new Array();
1041
1042 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1043         var conf = old_columns[column_index].split(':');
1044         if (conf[0] != column)
1045                 new_columns.push(old_columns[column_index]);
1046         else
1047                 new_columns.push(column+":"+minT+","+maxT);
1048 }
1049
1050 var new_configuration = new_columns.join("|");
1051
1052 updateColumnConfiguration(slice_id, new_configuration);
1053
1054 }
1055
1056 function updateExcludeList(column, excludeList) {
1057
1058 //debugfilter("updating list");
1059 debugfilter("updating list for "+column+" with "+excludeList);
1060
1061 var cells = document.getElementsByName(column);
1062
1063 for(var j = 1; j < cells.length; j++) 
1064 {
1065 var val = cells[j].innerHTML;
1066
1067 if (excludeList == val)
1068         cells[j].style.color = filtered_color;
1069 else
1070         cells[j].style.color = normal_color;
1071 }
1072
1073 var old_configuration = document.getElementById('column_configuration').value;
1074 var slice_id = document.getElementById('slice_id').value;
1075
1076 var old_columns = old_configuration.split("|");
1077 var new_columns = new Array();
1078
1079 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1080         var conf = old_columns[column_index].split(':');
1081         if (conf[0] != column)
1082                 new_columns.push(old_columns[column_index]);
1083         else
1084                 new_columns.push(column+":"+excludeList);
1085 }
1086
1087 var new_configuration = new_columns.join("|");
1088
1089 updateColumnConfiguration(slice_id, new_configuration);
1090
1091 }
1092
1093
1094
1095 /*
1096  
1097 ROW FILTERING
1098
1099
1100 function plekit_table_showAll (slicetable_id) {
1101
1102   var table=$(slicetable_id);
1103   var css='#'+slicetable_id+'>tbody';
1104   var rows = $$(css)[0].rows;
1105
1106   // scan rows, elaborate 'visible'
1107   for (var row_index = 0; row_index < rows.length ; row_index++) {
1108     var tr=rows[row_index];
1109     var visible=true;
1110     plekit_table_row_visible(tr,visible);
1111   }
1112
1113     plekit_table_count_filtered(slicetable_id);
1114
1115   tablePaginater.init(slicetable_id);
1116   
1117 }
1118
1119 function plekit_table_count_filtered (slicetable_id) {
1120   var table=$(slicetable_id);
1121   var css='#'+slicetable_id+'>tbody';
1122   var rows = $$(css)[0].rows;
1123
1124   var no_filtered=0;
1125
1126   // scan rows, elaborate 'visible'
1127   for (var row_index = 0; row_index < rows.length ; row_index++) {
1128     var tr=rows[row_index];
1129     var filtered = false;
1130
1131     for (var column_index=0; column_index < tr.cells.length; column_index++) 
1132                 if (tr.cells[column_index].style.color == "red")
1133                         filtered = true;
1134
1135         if (filtered)
1136         no_filtered++;
1137
1138   }
1139
1140   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1141 }
1142
1143
1144 function plekit_table_hide_filtered (slicetable_id) {
1145   var table=$(slicetable_id);
1146   var css='#'+slicetable_id+'>tbody';
1147   var rows = $$(css)[0].rows;
1148
1149   var reg = /(^|\s)invisibleRow(\s|$)/;
1150
1151
1152   if (!document.getElementById('filtercheck').checked)
1153   {
1154         plekit_table_showAll(slicetable_id);
1155         return;
1156   }
1157
1158   var hidden=0;
1159
1160   // scan rows, elaborate 'visible'
1161   for (var row_index = 0; row_index < rows.length ; row_index++) {
1162     var tr=rows[row_index];
1163     var visible=true;
1164
1165     for (var column_index=0; column_index < tr.cells.length; column_index++) {
1166                 if (tr.cells[column_index].style.color == filtered_color)
1167                         visible = false;
1168     }
1169     if (!visible)
1170         hidden++;
1171
1172     plekit_table_row_visible(tr,visible);
1173   }
1174
1175   //debugfilter('hidden '+hidden+' nodes');
1176   debugfilter(hidden+' nodes do not satisfy the requested threshold (hidden)');
1177   
1178   tablePaginater.init(slicetable_id);
1179 }
1180
1181
1182
1183
1184 function plekit_table_apply_config(slicetable_id, configuration) {
1185
1186 var new_configuration = document.getElementById('new_conf').value;
1187 var all_columns = new_configuration.split("|");
1188
1189 var min_values = new Array();
1190 var max_values = new Array();
1191
1192
1193 for (var column_index = 0; column_index < all_columns.length ; column_index++) {
1194
1195         var conf = all_columns[column_index].split(':');
1196         
1197         if (inTypeB(conf[0]) != -1)
1198         {
1199                 var threshold = conf[1].split(',');
1200                 if (threshold.length == 2)
1201                 {
1202                 min_values.push(parseFloat(threshold[0]));
1203                 max_values.push(parseFloat(threshold[1]));
1204                 }
1205         }
1206         else if (inTypeC(conf[0]) == -1)
1207         {
1208                 var threshold = conf[2].split(',');
1209                 if (threshold.length == 2)
1210                 {
1211                 min_values.push(parseInt(threshold[0]));
1212                 max_values.push(parseInt(threshold[1]));
1213                 }
1214         }
1215         else
1216         {
1217                 min_values.push(-1);
1218                 max_values.push(-1);
1219         }
1220         
1221 }
1222
1223   var table=$(slicetable_id);
1224   var css='#'+slicetable_id+'>tbody';
1225   var rows = $$(css)[0].rows;
1226
1227
1228   var no_filtered=0;
1229
1230   for (var row_index = 0; row_index < rows.length ; row_index++) {
1231
1232         var tr=rows[row_index];
1233
1234         var filtered = false;
1235
1236         for (var column_index = 0; column_index < all_columns.length ; column_index++) 
1237         if (min_values[column_index]!=-1)
1238         {
1239                 var val = parseFloat(tr.cells[3+column_index].innerHTML);
1240                 
1241                 if (val >= min_values[column_index] && val <= max_values[column_index])
1242                 {
1243                         tr.cells[3+column_index].style.color = filtered_color;
1244                         filtered = true;
1245                 }
1246                 else
1247                         tr.cells[3+column_index].style.color = normal_color;
1248         }
1249         else
1250                 if (tr.cells[3+column_index].style.color == filtered_color)
1251                         filtered = true;
1252                 
1253
1254         if (filtered)
1255         no_filtered++;
1256   }
1257
1258   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1259
1260   //tablePaginater.init(slicetable_id);
1261
1262 }
1263
1264
1265 function reset_select () {
1266   var table=$(slicetable_id);
1267   var css='#'+slicetable_id+'>tbody';
1268   var rows = $$(css)[0].rows;
1269
1270 var action = document.getElementById('onlyselected');
1271 action.checked=false;
1272
1273   // scan rows, elaborate 'visible'
1274   for (var row_index = 0; row_index < rows.length ; row_index++) {
1275     var tr=rows[row_index];
1276
1277     document.getElementById("check"+tr.id).checked=false;
1278
1279   }
1280
1281   plekit_table_count_nodes();
1282 }
1283
1284 }
1285
1286
1287 function plekit_table_select_filter () {
1288   var table=$(slicetable_id);
1289   var css='#'+slicetable_id+'>tbody';
1290   var rows = $$(css)[0].rows;
1291
1292   var reg = /(^|\s)invisibleRow(\s|$)/;
1293
1294   var action = document.getElementById('onlyselected');
1295   if (!action.checked)
1296         plekit_table_reset_filter();
1297
1298   // scan rows, elaborate 'visible'
1299   for (var row_index = 0; row_index < rows.length ; row_index++) {
1300     var tr=rows[row_index];
1301     var visible=true;
1302
1303     if (action.checked)
1304     {
1305          if(tr.className.search(reg) == -1) 
1306               if(!document.getElementById("check"+tr.id).checked)
1307                   visible=false;
1308     }
1309
1310     if(tr.className.search(reg) != -1) 
1311         visible=false;
1312
1313     plekit_table_row_visible(tr,visible);
1314   }
1315   
1316   tablePaginater.init(slicetable_id);
1317   plekit_table_count_nodes();
1318 }
1319
1320 function plekit_table_select_filter2 () {
1321   var table=$(slicetable_id);
1322   var css='#'+slicetable_id+'>tbody';
1323   var rows = $$(css)[0].rows;
1324
1325   var reg = /(^|\s)invisibleRow(\s|$)/;
1326
1327   var action = document.getElementById('onlyselected');
1328
1329   // scan rows, elaborate 'visible'
1330   for (var row_index = 0; row_index < rows.length ; row_index++) {
1331     var tr=rows[row_index];
1332     var visible=true;
1333
1334     if (action.checked)
1335     {
1336          if(tr.className.search(reg) == -1) 
1337               if(!document.getElementById("check"+tr.id).checked)
1338                   visible=false;
1339     }
1340
1341     if(tr.className.search(reg) != -1) 
1342         visible=false;
1343
1344     plekit_table_row_visible(tr,visible);
1345   }
1346   
1347   tablePaginater.init(slicetable_id);
1348   plekit_table_count_nodes();
1349 }
1350
1351 function CheckTopNodes(n) {
1352   var table=$(slicetable_id);
1353   var css='#'+slicetable_id+'>tbody';
1354   var rows = $$(css)[0].rows;
1355   var reg = /(^|\s)invisibleRow(\s|$)/;
1356
1357   var checked=0;
1358
1359   for (var row_index = 0; row_index < rows.length ; row_index++) {
1360     var tr=rows[row_index];
1361
1362     if(tr.className.search(reg) == -1) {
1363         if (checked<n)
1364         {
1365                 document.getElementById("check"+tr.id).checked=true;
1366                 checked++;
1367         }
1368         else
1369         {
1370                 document.getElementById("check"+tr.id).checked=false;
1371         };
1372     };
1373    };
1374 };
1375
1376
1377 function CheckRandomNodes(n) {
1378   var table=$(slicetable_id);
1379   var css='#'+slicetable_id+'>tbody';
1380   var rows = $$(css)[0].rows;
1381   var reg = /(^|\s)invisibleRow(\s|$)/;
1382
1383   var r = n/plekit_table_visible_count();
1384   var checked=0;
1385
1386   for (var row_index = 0; row_index < rows.length ; row_index++) {
1387     var tr=rows[row_index];
1388
1389     if(tr.className.search(reg) == -1) {
1390         if(Math.random() < r) {
1391                 document.getElementById("check"+tr.id).checked=true;
1392                 checked++;
1393         };
1394         if (checked>=n)
1395                 break;
1396      };
1397   };
1398 };
1399
1400
1401 function plekit_table_visible_count() {
1402   var table=$(slicetable_id);
1403   var css='#'+slicetable_id+'>tbody';
1404   var rows = $$(css)[0].rows;
1405   var reg = /(^|\s)invisibleRow(\s|$)/;
1406   var v=0;
1407
1408   for (var row_index = 0; row_index < rows.length ; row_index++) {
1409     var tr=rows[row_index];
1410
1411         if(tr.className.search(reg) == -1) 
1412         {
1413                 v++;
1414         }
1415   }
1416
1417   return v;
1418 }
1419
1420
1421 function plekit_table_count_nodes() {
1422   var table=$(slicetable_id);
1423   var css='#'+slicetable_id+'>tbody';
1424   var rows = $$(css)[0].rows;
1425   var reg = /(^|\s)invisibleRow(\s|$)/;
1426   var n=0;
1427   var v=0;
1428   var s=0;
1429
1430   for (var row_index = 0; row_index < rows.length ; row_index++) {
1431     var tr=rows[row_index];
1432
1433         n++;
1434         var ch = document.getElementById("check"+tr.id);
1435
1436         if(tr.className.search(reg) == -1) 
1437                 v++;
1438         else
1439         {
1440                 if (ch.checked)
1441                         ch.checked=false;
1442         };
1443
1444         if (ch.checked)
1445                 s++;
1446         
1447    };
1448
1449    var dd = document.getElementById('node_statistics');
1450    dd.innerHTML = "Total: "+n+" - Shown: "+v+" - Selected: "+s;
1451 };
1452
1453 function AutoSelect()
1454 {
1455   var a = document.getElementById('automatic').value;
1456   var n = parseInt(document.getElementById('no_nodes').value);
1457
1458   if (isNaN(n))
1459         return;
1460
1461   if (a == "random")
1462          CheckRandomNodes(n);
1463   else if (a == "top")
1464          CheckTopNodes(n);
1465
1466   plekit_table_select_filter2();
1467   plekit_table_count_nodes();
1468 }
1469
1470 */