Browse code

first release

Jeff Owrey authored on 09/25/2015 03:44:17
Showing 15 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,996 @@
1
+/*
2
+ Background Radiation Monitor - Web Server
3
+ 
4
+ A simple web server that makes available to clients over the Internet
5
+ readings from a MightyOhm Geiger counter. The MightyOhm is connected to
6
+ an Arduino Uno with attached Ethernet shield.  This software module
7
+ runs on the Arduino Uno an embedded HTTP server by which Internet
8
+ applications can query the MightyOhm for Geiger counter readings.
9
+ Also, this software runs a Network Time Protocol (NTP) client, that
10
+ periodically synchronizes the local system clock to network time.
11
+ Included is a simple command line interface that may be used to change the
12
+ network interface IP address, NTP server address, or configure a
13
+ verbose output mode.
14
+ 
15
+ Copyright 2014 Jeff Owrey
16
+    This program is free software: you can redistribute it and/or modify
17
+    it under the terms of the GNU General Public License as published by
18
+    the Free Software Foundation, either version 3 of the License, or
19
+    (at your option) any later version.
20
+
21
+    This program is distributed in the hope that it will be useful,
22
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
+    GNU General Public License for more details.
25
+
26
+    You should have received a copy of the GNU General Public License
27
+    along with this program.  If not, see http://www.gnu.org/license.
28
+ 
29
+ Circuit:
30
+ * Main components: Arduino Uno, Ethernet shield, Mighty Ohm Geiger counter
31
+ * Ethernet shield attached to pins 10, 11, 12, 13
32
+ * In order to allow the MightyOhm to operate on the Uno's 5 volt power
33
+   supply, and thus make the MightyOhm's serial output compatible with the
34
+   Uno, the following has to be done (see MightyOhm schematic):
35
+     1. Change R6 to 1K Ohm.
36
+     2. Change R11 to 330 Ohm.
37
+     3. Connect +5v from the Uno to MightyOhm J6 pin 1.
38
+     4. Connect GND from the Uno to MightyOhm J6 pin 3.
39
+     5. Connect D5 from the Uno to MightyOhm J7 pin 5.
40
+   
41
+ Misc Notes:
42
+   As of this release the Uno's SRAM gets entirely maxed out by
43
+   this program.  Any modifications to this program that requires
44
+   additional memory seriously entails the risk that the modifications
45
+   will cause the program to become un-stable.
46
+   
47
+ Revision History:  
48
+   * v10 released 25 Feb 2014 by J L Owrey
49
+   * v11 released 24 Jun 2014 by J L Owrey
50
+       - optimization of processRxByte function to conserve SRAM
51
+       - removal of non-used function code
52
+       - defaults to APIPA IP address in the event a DHCP address
53
+         cannot be obtained
54
+   * v12 released 20 Dec 2014 by J L Owrey
55
+       - removed Timestamp global variable to make more dynamic
56
+         memory available for local variables
57
+       - optimized clock network synch algorithm
58
+       - optimized serial update algorithm
59
+   * v13 released 22 Jul 2015 by J L Owrey
60
+       - add use of "F" function to store constant strings in
61
+         program flash memory in order to save SRAM space
62
+   * v14 released 19 Aug 2015 by J L Owrey
63
+       - add ability to respond to web a client request with either
64
+         a JSON compatible string or a standard HTML document
65
+*/
66
+
67
+/***  PREPROCESSOR DEFINES  ***/
68
+
69
+/*
70
+ Define the header and version number displayed at startup
71
+ and also by the 'view settings' command.
72
+*/
73
+#define STARTUP_HEADER "\n\rRadmon v1.4 (c) 2015"
74
+#define RADMON_VERSION "v1.4"
75
+/*
76
+ The following define sets the MAC address of the device.  This
77
+ address is a permanent attribute of the device's Ethernet interface,
78
+ and never, ever, should be changed.  This address was provided
79
+ by the Arduino Ethernet shield manufacturer for use with this
80
+ specific instance of the Ethernet shield.  This MAC address should
81
+ be shown on a label affixed to the device housing.
82
+*/
83
+#define ETHERNET_MAC_ADDRESS 0x90, 0xA2, 0xDA, 0x0D, 0x84, 0xF6
84
+/*
85
+ The following defines an APIPA default address in the event that
86
+ DHCP mode is ON and a DHCP address cannot be obtained.
87
+*/
88
+#define DEFAULT_APIPA_IP_ADDRESS "169.254.100.10"
89
+/*
90
+ The following defines set the period of a 'heartbeat' string sent
91
+ out over the device's USB port.  This heartbeat consists of a serial
92
+ data string containing the current radiation reading and GM time.
93
+*/
94
+#define SERIAL_UPDATE_INTERVAL 30000  //milli-seconds
95
+#define VERBOSE_SERIAL_UPDATE_INTERVAL 10000  //milli-seconds
96
+/*
97
+ The following define sets the port number the HTTP service will use to
98
+ listen for requests from Internet clients.  Normally HTTP requests use
99
+ port 80.
100
+*/
101
+#define HTTP_SERVER_PORT 80
102
+/*
103
+ The following defines are for configuring a local NTP client
104
+ for synchronizing the local system clock to network time.
105
+ Note that the default setting is the IP address of the following
106
+ time server:
107
+              time-a.timefreq.bldrdoc.gov
108
+*/
109
+#define DEFAULT_NTP_SERVER_IP_ADDR "132.163.4.101"
110
+#define NTP_PORT 8888
111
+#define NTP_PACKET_SIZE 48 // NTP time stamp is in the first 48 bytes of the message
112
+/*
113
+ The following defines how often the system clock gets synchronized
114
+ to network time.
115
+*/
116
+#define NET_SYNCH_INTERVAL 43200 //number in seconds
117
+/*
118
+ The following defines the size of the buffer space required for the
119
+ serial data string from the Mighty Ohm Geiger counter.  The serial
120
+ data string is defined as the text from newline character to newline
121
+ character.
122
+*/
123
+#define MIGHTYOHM_DATA_STRING_LENGTH 65
124
+/*
125
+ The beginning of the MightyOhm data string always begins with the
126
+ same three characters.  These three characters determine the 
127
+ beginning of a new line of data from the MightyOhm.
128
+*/
129
+#define MIGHTYOHM_DATA_STRING_HEADER "CPS"
130
+
131
+/***  LIBRARY MODULES USED  ***/
132
+
133
+#include <Time.h>
134
+#include <SPI.h>         
135
+#include <Ethernet.h>
136
+#include <EthernetUdp.h>
137
+#include <SoftwareSerial.h>
138
+#include <EEPROM.h>;
139
+
140
+/***  GLOBAL DECLARATIONS ***/
141
+
142
+/*
143
+ Create and initialize a mac address object for the Ethernet interface. 
144
+*/
145
+byte mac[] = { ETHERNET_MAC_ADDRESS };
146
+/*
147
+ Create and initialize an HTTP server object.  The object is initialized
148
+ to the TCP port the HTTP server will use to listen for clients.
149
+*/
150
+EthernetServer httpServer(HTTP_SERVER_PORT);
151
+/*
152
+ Create a UDP client object for sending packets to
153
+ and receiveing packets from an NTP time server.
154
+*/
155
+EthernetUDP Udp;
156
+/*
157
+ Create a software serial port for receiving serial data from
158
+ the MightyOhm. Note that the Uno pin 5 receives serial data
159
+ FROM the MightyOhm.  The Uno's pin 6 is not used, as there is
160
+ no need to send serial data to the MightyOhm. 
161
+*/
162
+SoftwareSerial MightyOhmTxOut(5, 6);
163
+/*
164
+ Create global variables to store the MightOhm data, next heartbeat
165
+ time, and next synchronization time.
166
+*/
167
+char MightyOhmData[MIGHTYOHM_DATA_STRING_LENGTH + 1];
168
+unsigned long SerialUpdateTime;
169
+time_t NextClockSynchTime;
170
+/*
171
+ Create global variables to store the verbose mode state (ON or OFF)
172
+ and the IP address mode state (static or DHCP).
173
+*/
174
+boolean bVerbose;
175
+boolean bUseDHCP;
176
+/*
177
+ Create and initialize global arrays to hold the current IP address
178
+ and the NTP server IP address.
179
+*/
180
+byte ipAddr[4] = {};
181
+byte ntpip[4] = {};
182
+
183
+/*** SYSTEM STARTUP  ***/
184
+
185
+void setup()
186
+{
187
+  /*
188
+   Open serial communications to and from the Uno's USB port.
189
+  */
190
+  Serial.begin(9600);
191
+  /* 
192
+   Print to the USB port a header showing Radmon
193
+   version of this program and the copyright notice.
194
+  */
195
+  Serial.println(F(STARTUP_HEADER));
196
+  /*
197
+    Get the system configuration from EEPROM.
198
+  */
199
+  readSettingsFromEEPROM();
200
+  /*
201
+   Start up the Ethernet interface using either a static or
202
+   DHCP supplied address (depending on stored system configuration).
203
+  */
204
+  Serial.println(F("Configuring network interface..."));
205
+  if(bUseDHCP)
206
+  {
207
+    if ( Ethernet.begin(mac) == 0 )
208
+    {
209
+      /* DHCP not responding so use APIPA address */
210
+      parseIpAddress(ipAddr, DEFAULT_APIPA_IP_ADDRESS);
211
+      Ethernet.begin(mac, ipAddr);
212
+      Serial.println(F("DHCP failed - using APIPA"));
213
+    }
214
+    else
215
+    {
216
+      Serial.print(F("DHCP supplied IP: "));
217
+      Serial.println(Ethernet.localIP());
218
+    }
219
+  }
220
+  else
221
+  {
222
+    Ethernet.begin(mac, ipAddr);
223
+  }
224
+  /*
225
+   Start up NTP client service.
226
+  */
227
+  Udp.begin(NTP_PORT);
228
+  /*
229
+    Synchronize the system clock to network time.
230
+  */
231
+  synchronizeSystemClock();
232
+  /*
233
+   Start up the HTTP server.
234
+  */
235
+  Serial.println(F("Starting HTTP server..."));
236
+  httpServer.begin();
237
+  /*
238
+    Open serial communications to the MightyOhm device.
239
+  */  
240
+  MightyOhmTxOut.begin(9600);
241
+   /*
242
+    Initialize initial time for sending out the hearbeat string. Normally
243
+    the system clock will be at approx 3200 msec at this point. So allow
244
+    some additional time for data to accumulate in MightyOhm data buffer.
245
+  */
246
+  SerialUpdateTime = millis() + 2000;
247
+  /*
248
+   Initialize MightyOhm data string to empty.
249
+  */
250
+  MightyOhmData[0] = 0;
251
+  return;
252
+}
253
+
254
+/*** MAIN LOOP ***/
255
+
256
+void loop()
257
+{
258
+  /*
259
+   Check for user keyboard 'c' pressed.  This character switches
260
+   to command mode.
261
+  */   
262
+  if ( Serial.available() )
263
+  {
264
+    // get incoming byte
265
+    if(Serial.read() == 'c')
266
+    {
267
+      commandMode();
268
+    }
269
+  }  
270
+  /*
271
+    Poll serial input buffer from MightyOhm for new data and 
272
+    process received bytes to form a complete data string.
273
+  */
274
+  while ( MightyOhmTxOut.available() )
275
+  {
276
+    processRxByte( MightyOhmTxOut.read() );
277
+  }
278
+  /*
279
+    Every so often send a 'heartbeat' string to the USB port.
280
+    The heartbeat consists of UTC time stamp and current data
281
+    from the MightyOhm Geiger counter.
282
+  */
283
+  if ( millis() > SerialUpdateTime )
284
+  {
285
+    Serial.println( MightyOhmData );
286
+    /* Set the time for the next heartbeat pulse to go out. */
287
+    SerialUpdateTime = millis() +  \
288
+                       (bVerbose ? VERBOSE_SERIAL_UPDATE_INTERVAL :  \ 
289
+                                    SERIAL_UPDATE_INTERVAL);
290
+  }
291
+  /*
292
+   Listen for and and process requests from HTTP clients.
293
+  */  
294
+  listenForEthernetClients();
295
+  /*
296
+   Periodically synchronize local system clock to time
297
+   provided by NTP time server.
298
+  */
299
+  if ( now() > NextClockSynchTime )
300
+  {
301
+    synchronizeSystemClock();
302
+  }
303
+  return;
304
+}
305
+
306
+/*
307
+ Synchronize the local system clock to
308
+ network time provided by NTP time server.
309
+*/
310
+void synchronizeSystemClock()
311
+{
312
+  byte count;
313
+  
314
+  Serial.println(F("Synchronizing with network time server..."));
315
+    
316
+  for(count = 0; count < 3; count++)  // Attempt to synchronize 3 times
317
+  {
318
+    if(syncToNetworkTime() == 1)
319
+    {
320
+      //  Synchronization successful
321
+      break;
322
+    }
323
+    delay(1000);
324
+  } /* end for */ 
325
+  if(count == 3) {
326
+    Serial.println(F("synch failed"));
327
+  }
328
+  /* 
329
+   Set the time for the next network NTP
330
+   time synchronization to occur.
331
+  */
332
+  NextClockSynchTime = now() + NET_SYNCH_INTERVAL;
333
+  return;
334
+}
335
+
336
+/*
337
+  Handle HTTP GET requests from an HTTP client.
338
+*/  
339
+void listenForEthernetClients()
340
+{
341
+  char sBuffer[14];
342
+  byte i;
343
+  byte iMode;
344
+  char c, d;
345
+  
346
+  // listen for incoming clients
347
+  EthernetClient client = httpServer.available();
348
+  if (client) {
349
+    if (bVerbose) Serial.print("\n");
350
+    Serial.println(F("client request"));
351
+    i = 0;
352
+    sBuffer[0] = 0;
353
+    iMode = 0;
354
+    d = 0;
355
+  
356
+    while(client.connected() && client.available()) {
357
+      c = client.read();
358
+      /*
359
+       * The end of an HTTP client request is always signaled by a
360
+       * blank line, that is, by two consecutive line feed and carriage 
361
+       * return characters "\r\n\r\n".  The following two lines of code 
362
+       * look for this condition.
363
+       */
364
+      if(c == '\n' && d == '\n') break; //end of HTTP client request
365
+      if (c != '\r') d = c; // ignore carriage return characters
366
+
367
+      if (bVerbose) {
368
+        Serial.write(c);
369
+      }
370
+      // prevent buffer overruns
371
+      if (i < 13) {
372
+        sBuffer[i++] = c;
373
+        sBuffer[i] = 0;
374
+      }
375
+      // request for JSON string response
376
+      if(strcmp(sBuffer, "GET /jsdata ") == 0) {
377
+        iMode = 1;
378
+      }
379
+      // request for standard HTML document
380
+      if(strcmp(sBuffer, "GET / ") == 0) {
381
+        iMode = 2;
382
+      }
383
+    }
384
+    /*
385
+     Send a standard HTTP response header to the
386
+     client's GET request.
387
+    */
388
+    client.println(F("HTTP/1.1 200 OK\n"        \
389
+                   "Content-Type: text/html\n"  \
390
+                   "Connnection: close\n"       \
391
+               //  "Refresh: 10\n"              \
392
+                   "\n"                         \
393
+                   ));
394
+                   
395
+    switch (iMode) {
396
+      case 0:
397
+        // Respond to an invalid URL received from the client
398
+        client.print(F("<!DOCTYPE HTML>\n" \
399
+                       "<HTML><HEAD><TITLE>Radmon</TITLE></HEAD>"  \
400
+                       "<BODY><H2>Invalid URL</H2>"  \
401
+                       "<P> You have reached a server at an unknown " \
402
+                       "URL.  If you think you made this request in error " \
403
+                       "please disconnect and try your request again.</P>" \
404
+                       "</BODY></HTML>"));
405
+        break;
406
+      case 1:
407
+        transmitJson(client);
408
+        break;
409
+      case 2:
410
+        transmitWebPage(client);
411
+        break;
412
+    }
413
+    // give the web browser time to receive the data
414
+    delay(5);
415
+    // close the connection:
416
+    client.stop();
417
+    if (bVerbose) {
418
+      Serial.print(F("client disconnected\r\n\n"));
419
+    }
420
+  }
421
+  return;
422
+}
423
+
424
+/*
425
+ Send to the client the MightyOhm Geiger counter's
426
+ current readings, embedded in an HTML document.
427
+*/
428
+void transmitWebPage(EthernetClient client)
429
+{
430
+  char strBuffer[MIGHTYOHM_DATA_STRING_LENGTH];
431
+
432
+  strcpy(strBuffer, MightyOhmData);
433
+  /*
434
+   * Send the actual HTML page the user will see in their web
435
+   * browser.
436
+  */
437
+  client.print(F("<!DOCTYPE HTML>\n" \
438
+                 "<HTML><HEAD><TITLE>Radmon</TITLE>"  \
439
+                 "</HEAD><BODY><H2>Radiation Monitor</H2>" \
440
+                 "<P><A HREF=\"http://intravisions.com/radmon/\">" \
441
+                 "<I>IntraVisions.com/radmon</I></A></P>" \
442
+                 "<HR><FONT SIZE=\"+1\">"));
443
+  /* Data Items */             
444
+  client.print(F("<PRE>UTC&#9;"));
445
+  client.print(strtok(strBuffer, " "));
446
+  client.print(F(" "));
447
+  client.print(strtok(NULL, ", "));
448
+  client.print(F("<BR>"));
449
+  client.print(strtok(NULL, ", "));
450
+  client.print(F("&#9;"));
451
+  client.print(strtok(NULL, ", "));
452
+  client.print(F("<BR>"));
453
+  client.print(strtok(NULL, ", "));
454
+  client.print(F("&#9;"));
455
+  client.print(strtok(NULL, ", "));
456
+  client.print(F("<BR>"));
457
+  client.print(strtok(NULL, ", "));
458
+  client.print(F("&#9;"));
459
+  client.print(strtok(NULL, ", "));
460
+  client.print(F("<BR>"));
461
+  client.print(F("Mode&#9;"));
462
+  client.print(strtok(NULL, ", "));
463
+  client.print(F("<BR></PRE></FONT></BODY></HTML>"));
464
+  return;
465
+}  
466
+
467
+/*
468
+ Send to the client the MightyOhm Geiger counter's
469
+ current readings, embedded in a JSON compatible string.
470
+*/
471
+void transmitJson(EthernetClient client) {
472
+  char strBuffer[MIGHTYOHM_DATA_STRING_LENGTH];
473
+
474
+  strcpy(strBuffer, MightyOhmData);
475
+  /*
476
+   * Format and transmit a JSON compatible data string.
477
+   */
478
+  client.print(F("[{\"radmon\":\"$,UTC="));
479
+  client.print(strtok(strBuffer, " "));
480
+  client.print(F(" "));
481
+  client.print(strtok(NULL, ", "));
482
+  client.print(F(","));
483
+  client.print(strtok(NULL, ", "));
484
+  client.print(F("="));
485
+  client.print(strtok(NULL, ", "));
486
+  client.print(F(","));
487
+  client.print(strtok(NULL, ", "));
488
+  client.print(F("="));
489
+  client.print(strtok(NULL, ", "));
490
+  client.print(F(","));
491
+  client.print(strtok(NULL, ", "));
492
+  client.print(F("="));
493
+  client.print(strtok(NULL, ", "));
494
+  client.print(F(","));
495
+  client.print(F("Mode="));
496
+  client.print(strtok(NULL, ", "));
497
+  client.print(F(",#,\"}]"));
498
+  return;
499
+}
500
+
501
+/*
502
+   Process bytes received from the MightyOhm Geiger counter,
503
+   one at a time, to create a well formed string.
504
+*/
505
+void processRxByte( char RxByte )
506
+{
507
+  static char readBuffer[MIGHTYOHM_DATA_STRING_LENGTH];
508
+  static byte cIndex = 0;
509
+  
510
+  /*
511
+     Discard carriage return characters.
512
+  */
513
+  if (RxByte == '\r')
514
+  {
515
+    return;
516
+  }
517
+  /*
518
+   A new line character indicates the line of data from
519
+   the MightyOhm is complete and can be written to the
520
+   MightyOhm data buffer.
521
+  */
522
+  else if (RxByte == '\n')
523
+  {
524
+    /*
525
+     First copy the timestamp to the MightyOhm data buffer. The "CPS"
526
+     characters are not preserved in the temporary read buffer, so
527
+     restore them to the MightyOhm data buffer, as well.
528
+    */
529
+    sprintf( MightyOhmData, "%d:%02d:%02d %d/%d/%d, %s",       \
530
+          hour(), minute(), second(), month(), day(), year(),  \
531
+          MIGHTYOHM_DATA_STRING_HEADER );
532
+    /*
533
+     Now copy the rest of the data in the temporary read buffer to the
534
+     MightyOhm data buffer.
535
+    */ 
536
+    strcat(MightyOhmData, readBuffer);
537
+    /*
538
+     Flush the temporary read buffer.
539
+    */
540
+    cIndex = 0;
541
+    readBuffer[0] = 0;
542
+    return;
543
+  }
544
+  /* 
545
+   A new line of data will always have "CPS" as the first
546
+   three characters.  Therefore, when these characters occur in
547
+   sequence, the read buffer should begin collecting characters.
548
+   This is a kluge to deal with an inherent problem in the Software
549
+   Serial library implementation that results in characters dropped
550
+   from the software serial stream buffer.
551
+  */
552
+  if( strstr(readBuffer, MIGHTYOHM_DATA_STRING_HEADER) > 0 ) 
553
+  {
554
+    cIndex = 0;
555
+  }
556
+  /*
557
+   Read characters into a temporary buffer until
558
+   the line of data is complete or the buffer is full.
559
+  */
560
+  if(cIndex < MIGHTYOHM_DATA_STRING_LENGTH)
561
+  {
562
+    readBuffer[cIndex] = RxByte;
563
+    cIndex += 1;
564
+    readBuffer[cIndex] = 0;
565
+  }
566
+  return;
567
+} 
568
+
569
+/* 
570
+  Send a UDP request packet to an NTP time server and listen for a reply.
571
+  When the reply arrives, parse the received UPD packet and compute unix
572
+  epoch time.  Then set the local system clock to the epoch time.
573
+*/
574
+int syncToNetworkTime()
575
+{
576
+  /*
577
+   Send a request to the NTP time server.
578
+  */
579
+  byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold outgoing and incoming packets 
580
+  /*
581
+   Send an NTP packet to the time server and allow for network lag
582
+   before checking if a reply is available.
583
+  */
584
+  sendNTPpacket(packetBuffer);
585
+  delay(2000);  // allow 2000 milli-seconds for network lag
586
+
587
+  /*
588
+   Wait for response from NTP time server.
589
+  */
590
+  if ( Udp.parsePacket() )
591
+  {  
592
+    /*
593
+     A UDP packet has arrived, so read the data from it.
594
+    */
595
+    Udp.read( packetBuffer, NTP_PACKET_SIZE );
596
+    /*
597
+     The timestamp starts at byte 40 of the received packet and is four bytes,
598
+     or two words, long. First, esxtract the two words.
599
+    */
600
+    unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
601
+    unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
602
+    /*  
603
+     Combine the four bytes (two words) into a long integer
604
+     this is NTP time (seconds since Jan 1 1900).
605
+    */
606
+    unsigned long secsSince1900 = highWord << 16 | lowWord;
607
+    /*  
608
+     Now convert NTP time into UTC time.  Note that
609
+     Unix time starts on Jan 1 1970. In seconds,
610
+     that's 2208988800.  Therfore,
611
+     
612
+         epoch = secsSince1900 - 2208988800UL
613
+         
614
+     Set the local system clock with this value.
615
+    */
616
+    setTime(secsSince1900 - 2208988800UL);
617
+    return 1;
618
+  }
619
+  else
620
+  {
621
+    return 0;
622
+  } /* end if */
623
+}
624
+
625
+/*
626
+  Send an NTP request to the NTP time server.
627
+*/
628
+void sendNTPpacket( byte* packetBuffer )
629
+{
630
+  /*
631
+   Set all bytes in the buffer to 0.
632
+  */
633
+  memset( packetBuffer, 0, NTP_PACKET_SIZE );
634
+  /*
635
+   Initialize values needed to form NTP request.
636
+  */
637
+  packetBuffer[0] = 0b11100011;  // LI, Version, Mode
638
+  packetBuffer[1] = 0;           // Stratum, or type of clock
639
+  packetBuffer[2] = 6;           // Polling Interval
640
+  packetBuffer[3] = 0xEC;        // Peer Clock Precision
641
+  /*
642
+   Set the remaining 8 bytes to zero for Root Delay & Root Dispersion.
643
+  */
644
+  packetBuffer[12]  = 49; 
645
+  packetBuffer[13]  = 0x4E;
646
+  packetBuffer[14]  = 49;
647
+  packetBuffer[15]  = 52;
648
+  /*
649
+   All NTP fields have been given values, so now
650
+   send a packet requesting a timestamp.
651
+  */ 		
652
+  Udp.beginPacket( ntpip, 123 ); //NTP requests are to port 123
653
+  Udp.write( packetBuffer, NTP_PACKET_SIZE );
654
+  Udp.endPacket();
655
+  return;
656
+}
657
+
658
+/***  COMMAND LINE INTERFACE  ***/
659
+
660
+/*
661
+ Print a command menu to the USB port.  Then wait for a
662
+ response from the user.  When the response has been
663
+ received, execute the command.
664
+*/
665
+void commandMode()
666
+{
667
+  char sCmdBuf[2];
668
+  
669
+  getCurrentIP();  //used for display of settings
670
+  
671
+  while(true)
672
+  {
673
+    /*
674
+     Print the menu.
675
+    */
676
+    Serial.print( F("\n"                         \
677
+                  "1 - view settings\r\n"        \
678
+                  "2 - set IP address\r\n"       \
679
+                  "3 - set NTP server\r\n"       \
680
+                  "4 - toggle verbose\r\n"       \
681
+                  "5 - exit without saving\r\n"  \
682
+                  "6 - save & restart\r\n"       \
683
+                  ">"));
684
+    /*
685
+     Get the command from the user.
686
+    */
687
+    getSerialLine(sCmdBuf, 2);
688
+    Serial.print(F("\n\n\r"));
689
+    /* 
690
+     Execute the command.
691
+    */
692
+    switch (sCmdBuf[0])
693
+    {
694
+      case '1':
695
+        displaySettings();
696
+        break;
697
+      case '2':
698
+        setIP();
699
+        break;
700
+      case '3':
701
+        setNTPIP();
702
+        break;
703
+      case '4':
704
+        toggleVerbose();
705
+        break;
706
+      case '5':
707
+        readSettingsFromEEPROM();
708
+        return;
709
+      case '6':
710
+        writeSettingsToEEPROM();
711
+        /*
712
+         A software reboot is necessary to force the 
713
+         Arduino to request an IP address from a DHCP
714
+         server or to initialize the Ethernet interface
715
+         with a static IP address.
716
+        */
717
+        software_Reset();
718
+        return;
719
+      default:
720
+        Serial.println(F("invalid command"));
721
+    } /* end switch */
722
+  } /* end while */
723
+  return;
724
+}
725
+
726
+/*
727
+ Displays the current system settings.  Displays
728
+ RadMon software version, local IP address, NTP server
729
+ address, and verbose mode setting.
730
+*/
731
+void displaySettings()
732
+{
733
+  char sBuf[16];
734
+  
735
+  // Display RadMon version
736
+  Serial.print(F("Firmware "));
737
+  Serial.print(F(RADMON_VERSION));
738
+  Serial.println();
739
+
740
+  // Display local IP address
741
+  sprintf(sBuf, "%d.%d.%d.%d", ipAddr[0], ipAddr[1], ipAddr[2], ipAddr[3]);
742
+  if (bUseDHCP)
743
+  {
744
+    Serial.print(F("DHCP IP: "));
745
+  }
746
+  else
747
+  {
748
+    Serial.print(F("Static IP: "));
749
+  }
750
+  Serial.println(sBuf);
751
+  
752
+  // Display NTP server IP address
753
+  sprintf(sBuf, "%d.%d.%d.%d", ntpip[0], ntpip[1], ntpip[2], ntpip[3]);
754
+  Serial.print(F("NTP server: ")); 
755
+  Serial.println(sBuf);
756
+
757
+  // Display verbose mode setting
758
+  printVerboseMode();
759
+  return;
760
+}
761
+
762
+/*
763
+ Sets the local IP address. If the user sends a carriage
764
+ return as the first character, then switch to acquiring
765
+ IP address via DHCP server.
766
+*/
767
+void setIP()
768
+{
769
+  char sBuf[16];
770
+
771
+  Serial.print(F("enter IP (<CR> for DHCP): "));
772
+  getSerialLine(sBuf, 16);
773
+  
774
+  if(strlen(sBuf) == 0)
775
+  {
776
+    bUseDHCP = true;
777
+    parseIpAddress(ipAddr, "0.0.0.0");
778
+  }
779
+  else
780
+  {
781
+    bUseDHCP = false;
782
+    parseIpAddress(ipAddr, sBuf);
783
+  }
784
+  Serial.println();
785
+  return;
786
+}
787
+
788
+/*
789
+ Sets the NTP server IP address.  If the user sends a
790
+ carriage return as the first character, then use the
791
+ default IP address for the NTP server.
792
+*/
793
+void setNTPIP()
794
+{
795
+  char sBuf[16];
796
+  
797
+  Serial.print(F("enter IP: "));
798
+  getSerialLine(sBuf, 16);
799
+  
800
+  if (strlen(sBuf) == 0)
801
+  {
802
+    parseIpAddress(ntpip, DEFAULT_NTP_SERVER_IP_ADDR);
803
+  }
804
+  else
805
+  {
806
+    parseIpAddress(ntpip, sBuf);
807
+  }
808
+  Serial.println();
809
+  return;
810
+}
811
+
812
+/*
813
+ Turns verbose mode ON or OFF.
814
+*/
815
+void toggleVerbose()
816
+{
817
+  bVerbose = !bVerbose;
818
+  printVerboseMode();
819
+  return;
820
+}
821
+
822
+/***  GENERAL HELPER FUNCTIONS  ***/
823
+
824
+/*
825
+ Print current verbose mode.
826
+*/
827
+void printVerboseMode()
828
+{
829
+  Serial.print(F("Verbose: "));
830
+  if (bVerbose)
831
+  {
832
+    Serial.println(F("ON"));
833
+  }
834
+  else
835
+  {
836
+    Serial.println(F("OFF"));
837
+  }
838
+  return;
839
+}
840
+
841
+/*
842
+ Get the current IP address from the Ethernet interface
843
+*/
844
+void getCurrentIP()
845
+{
846
+  ipAddr[0] = Ethernet.localIP()[0];
847
+  ipAddr[1] = Ethernet.localIP()[1];
848
+  ipAddr[2] = Ethernet.localIP()[2];
849
+  ipAddr[3] = Ethernet.localIP()[3];
850
+  return;
851
+}
852
+
853
+/*
854
+ Gets a line of data from the user via USB port.
855
+*/
856
+char* getSerialLine(char* sBuffer, int bufferLength)
857
+{
858
+  byte index;
859
+  char cRx;
860
+
861
+  /* 
862
+   Discard extranious characters that may still be in the
863
+   USB serial stream read buffer.  Most often these characters
864
+   will be unprocessed carriage return or line feed characters.
865
+  */
866
+  delay(10);
867
+  while (Serial.available())
868
+  {
869
+    cRx = Serial.read();
870
+  }
871
+
872
+  /*
873
+   Read and process characters from the user as they arrive in
874
+   the USB serial read buffer.
875
+  */
876
+  index = 0;
877
+  while(true)
878
+  {
879
+    /*
880
+     Wait until the user starts pressing keys and bytes
881
+     arrive in the serial read buffer.
882
+    */
883
+    if (Serial.available())
884
+    {
885
+      cRx = Serial.read();
886
+      if (cRx == '\r' || cRx == '\n')
887
+      {
888
+        /*
889
+         The user has finished typing the command and
890
+         has pressed the Enter key. So, discard the
891
+         carriage return and newline characters and then
892
+         return control to the calling function.
893
+        */
894
+        break;
895
+      }
896
+      else if (cRx == 8 || cRx == 127)
897
+      {
898
+        if (index > 0)
899
+        {
900
+          /*
901
+           The user has hit the delete-backspace key,
902
+           so send out a backspace, followed by a space,
903
+           followed by another backspace character.
904
+           This allows for in-line ediiting.
905
+          */
906
+          Serial.write(8);
907
+          Serial.write(32);
908
+          Serial.write(8); 
909
+          index -= 1;
910
+        }
911
+      }
912
+      else if ( index < (bufferLength - 1) )
913
+      {
914
+        /*
915
+         The received character is valid, so write it
916
+         to the buffer. Once the buffer becomes full
917
+         do not write any more characters to it.  When
918
+         the user pressses the enter key, the string
919
+         will be null terminated and control will pass
920
+         back to the calling function.
921
+        */
922
+        Serial.write(cRx); // echo character to terminal
923
+        sBuffer[index] = cRx;
924
+        index += 1;
925
+      } /* end if */
926
+    } /* end if */
927
+  } /* end while */
928
+  sBuffer[index] = 0; // terminate the string
929
+  return sBuffer;
930
+}
931
+
932
+/*
933
+ Writes system configuration settings to non-volitile
934
+ EEPROM.  The items written are the local IP address,
935
+ the NTP server IP address, the state of verbose mode,
936
+ and local IP mode (static or DHCP).
937
+*/
938
+void writeSettingsToEEPROM()
939
+{
940
+  byte ix;
941
+  for (ix = 0; ix < 4; ix++)
942
+  {
943
+    EEPROM.write(ix, ipAddr[ix]);
944
+    EEPROM.write(ix + 4, ntpip[ix]);
945
+  }
946
+  EEPROM.write(8, bVerbose);
947
+  EEPROM.write(9, bUseDHCP);
948
+  return;
949
+}
950
+
951
+/*
952
+ Reads system configuration settings from non-volitile
953
+ EEPROM.  The items read are the local IP address,
954
+ the NTP server IP address, the state of verbose mode,
955
+ and local IP mode (static or DHCP).
956
+*/
957
+void readSettingsFromEEPROM()
958
+{
959
+  byte ix;
960
+  for (ix = 0; ix < 4; ix++)
961
+  {
962
+    ipAddr[ix] = EEPROM.read(ix);
963
+    ntpip[ix] = EEPROM.read(ix + 4);
964
+  }
965
+  bVerbose = EEPROM.read(8);
966
+  bUseDHCP = EEPROM.read(9);
967
+  return;
968
+}
969
+
970
+/*
971
+ Parses an IP address given in "nnn.nnn.nnn.nnn" string
972
+ format into four bytes and stores them in an array. Note
973
+ that this function destroys the contents of the sIP
974
+ character array.  Therefore this array cannot be
975
+ reinitialized after calling this function.
976
+*/
977
+void parseIpAddress(byte* byBuf, char* sIP)
978
+{
979
+  byBuf[0] = atoi(strtok(sIP, "."));
980
+  byBuf[1] = atoi(strtok(NULL, "."));
981
+  byBuf[2] = atoi(strtok(NULL, "."));
982
+  byBuf[3] = atoi(strtok(NULL, "."));
983
+  return;
984
+}
985
+
986
+/*
987
+ Restarts the Uno and runs this program from beginning.  This
988
+ function gets called after a change made from the user
989
+ interface when the user selects "save and restart".
990
+*/
991
+void software_Reset() 
992
+{
993
+  asm volatile ("  jmp 0");
994
+  return; 
995
+}  
996
+
0 997
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+Background Radiation Monitoring Device
2
+
3
+Building a simple background radiation monitor provides an excellent introduction to "Internet of Things" ideas and concepts.  This project site contains all you need to know in order to build your own background radiation monitor - a Geiger counter "Internet Thing" - for under $150 in parts. 
4
+
5
+Building the background radiation monitor will give you an excellent introduction to a variety of technologies. You will learn about programming Arduino micro-controllers and assembling electronic components. You will learn about Linux server software, scripting for Internet applications, and displaying information with a web page.
6
+
7
+You can find all the required software available under open source, GNU license at this project site. Please read the project description document for details on procuring the materials, assembling the background radiation monitor and installing the software.
8
+
9
+This project encompasses two software components. One component runs on the Arduino Uno with attached Ethernet shield. The other component runs on a Linux web server. Besides the Arduino Uno with attached Ethernet shield, the other required component is a modified Mighty Ohm Geiger counter.
10
+
0 11
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+#!/usr/bin/python -u
2
+## The -u option above turns off block buffering of python output. This assures
3
+## that each error message gets individually printed to the log file.
4
+#
5
+# Module: createRadmonRrd.py
6
+#
7
+# Description: Creates a rrdtool database for use by the weather agent to
8
+# store the data from the weather station.  The agent uses the data in the
9
+# database to generate graphic charts for display in the weather station
10
+# web page.
11
+#
12
+# Copyright 2014 Jeff Owrey
13
+#    This program is free software: you can redistribute it and/or modify
14
+#    it under the terms of the GNU General Public License as published by
15
+#    the Free Software Foundation, either version 3 of the License, or
16
+#    (at your option) any later version.
17
+#
18
+#    This program is distributed in the hope that it will be useful,
19
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+#    GNU General Public License for more details.
22
+#
23
+#    You should have received a copy of the GNU General Public License
24
+#    along with this program.  If not, see http://www.gnu.org/license.
25
+#
26
+# Revision History
27
+#   * v10 released 15 Sep 2015 by J L Owrey
28
+#
29
+import os
30
+import time
31
+import subprocess
32
+
33
+    ### DEFINE FILE LOCATIONS ###
34
+
35
+_RRD_FILE = "/home/pi/database/radmonData.rrd"  # the file that stores the data
36
+_RRD_SIZE_IN_DAYS = 370 # days
37
+_DATABASE_UPDATE_INTERVAL = 30
38
+
39
+def createRrdFile():
40
+    """Create the rrd file if it does not exist.
41
+       Parameters: none
42
+       Returns: True, if successful
43
+    """
44
+
45
+    if os.path.exists(_RRD_FILE):
46
+        print "rrdtool radiation database file already exists"
47
+        return True
48
+
49
+    dbUpdateInterval = _DATABASE_UPDATE_INTERVAL  # rrd update step in seconds
50
+    rrd1yearSteps = 30 # steps per day for longer time periods
51
+
52
+    dataItemEpochTime = long(time.mktime(time.localtime())) 
53
+    rrdfileStartTime = dataItemEpochTime - 10
54
+    heartBeat = 2 * dbUpdateInterval
55
+    rrd24hrRows = int(86400 / dbUpdateInterval)
56
+    rrd1yearRows = int(3600 * 24 * _RRD_SIZE_IN_DAYS / (dbUpdateInterval * rrd1yearSteps))
57
+       
58
+    strFmt = ("rrdtool create %s --start %s --step %s "
59
+               "DS:CPM:GAUGE:%s:U:U DS:SvperHr:GAUGE:%s:U:U "
60
+               "RRA:AVERAGE:0.5:1:%s RRA:AVERAGE:0.5:%s:%s")
61
+
62
+    strCmd = strFmt % (_RRD_FILE, rrdfileStartTime, dbUpdateInterval, \
63
+                heartBeat, heartBeat, rrd24hrRows, rrd1yearSteps, rrd1yearRows)
64
+
65
+    print "creating rrdtool radiation database...\n\n%s\n" % strCmd
66
+
67
+    # Spawn a sub-shell and run the command
68
+    try:
69
+        subprocess.check_output(strCmd, stderr=subprocess.STDOUT, \
70
+                                shell=True)
71
+    except subprocess.CalledProcessError, exError:
72
+        print "%s rrdtool create failed: %s" % \
73
+                            (getTimeStamp(), exError.output)
74
+        return False
75
+    return True
76
+##end def
77
+
78
+def main():
79
+    createRrdFile()
80
+## end def
81
+
82
+if __name__ == '__main__':
83
+    main()
84
+        
0 85
new file mode 100644
... ...
@@ -0,0 +1,408 @@
1
+#!/usr/bin/python -u
2
+## The -u option above turns off block buffering of python output. This assures
3
+## that each error message gets individually printed to the log file.
4
+#
5
+# Module: radmonAgent.py
6
+#
7
+# Description: This module acts as an agent between the radiation monitoring device
8
+# and the Internet web server.  The agent periodically sends an http request to the
9
+# radiation monitoring device and processes the response from the device and performs
10
+# a number of operations:
11
+#     - conversion of data items
12
+#     - update a round robin (rrdtool) database with the radiation data
13
+#     - periodically generate graphic charts for display in html documents
14
+#     - forward the radiation data to other services
15
+#     - write the processed weather data to a JSON file for use by html documents
16
+#
17
+# Copyright 2015 Jeff Owrey
18
+#    This program is free software: you can redistribute it and/or modify
19
+#    it under the terms of the GNU General Public License as published by
20
+#    the Free Software Foundation, either version 3 of the License, or
21
+#    (at your option) any later version.
22
+#
23
+#    This program is distributed in the hope that it will be useful,
24
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
+#    GNU General Public License for more details.
27
+#
28
+#    You should have received a copy of the GNU General Public License
29
+#    along with this program.  If not, see http://www.gnu.org/license.
30
+#
31
+# Revision History
32
+#   * v20 released 15 Sep 2015 by J L Owrey
33
+#
34
+import urllib2
35
+import time
36
+import calendar
37
+import subprocess
38
+import sys
39
+import os
40
+import json
41
+import multiprocessing
42
+
43
+## Define constants
44
+_TMP_DIRECTORY = "/tmp/radmon"
45
+_RRD_FILE = "/home/pi/database/radmonData.rrd"  # the file that stores the data
46
+_OUTPUT_DATA_FILE = "/tmp/radmon/radmonData.js"
47
+
48
+_WEB_DATA_UPDATE_INTERVAL = 1
49
+_CHART_UPDATE_INTERVAL = 60
50
+_DATABASE_UPDATE_INTERVAL = 30
51
+_HTTP_REQUEST_TIMEOUT = 5 # number seconds to wait for a response to HTTP request
52
+
53
+## Define run time options
54
+deviceQueryInterval = 5.0  # period defines how often the RR database gets updated
55
+deviceUrl = "http://73.157.139.23:4371/jsdata"  # radiation monitor network address
56
+debugOption = False
57
+
58
+  ###  PRIVATE METHODS  ###
59
+
60
+def getTimeStamp():
61
+    """
62
+    Sets the error message time stamp to the local system time.
63
+    Parameters: none
64
+    Returns string containing the time stamp.
65
+    """
66
+    return time.strftime( "%Y/%m/%d %T", time.localtime() )
67
+##end def
68
+
69
+def sendOffLineStatusMsg():
70
+    """Sets the status of the the upstream device to "offline" and sends
71
+       blank data to the downstream clients.
72
+       Parameters: none
73
+       Returns nothing.
74
+    """
75
+    sTmp = "\"time\":\"\",\"CPS\":\"\",\"CPM\":\"\"," \
76
+           "\"uSvPerHr\":\"\",\"Mode\":\"\",\"status\":\"offline\""
77
+
78
+    lsTmp = sTmp.split(',')
79
+    writeJSONfile(lsTmp)
80
+    return
81
+##end def
82
+
83
+  ###  PUBLIC METHODS  ###
84
+
85
+def getDataString(deviceUrl, HttpRequestTimeout):
86
+        """Send http request to radiation monitoring device.  The response
87
+           from the device contains the radiation data.  The data is formatted
88
+           as an html document.
89
+        Parameters: 
90
+            deviceUrl - url of radiation monitoring device
91
+            HttpRequesttimeout - how long to wait for device
92
+                                 to respond to http request
93
+        Returns a string containing the radiation data, or None if
94
+        not successful.
95
+        """
96
+        content = ""
97
+        try:
98
+            conn = urllib2.urlopen(deviceUrl, timeout=HttpRequestTimeout)
99
+        except Exception, exError:
100
+            # If no response is received from the device, then assume that
101
+            # the device is down or unavailable over the network.  In
102
+            # that case set the status of the device to offline.
103
+            print "%s: device offline: %s" % \
104
+                                (getTimeStamp(), exError)
105
+            sendOffLineStatusMsg()
106
+            return None
107
+        else:
108
+            for line in conn:
109
+                content += line.strip()
110
+            if len(content) == 0:
111
+                print "%s: HTTP download failed: null content" % \
112
+                    (getTimeStamp())
113
+                return None
114
+            del conn
115
+            
116
+            if debugOption:
117
+                print "%s\n" % content # DEBUG
118
+            return content
119
+##end def
120
+
121
+def parseDataString(sData, lsData, dData):
122
+    """Parse the radiation data JSON string from the radiation 
123
+       monitoring device into its component parts.  
124
+       Parameters:
125
+           sData - the string containing the data to be parsed
126
+          lsData - a list object to contain the parsed data items
127
+           dData - a dictionary object to contain the parsed data items
128
+       Returns true if successful, false otherwise.
129
+    """
130
+    # Clear data array in preparation for loading reformatted data.
131
+    while len(lsData) > 0:
132
+        elmt = lsData.pop(0)
133
+
134
+    try:
135
+        dTmp = json.loads(sData[1:-1])
136
+        sTmp = dTmp['radmon'].encode('ascii', 'ignore')
137
+        lsTmp = sTmp.split(',')
138
+        lsData.extend(lsTmp)
139
+    except Exception, exError:
140
+        print "%s parse failed: %s" % (getTimeStamp(), exError)
141
+        return False
142
+
143
+    # Since the device responded, set the status to online.
144
+    lsData.insert(-2, "status=online")
145
+
146
+    # Load the parsed data into a dictionary for easy access.
147
+    for item in lsData:
148
+        if "=" in item:
149
+            dData[item.split('=')[0]] = item.split('=')[1]
150
+
151
+    if debugOption and 0:
152
+        print lsData
153
+        print dData
154
+    return True
155
+##end def
156
+
157
+def convertData(lsData, dData):
158
+    """Convert individual radiation data items as necessary.
159
+       Parameters:
160
+           lsData - a list object containing the radiation data
161
+           dData - a dictionary object containing the radiation data
162
+       Returns true if successful, false otherwise.
163
+    """
164
+    result = True
165
+ 
166
+    try:
167
+        # Convert UTC from radiation monitoring device to local time.
168
+        ts_utc = time.strptime(dData['UTC'], "%H:%M:%S %m/%d/%Y")
169
+        local_sec = calendar.timegm(ts_utc)
170
+        dData['UTC'] = local_sec
171
+    except:
172
+        print "%s invalid time: %s" % (getTimeStamp(), utc)
173
+        result = False
174
+
175
+    # Clear data array in preparation for loading reformatted data.
176
+    while len(lsData) > 0:
177
+        elmt = lsData.pop(0)
178
+
179
+    lsData.append("\"UTC\":\"%s\"" % dData['UTC'])
180
+    lsData.append("\"CPS\":\"%s\"" % dData['CPS'])
181
+    lsData.append("\"CPM\":\"%s\"" % dData['CPM'])
182
+    lsData.append("\"uSvPerHr\":\"%s\"" % dData['uSv/hr'])
183
+    lsData.append("\"Mode\":\"%s\"" % dData['Mode'].lower())
184
+    lsData.append("\"status\":\"%s\"" % dData['status'])
185
+
186
+    return result
187
+##end def
188
+
189
+def writeJSONfile(lsData):
190
+    """Convert individual weather string data items as necessary.
191
+       Parameters:
192
+           lsData - a list object containing the data to be written
193
+                    to the JSON file
194
+       Returns true if successful, false otherwise.
195
+    """
196
+    # Convert the list object to a string.
197
+    sTmp = ','.join(lsData)
198
+
199
+    # Apply JSON formatting to the string and write it to a
200
+    # file for use by html documents.
201
+    strJSON = "[{%s}]\n" % (sTmp)
202
+
203
+    try:
204
+        fc = open(_OUTPUT_DATA_FILE, "w")
205
+        fc.write(strJSON)
206
+        fc.close()
207
+    except Exception, exError:
208
+        print "%s: write to JSON file failed: %s" % \
209
+                             (getTimeStamp(), exError)
210
+        return False
211
+    return True
212
+## end def
213
+
214
+def updateDatabase(dData):
215
+    """
216
+    Updates the rrdtool database by executing an rrdtool system command.
217
+    Formats the command using the data extracted from the radiation
218
+    monitor response.   
219
+    Parameters: dData - dictionary object containing data items to be
220
+                        written to the rr database file
221
+    Returns true if successful, false otherwise.
222
+    """
223
+    # The RR database stores whole units, so convert uSv to Sv.   
224
+    Svvalue = float(dData['uSv/hr']) * 1.0E-06 # convert micro-Sieverts to Sieverts
225
+
226
+    # Create the rrdtool update command.
227
+    strCmd = "rrdtool update %s %s:%s:%s" % \
228
+                       (_RRD_FILE, dData['UTC'], dData['CPM'], Svvalue)
229
+    if debugOption:
230
+        print "%s\n" % strCmd # DEBUG
231
+
232
+    # Run the command as a subprocess.
233
+    try:
234
+        subprocess.check_output(strCmd, shell=True,  \
235
+                             stderr=subprocess.STDOUT)
236
+    except subprocess.CalledProcessError, exError:
237
+        print "%s: rrdtool update failed: %s" % \
238
+                                 (getTimeStamp(), exError.output)
239
+        return False
240
+
241
+    return True
242
+##end def
243
+
244
+def createGraph(fileName, dataItem, gTitle, gStart):
245
+    """Uses rrdtool to create a graph of specified weather data item.
246
+       Parameters:
247
+           fileName - name of graph image file
248
+           dataItem - data item to be graphed
249
+           gTitle - a title for the graph
250
+           gStart - beginning time of the data to be graphed
251
+       Returns true if successful, false otherwise.
252
+    """
253
+    gPath = _TMP_DIRECTORY + '/' + fileName + ".png"
254
+
255
+    # Create the rrdtool graph command.
256
+    strFmt = ("rrdtool graph %s -a PNG -s %s -w 600 -h 150 "
257
+                           ##  "-l 50 -u 110 -r "
258
+                               "-v %s -t %s "
259
+                               "DEF:%s=%s:%s:AVERAGE "
260
+                               "LINE2:%s\#0400ff:")         
261
+    strCmd = strFmt % (gPath, gStart, dataItem, gTitle, dataItem, \
262
+                       _RRD_FILE, dataItem, dataItem)
263
+    if debugOption:
264
+        print "%s\n" % strCmd # DEBUG
265
+    
266
+    # Run the command as a subprocess.
267
+    try:
268
+        result = subprocess.check_output(strCmd, stderr=subprocess.STDOUT, \
269
+                     shell=True)
270
+    except subprocess.CalledProcessError, exError:
271
+        print "rdtool graph failed: %s" % (exError.output)
272
+        return False
273
+
274
+    if debugOption:
275
+        print "rrdtool graph: %s" % result
276
+
277
+    return True
278
+##end def
279
+
280
+def getCLarguments():
281
+    """Get command line arguments.  There are three possible arguments
282
+          -d turns on debug mode
283
+          -t sets the radiation device query interval
284
+          -u sets the url of the radiation monitoring device
285
+       Returns nothing.
286
+    """
287
+    global debugOption, deviceQueryInterval, deviceURL
288
+
289
+    index = 1
290
+    while index < len(sys.argv):
291
+        if sys.argv[index] == '-d':
292
+            debugOption = True
293
+        elif sys.argv[index] == '-t':
294
+            try:
295
+                deviceQueryInterval = abs(int(sys.argv[index + 1]))
296
+            except:
297
+                print "invalid polling period"
298
+                exit(-1)
299
+            index += 1
300
+        elif sys.argv[index] == '-u':
301
+            deviceURL = sys.argv[index + 1]
302
+            index += 1
303
+        else:
304
+            cmd_name = sys.argv[0].split('/')
305
+            print "Usage: %s {-v} {-d}" % cmd_name[-1]
306
+            exit(-1)
307
+        index += 1
308
+##end def
309
+
310
+def generateGraphs():
311
+    """Generate graphs for display in html documents.
312
+       Parameters: none
313
+       Returns nothing.
314
+    """
315
+    createGraph('radGraph1', 'CPM', "'CPM - Last 24 Hours'", 'end-1day')
316
+    createGraph('radGraph2', 'SvperHr', "'Sv/Hr - Last 24 Hours'", 'end-1day')
317
+    createGraph('radGraph3', 'CPM', "'CPM - Last 4 Weeks'", 'end-4weeks')
318
+    createGraph('radGraph4', 'SvperHr', "'Sv/Hr - Last 4 Weeks'", 'end-4weeks')
319
+    createGraph('radGraph5', 'CPM', "'CPM - Past Year'", 'end-12months')
320
+    createGraph('radGraph6', 'SvperHr', "'Sv/Hr - Past Year'", 'end-12months')
321
+##end def
322
+
323
+def main():
324
+    """Handles timing of events and acts as executive routine managing all other
325
+       functions.
326
+       Parameters: none
327
+       Returns nothing.
328
+    """
329
+    lastChartUpdateTime = - 1 # last time charts generated
330
+    lastDatabaseUpdateTime = -1 # last time the rrdtool database updated
331
+    lastWebDataUpdateTime = -1 # last time output JSON file updated
332
+    lastDeviceQueryTime = -1 # last time radiation device queried for data
333
+    dData = {}  # dictionary object for temporary data storage
334
+    lsData = [] # list object for temporary data storage
335
+
336
+    ## Get command line arguments.
337
+    getCLarguments()
338
+
339
+    ## Create www data folder if it does not already exist.
340
+    if not os.path.isdir(_TMP_DIRECTORY):
341
+        os.makedirs(_TMP_DIRECTORY)
342
+
343
+    ## Exit with error if cannot find the rrdtool database file.
344
+    if not os.path.exists(_RRD_FILE):
345
+        print "cannot find rrdtool database file: terminating"
346
+        exit(1)
347
+ 
348
+    ## main loop
349
+    while True:
350
+
351
+        currentTime = time.time()
352
+
353
+        # At the radiation device query interval request and process
354
+        # the data from the device.
355
+        if currentTime - lastDeviceQueryTime > deviceQueryInterval:
356
+            lastDeviceQueryTime = currentTime
357
+            result = True
358
+
359
+            # Get the data string from the device.
360
+            sData = getDataString(deviceUrl, _HTTP_REQUEST_TIMEOUT)
361
+            if sData == None:
362
+                result = False
363
+
364
+            # If successful parse the data.
365
+            if result:
366
+                result = parseDataString(sData, lsData, dData)
367
+
368
+            # If parsing successful, convert the data.
369
+            if result:
370
+                result = convertData(lsData, dData)
371
+                
372
+        # At the web update interval, update the JSON file used to pass
373
+        # radiation data to html documents.
374
+        if currentTime - lastWebDataUpdateTime > _WEB_DATA_UPDATE_INTERVAL:
375
+            lastWebDataUpdateTime = currentTime
376
+            if result:
377
+                lsData[0] = "\"time\":\"%s\"" % getTimeStamp()
378
+                writeJSONfile(lsData)
379
+
380
+        # At the rrdtool database update interval, update the database.
381
+        if currentTime - lastDatabaseUpdateTime > _DATABASE_UPDATE_INTERVAL:   
382
+            if result:
383
+                lastDatabaseUpdateTime = currentTime
384
+                ## Update the round robin database with the parsed data.
385
+                result = updateDatabase(dData)
386
+
387
+        # At the chart generation interval, generate charts.
388
+        if currentTime - lastChartUpdateTime > _CHART_UPDATE_INTERVAL:
389
+            lastChartUpdateTime = currentTime
390
+            p = multiprocessing.Process(target=generateGraphs, args=())
391
+            p.start()
392
+
393
+        # Relinquish processing back to the operating system until
394
+        # the next update interval.
395
+
396
+        elapsedTime = time.time() - currentTime
397
+        if debugOption:
398
+            print "processing time: %s\n" % elapsedTime
399
+        remainingTime = _WEB_DATA_UPDATE_INTERVAL - elapsedTime
400
+        if remainingTime > 0:
401
+            time.sleep(remainingTime)
402
+             
403
+    ## end while
404
+## end def
405
+
406
+if __name__ == '__main__':
407
+    main()
408
+        
0 409
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+#!/bin/bash
2
+#
3
+APP_PATH="/home/pi/bin/"
4
+LOG_PATH=/tmp/log
5
+
6
+cd $APP_PATH
7
+
8
+# First start up RR database update app
9
+
10
+PROCESS_ID="$(ps x | awk '/[r]admonAgent.py/{print $1}')"
11
+if [ -n "$PROCESS_ID" ]; then
12
+  printf "radmon agent running [%s]\n" $PROCESS_ID
13
+else
14
+  ./radmonAgent.py -t 5 -u 'http://73.157.139.23:4371' >> $LOG_PATH/radmonAgent.log 2>&1 &
15
+fi
0 16
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+
3
+# Next stop the database update process.
4
+
5
+PROCESS_ID="$(ps x | awk '/[r]admonAgent.py/{print $1}')"
6
+if [ -n "$PROCESS_ID" ]; then
7
+  printf "killing radmon agent [%s]\n" $PROCESS_ID
8
+  kill $PROCESS_ID
9
+else
10
+  echo radmon agent not running
11
+fi
0 12
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+The following modifications will allow the Mighty Ohm Geiger counter board to operate on 5 volts instead of 3 volts.  This modification is required in order to make the serial output of the geiger board compatible with the Arduino Uno.
2
+
3
+Modify as follows:
4
+
5
+1. Change R6 to 1K ohm
6
+2. Change R11 to 330 Ohms
7
+
8
+After making the resistor changes above the next step is wiring the Arduino to the geiger board.
9
+
10
+Power & Ground
11
+1. Connect +5v from Arduino to Geiger PCB Pulse J6 pin 1.
12
+2. Connect GND from Arduino to Geiger PCB Pulse J6 pin 3
13
+
14
+Serial Data
15
+1. Connect Arduino D5 to Geiger PCB Serial J7 pin 5
16
+
0 17
new file mode 100644
1 18
Binary files /dev/null and b/docs/MightyOhmSchematic.jpg differ
2 19
new file mode 100644
3 20
Binary files /dev/null and b/docs/RadiationMonitor.jpg differ
4 21
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+<html>
2
+<head>
3
+  <meta http-equiv="refresh" content="0; url=radmon.html">
4
+</head>
5
+</html>
0 6
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
2
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
3
+
4
+return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
5
+return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
6
+//# sourceMappingURL=jquery.min.map
0 7
\ No newline at end of file
1 8
new file mode 100644
... ...
@@ -0,0 +1,208 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<!--<META http-equiv="refresh" content="60">-->
4
+<head>
5
+  <title>DIY Radiation Monitor</title>
6
+  <script src="jQuery.min.js"></script>
7
+</head>
8
+
9
+<body background="./static/chalk.jpg">
10
+
11
+<center>
12
+<h1>DIY Radiation Monitor</h1>
13
+<hr>
14
+
15
+<table width="750" border="0" cellpadding="1">
16
+  <tr>
17
+    <td align="center">
18
+      <b><font size="5">
19
+      <text id="date"></text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<text id="time"></text>
20
+      </font></b>
21
+    </td>
22
+  </tr>
23
+
24
+  <tr>
25
+    <td>
26
+      <table width="100%" border="1", cellpadding="10">
27
+        <tr>
28
+          <td width="50%" align="center">
29
+            <b><font size="5">
30
+            Current Reading
31
+            </font></b>
32
+            <br><br>
33
+            <b><font size="4">
34
+            Counts per minute: <text id="cpm"></text><br>
35
+            Counts per second: <text id="cps"></text><br>
36
+            uSv per hour: <text id="uSvPerHr"></text>
37
+            </font></b>
38
+          </td>
39
+          <td width="50%" align="center" valign="center">
40
+            <b><font size="5">
41
+            Device Status
42
+            </font></b>
43
+            <br><br>
44
+            <b><font size="4">
45
+            Mode: <text id="mode"></text><br>
46
+            Status: <text id="status"></text>      
47
+            </font></b>
48
+          </td>
49
+        </tr>
50
+      </table>
51
+    </td>
52
+  </tr>
53
+
54
+  <tr>
55
+    <td>
56
+      <table width="100%" border="1", cellpadding="10">
57
+        <tr>
58
+          <td align="center">
59
+          <img id="1-day-cpm">
60
+          </td>
61
+        </tr>
62
+      </table>
63
+    </td>
64
+  </tr>
65
+
66
+  <tr>
67
+    <td>
68
+      <table width="100%" border="1", cellpadding="10">
69
+        <tr>
70
+          <td align="center">
71
+          <img id="1-day-uSv">
72
+          </td>
73
+        </tr>
74
+      </table>
75
+    </td>
76
+  </tr>
77
+
78
+  <tr>
79
+    <td>
80
+      <table width="100%" border="1", cellpadding="10">
81
+        <tr>
82
+          <td align="center">
83
+          <img id="4-week-cpm">
84
+          </td>
85
+        </tr>
86
+      </table>
87
+    </td>
88
+  </tr>
89
+
90
+  <tr>
91
+    <td>
92
+      <table width="100%" border="1", cellpadding="10">
93
+        <tr>
94
+          <td align="center">
95
+          <img id="4-week-uSv">
96
+          </td>
97
+        </tr>
98
+      </table>
99
+    </td>
100
+  </tr>
101
+
102
+  <tr>
103
+    <td>
104
+      <table width="100%" border="1", cellpadding="10">
105
+        <tr>
106
+          <td align="center">
107
+          <img id="1-year-cpm">
108
+          </td>
109
+        </tr>
110
+      </table>
111
+    </td>
112
+  </tr>
113
+
114
+  <tr>
115
+    <td>
116
+      <table width="100%" border="1", cellpadding="10">
117
+        <tr>
118
+          <td align="center">
119
+          <img id="1-year-uSv">
120
+          </td>
121
+        </tr>
122
+      </table>
123
+    </td>
124
+  </tr>
125
+
126
+  <tr>
127
+    <td>
128
+      <table width="100%" border="1", cellpadding="10">
129
+        <tr>
130
+          <td>
131
+            <b>NOTES:</b>
132
+            <li>For more information visit <a href="http://www.eugenemakerspace.com" target="_new"><i>www.eugenemakerspace.com</i></a>
133
+            <li>Project plans and notes available at <a href="http://github.com/fractalxaos/Radmon" target="_new"><i>GitHub.com</i></a>
134
+          </td>
135
+        </tr>
136
+      </table>
137
+    </td>
138
+  </tr>
139
+</table>
140
+</center>
141
+
142
+  <script>
143
+
144
+    function getRadmon() {
145
+      $.ajaxSetup({cache:false, url: "dynamic/radmonData.js",
146
+        success: function(result){
147
+          jStr = result.slice(1,-2);
148
+          dataObj = JSON.parse(jStr);
149
+          //data = dataObj.radmon;
150
+          parseRadmon(dataObj);
151
+        }
152
+      });
153
+      $.ajax();
154
+    }
155
+
156
+    function getGraphs() {
157
+      document.getElementById("1-day-cpm").src = "dynamic/radGraph1.png";
158
+      document.getElementById("1-day-uSv").src = "dynamic/radGraph2.png";
159
+      document.getElementById("4-week-cpm").src = "dynamic/radGraph3.png";
160
+      document.getElementById("4-week-uSv").src = "dynamic/radGraph4.png";
161
+      document.getElementById("1-year-cpm").src = "dynamic/radGraph5.png";
162
+      document.getElementById("1-year-uSv").src = "dynamic/radGraph6.png";
163
+    }
164
+
165
+    function parseRadmon(dataItem) {
166
+      var timeStamp
167
+      var date;
168
+      var time;
169
+      var sTmp;
170
+
171
+      timeStamp = dataItem.time;
172
+      if (timeStamp != "") {
173
+        date = timeStamp.split(" ")[0];
174
+        time = timeStamp.split(" ")[1];
175
+        $("#date").text(date);
176
+        $("#time").text(time);
177
+      } else {
178
+        $("#date").text("");
179
+        $("#time").text("");
180
+      }        
181
+      
182
+      $("#cps").text(dataItem.CPS);
183
+      $("#cpm").text(dataItem.CPM);
184
+      $("#uSvPerHr").text(dataItem.uSvPerHr);
185
+
186
+      sTmp = (dataItem.Mode).toLowerCase();
187
+      $("#mode").text(sTmp);
188
+
189
+      $("#status").text(dataItem.status);
190
+      if (dataItem.status == "online") {
191
+        document.getElementById("status").style.color = "green";
192
+      }
193
+      else {
194
+        document.getElementById("status").style.color = "red";
195
+      }
196
+    }
197
+
198
+    $(document).ready(function() {
199
+      getRadmon();
200
+      getGraphs();
201
+      setInterval(getRadmon, 1000);
202
+      setInterval(getGraphs, 60000);
203
+    });
204
+
205
+  </script>
206
+</body>
207
+</html>
208
+
0 209
new file mode 100644
1 210
Binary files /dev/null and b/html/static/chalk.jpg differ
2 211
new file mode 100644
3 212
Binary files /dev/null and b/html/static/eptile.gif differ
4 213
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+<HTML>
2
+<HEAD>
3
+<TITLE>IntraVisions - Redirect</TITLE>
4
+<META http-equiv="Refresh" content="0;url=/Tycus/" />
5
+</HEAD>
6
+</HTML>