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