1 /* 2 http://www.JSON.org/json2.js 3 2009-09-29 4 5 Public Domain. 6 7 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 8 9 See http://www.JSON.org/js.html 10 11 12 This code should be minified before deployment. 13 See http://javascript.crockford.com/jsmin.html 14 15 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO 16 NOT CONTROL. 17 18 19 This file creates a global JSON object containing two methods: stringify 20 and parse. 21 22 JSON.stringify(value, replacer, space) 23 value any JavaScript value, usually an object or array. 24 25 replacer an optional parameter that determines how object 26 values are stringified for objects. It can be a 27 function or an array of strings. 28 29 space an optional parameter that specifies the indentation 30 of nested structures. If it is omitted, the text will 31 be packed without extra whitespace. If it is a number, 32 it will specify the number of spaces to indent at each 33 level. If it is a string (such as '\t' or ' '), 34 it contains the characters used to indent at each level. 35 36 This method produces a JSON text from a JavaScript value. 37 38 When an object value is found, if the object contains a toJSON 39 method, its toJSON method will be called and the result will be 40 stringified. A toJSON method does not serialize: it returns the 41 value represented by the name/value pair that should be serialized, 42 or undefined if nothing should be serialized. The toJSON method 43 will be passed the key associated with the value, and this will be 44 bound to the value 45 46 For example, this would serialize Dates as ISO strings. 47 48 Date.prototype.toJSON = function (key) { 49 function f(n) { 50 // Format integers to have at least two digits. 51 return n < 10 ? '0' + n : n; 52 } 53 54 return this.getUTCFullYear() + '-' + 55 f(this.getUTCMonth() + 1) + '-' + 56 f(this.getUTCDate()) + 'T' + 57 f(this.getUTCHours()) + ':' + 58 f(this.getUTCMinutes()) + ':' + 59 f(this.getUTCSeconds()) + 'Z'; 60 }; 61 62 You can provide an optional replacer method. It will be passed the 63 key and value of each member, with this bound to the containing 64 object. The value that is returned from your method will be 65 serialized. If your method returns undefined, then the member will 66 be excluded from the serialization. 67 68 If the replacer parameter is an array of strings, then it will be 69 used to select the members to be serialized. It filters the results 70 such that only members with keys listed in the replacer array are 71 stringified. 72 73 Values that do not have JSON representations, such as undefined or 74 functions, will not be serialized. Such values in objects will be 75 dropped; in arrays they will be replaced with null. You can use 76 a replacer function to replace those with JSON values. 77 JSON.stringify(undefined) returns undefined. 78 79 The optional space parameter produces a stringification of the 80 value that is filled with line breaks and indentation to make it 81 easier to read. 82 83 If the space parameter is a non-empty string, then that string will 84 be used for indentation. If the space parameter is a number, then 85 the indentation will be that many spaces. 86 87 Example: 88 89 text = JSON.stringify(['e', {pluribus: 'unum'}]); 90 // text is '["e",{"pluribus":"unum"}]' 91 92 93 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); 94 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' 95 96 text = JSON.stringify([new Date()], function (key, value) { 97 return this[key] instanceof Date ? 98 'Date(' + this[key] + ')' : value; 99 }); 100 // text is '["Date(---current time---)"]' 101 102 103 JSON.parse(text, reviver) 104 This method parses a JSON text to produce an object or array. 105 It can throw a SyntaxError exception. 106 107 The optional reviver parameter is a function that can filter and 108 transform the results. It receives each of the keys and values, 109 and its return value is used instead of the original value. 110 If it returns what it received, then the structure is not modified. 111 If it returns undefined then the member is deleted. 112 113 Example: 114 115 // Parse the text. Values that look like ISO date strings will 116 // be converted to Date objects. 117 118 myData = JSON.parse(text, function (key, value) { 119 var a; 120 if (typeof value === 'string') { 121 a = 122 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); 123 if (a) { 124 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], 125 +a[5], +a[6])); 126 } 127 } 128 return value; 129 }); 130 131 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { 132 var d; 133 if (typeof value === 'string' && 134 value.slice(0, 5) === 'Date(' && 135 value.slice(-1) === ')') { 136 d = new Date(value.slice(5, -1)); 137 if (d) { 138 return d; 139 } 140 } 141 return value; 142 }); 143 144 145 This is a reference implementation. You are free to copy, modify, or 146 redistribute. 147 */ 148 149 /*jslint evil: true, strict: false */ 150 151 /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, 152 call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, 153 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, 154 lastIndex, length, parse, prototype, push, replace, slice, stringify, 155 test, toJSON, toString, valueOf 156 */ 157 158 159 // Create a JSON object only if one does not already exist. We create the 160 // methods in a closure to avoid creating global variables. 161 162 if (!this.JSON) { 163 this.JSON = {}; 164 } 165 166 (function () { 167 168 function f(n) { 169 // Format integers to have at least two digits. 170 return n < 10 ? '0' + n : n; 171 } 172 173 if (typeof Date.prototype.toJSON !== 'function') { 174 175 Date.prototype.toJSON = function (key) { 176 177 return isFinite(this.valueOf()) ? 178 this.getUTCFullYear() + '-' + 179 f(this.getUTCMonth() + 1) + '-' + 180 f(this.getUTCDate()) + 'T' + 181 f(this.getUTCHours()) + ':' + 182 f(this.getUTCMinutes()) + ':' + 183 f(this.getUTCSeconds()) + 'Z' : null; 184 }; 185 186 String.prototype.toJSON = 187 Number.prototype.toJSON = 188 Boolean.prototype.toJSON = function (key) { 189 return this.valueOf(); 190 }; 191 } 192 193 var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 194 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 195 gap, 196 indent, 197 meta = { // table of character substitutions 198 '\b': '\\b', 199 '\t': '\\t', 200 '\n': '\\n', 201 '\f': '\\f', 202 '\r': '\\r', 203 '"' : '\\"', 204 '\\': '\\\\' 205 }, 206 rep; 207 208 209 function quote(string) { 210 211 // If the string contains no control characters, no quote characters, and no 212 // backslash characters, then we can safely slap some quotes around it. 213 // Otherwise we must also replace the offending characters with safe escape 214 // sequences. 215 216 escapable.lastIndex = 0; 217 return escapable.test(string) ? 218 '"' + string.replace(escapable, function (a) { 219 var c = meta[a]; 220 return typeof c === 'string' ? c : 221 '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 222 }) + '"' : 223 '"' + string + '"'; 224 } 225 226 227 function str(key, holder) { 228 229 // Produce a string from holder[key]. 230 231 var i, // The loop counter. 232 k, // The member key. 233 v, // The member value. 234 length, 235 mind = gap, 236 partial, 237 value = holder[key]; 238 239 // If the value has a toJSON method, call it to obtain a replacement value. 240 241 if (value && typeof value === 'object' && 242 typeof value.toJSON === 'function') { 243 value = value.toJSON(key); 244 } 245 246 // If we were called with a replacer function, then call the replacer to 247 // obtain a replacement value. 248 249 if (typeof rep === 'function') { 250 value = rep.call(holder, key, value); 251 } 252 253 // What happens next depends on the value's type. 254 255 switch (typeof value) { 256 case 'string': 257 return quote(value); 258 259 case 'number': 260 261 // JSON numbers must be finite. Encode non-finite numbers as null. 262 263 return isFinite(value) ? String(value) : 'null'; 264 265 case 'boolean': 266 case 'null': 267 268 // If the value is a boolean or null, convert it to a string. Note: 269 // typeof null does not produce 'null'. The case is included here in 270 // the remote chance that this gets fixed someday. 271 272 return String(value); 273 274 // If the type is 'object', we might be dealing with an object or an array or 275 // null. 276 277 case 'object': 278 279 // Due to a specification blunder in ECMAScript, typeof null is 'object', 280 // so watch out for that case. 281 282 if (!value) { 283 return 'null'; 284 } 285 286 // Make an array to hold the partial results of stringifying this object value. 287 288 gap += indent; 289 partial = []; 290 291 // Is the value an array? 292 293 if (Object.prototype.toString.apply(value) === '[object Array]') { 294 295 // The value is an array. Stringify every element. Use null as a placeholder 296 // for non-JSON values. 297 298 length = value.length; 299 for (i = 0; i < length; i += 1) { 300 partial[i] = str(i, value) || 'null'; 301 } 302 303 // Join all of the elements together, separated with commas, and wrap them in 304 // brackets. 305 306 v = partial.length === 0 ? '[]' : 307 gap ? '[\n' + gap + 308 partial.join(',\n' + gap) + '\n' + 309 mind + ']' : 310 '[' + partial.join(',') + ']'; 311 gap = mind; 312 return v; 313 } 314 315 // If the replacer is an array, use it to select the members to be stringified. 316 317 if (rep && typeof rep === 'object') { 318 length = rep.length; 319 for (i = 0; i < length; i += 1) { 320 k = rep[i]; 321 if (typeof k === 'string') { 322 v = str(k, value); 323 if (v) { 324 partial.push(quote(k) + (gap ? ': ' : ':') + v); 325 } 326 } 327 } 328 } else { 329 330 // Otherwise, iterate through all of the keys in the object. 331 332 for (k in value) { 333 if (Object.hasOwnProperty.call(value, k)) { 334 v = str(k, value); 335 if (v) { 336 partial.push(quote(k) + (gap ? ': ' : ':') + v); 337 } 338 } 339 } 340 } 341 342 // Join all of the member texts together, separated with commas, 343 // and wrap them in braces. 344 345 v = partial.length === 0 ? '{}' : 346 gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + 347 mind + '}' : '{' + partial.join(',') + '}'; 348 gap = mind; 349 return v; 350 } 351 } 352 353 // If the JSON object does not yet have a stringify method, give it one. 354 355 if (typeof JSON.stringify !== 'function') { 356 JSON.stringify = function (value, replacer, space) { 357 358 // The stringify method takes a value and an optional replacer, and an optional 359 // space parameter, and returns a JSON text. The replacer can be a function 360 // that can replace values, or an array of strings that will select the keys. 361 // A default replacer method can be provided. Use of the space parameter can 362 // produce text that is more easily readable. 363 364 var i; 365 gap = ''; 366 indent = ''; 367 368 // If the space parameter is a number, make an indent string containing that 369 // many spaces. 370 371 if (typeof space === 'number') { 372 for (i = 0; i < space; i += 1) { 373 indent += ' '; 374 } 375 376 // If the space parameter is a string, it will be used as the indent string. 377 378 } else if (typeof space === 'string') { 379 indent = space; 380 } 381 382 // If there is a replacer, it must be a function or an array. 383 // Otherwise, throw an error. 384 385 rep = replacer; 386 if (replacer && typeof replacer !== 'function' && 387 (typeof replacer !== 'object' || 388 typeof replacer.length !== 'number')) { 389 throw new Error('JSON.stringify'); 390 } 391 392 // Make a fake root object containing our value under the key of ''. 393 // Return the result of stringifying the value. 394 395 return str('', {'': value}); 396 }; 397 } 398 399 400 // If the JSON object does not yet have a parse method, give it one. 401 402 if (typeof JSON.parse !== 'function') { 403 JSON.parse = function (text, reviver) { 404 405 // The parse method takes a text and an optional reviver function, and returns 406 // a JavaScript value if the text is a valid JSON text. 407 408 var j; 409 410 function walk(holder, key) { 411 412 // The walk method is used to recursively walk the resulting structure so 413 // that modifications can be made. 414 415 var k, v, value = holder[key]; 416 if (value && typeof value === 'object') { 417 for (k in value) { 418 if (Object.hasOwnProperty.call(value, k)) { 419 v = walk(value, k); 420 if (v !== undefined) { 421 value[k] = v; 422 } else { 423 delete value[k]; 424 } 425 } 426 } 427 } 428 return reviver.call(holder, key, value); 429 } 430 431 432 // Parsing happens in four stages. In the first stage, we replace certain 433 // Unicode characters with escape sequences. JavaScript handles many characters 434 // incorrectly, either silently deleting them, or treating them as line endings. 435 436 cx.lastIndex = 0; 437 if (cx.test(text)) { 438 text = text.replace(cx, function (a) { 439 return '\\u' + 440 ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 441 }); 442 } 443 444 // In the second stage, we run the text against regular expressions that look 445 // for non-JSON patterns. We are especially concerned with '()' and 'new' 446 // because they can cause invocation, and '=' because it can cause mutation. 447 // But just to be safe, we want to reject all unexpected forms. 448 449 // We split the second stage into 4 regexp operations in order to work around 450 // crippling inefficiencies in IE's and Safari's regexp engines. First we 451 // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 452 // replace all simple value tokens with ']' characters. Third, we delete all 453 // open brackets that follow a colon or comma or that begin the text. Finally, 454 // we look to see that the remaining characters are only whitespace or ']' or 455 // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 456 457 if (/^[\],:{}\s]*$/. 458 test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). 459 replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). 460 replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { 461 462 // In the third stage we use the eval function to compile the text into a 463 // JavaScript structure. The '{' operator is subject to a syntactic ambiguity 464 // in JavaScript: it can begin a block or an object literal. We wrap the text 465 // in parens to eliminate the ambiguity. 466 467 j = eval('(' + text + ')'); 468 469 // In the optional fourth stage, we recursively walk the new structure, passing 470 // each name/value pair to a reviver function for possible transformation. 471 472 return typeof reviver === 'function' ? 473 walk({'': j}, '') : j; 474 } 475 476 // If the text is not JSON parseable, then a SyntaxError is thrown. 477 478 throw new SyntaxError('JSON.parse'); 479 }; 480 } 481 }()); 482 // qTip - CSS Tool Tips - by Craig Erskine 483 // http://qrayg.com 484 // 485 // Multi-tag support by James Crooke 486 // http://www.cj-design.com 487 // 488 // Inspired by code from Travis Beckham 489 // http://www.squidfingers.com | http://www.podlob.com 490 // 491 // Copyright (c) 2006 Craig Erskine 492 // Permission is granted to copy, distribute and/or modify this document 493 // under the terms of the GNU Free Documentation License, Version 1.3 494 // or any later version published by the Free Software Foundation; 495 // with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. 496 // A copy of the license is included in the section entitled "GNU 497 // Free Documentation License". 498 499 var qTipTag = "a,label,input,v"; //Which tag do you want to qTip-ize? Keep it lowercase!// 500 var qTipX = 0; //This is qTip's X offset// 501 var qTipY = 15; //This is qTip's Y offset// 502 503 //There's No need to edit anything below this line// 504 tooltip = { 505 name : "qTip", 506 offsetX : qTipX, 507 offsetY : qTipY, 508 tip : null 509 } 510 511 tooltip.init = function () { 512 var tipNameSpaceURI = "http://www.w3.org/1999/xhtml"; 513 if(!tipContainerID){ var tipContainerID = "qTip";} 514 var tipContainer = document.getElementById(tipContainerID); 515 516 if(!tipContainer) { 517 tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div"); 518 tipContainer.setAttribute("id", tipContainerID); 519 document.getElementsByTagName("body").item(0).appendChild(tipContainer); 520 } 521 522 if (!document.getElementById) return; 523 this.tip = document.getElementById (this.name); 524 if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)}; 525 526 var a, sTitle, elements; 527 528 var elementList = qTipTag.split(","); 529 for(var j = 0; j < elementList.length; j++) 530 { 531 elements = document.getElementsByTagName(elementList[j]); 532 if(elements) 533 { 534 for (var i = 0; i < elements.length; i ++) 535 { 536 a = elements[i]; 537 sTitle = a.getAttribute("title"); 538 if(sTitle) 539 { 540 a.setAttribute("tiptitle", sTitle); 541 a.removeAttribute("title"); 542 a.removeAttribute("alt"); 543 a.onmouseover = function() {tooltip.show(this.getAttribute('tiptitle'))}; 544 a.onmouseout = function() {tooltip.hide()}; 545 } 546 } 547 } 548 } 549 } 550 551 tooltip.move = function (evt) { 552 var x=0, y=0; 553 if (document.all) {//IE 554 x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft; 555 y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop; 556 x += window.event.clientX; 557 y += window.event.clientY; 558 559 } else {//Good Browsers 560 x = evt.pageX; 561 y = evt.pageY; 562 } 563 this.tip.style.left = (x + this.offsetX) + "px"; 564 this.tip.style.top = (y + this.offsetY) + "px"; 565 } 566 567 tooltip.show = function (text) { 568 if (!this.tip) return; 569 this.tip.innerHTML = text; 570 this.tip.style.display = "block"; 571 } 572 573 tooltip.hide = function () { 574 if (!this.tip) return; 575 this.tip.innerHTML = ""; 576 this.tip.style.display = "none"; 577 } 578 579 window.onload = function () { 580 tooltip.init (); 581 } 582 if(!Array.prototype.map){Array.prototype.map=function(c,d){var e=this.length;var a=new Array(e);for(var b=0;b<e;b++){if(b in this){a[b]=c.call(d,this[b],b,this)}}return a}}if(!Array.prototype.filter){Array.prototype.filter=function(d,e){var g=this.length;var a=new Array();for(var c=0;c<g;c++){if(c in this){var b=this[c];if(d.call(e,b,c,this)){a.push(b)}}}return a}}if(!Array.prototype.forEach){Array.prototype.forEach=function(b,c){var d=this.length>>>0;for(var a=0;a<d;a++){if(a in this){b.call(c,this[a],a,this)}}}}if(!Array.prototype.reduce){Array.prototype.reduce=function(d,b){var a=this.length;if(!a&&(arguments.length==1)){throw new Error("reduce: empty array, no initial value")}var c=0;if(arguments.length<2){while(true){if(c in this){b=this[c++];break}if(++c>=a){throw new Error("reduce: no values, no initial value")}}}for(;c<a;c++){if(c in this){b=d(b,this[c],c,this)}}return b}}Date.__parse__=Date.parse;Date.parse=function(j,i){if(arguments.length==1){return Date.__parse__(j)}var h=1970,g=0,b=1,d=0,c=0,a=0;var f=[function(){}];i=i.replace(/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g,"\\$&");i=i.replace(/%[a-zA-Z0-9]/g,function(k){switch(k){case"%b":f.push(function(l){g={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11}[l]});return"([A-Za-z]+)";case"%h":case"%B":f.push(function(l){g={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11}[l]});return"([A-Za-z]+)";case"%e":case"%d":f.push(function(l){b=l});return"([0-9]+)";case"%H":f.push(function(l){d=l});return"([0-9]+)";case"%m":f.push(function(l){g=l-1});return"([0-9]+)";case"%M":f.push(function(l){c=l});return"([0-9]+)";case"%S":f.push(function(l){a=l});return"([0-9]+)";case"%y":f.push(function(l){l=Number(l);h=l+(((0<=l)&&(l<69))?2000:(((l>=69)&&(l<100)?1900:0)))});return"([0-9]+)";case"%Y":f.push(function(l){h=l});return"([0-9]+)";case"%%":f.push(function(){});return"%"}return k});var e=j.match(i);if(e){e.forEach(function(k,l){f[l](k)})}return new Date(h,g,b,d,c,a)};if(Date.prototype.toLocaleFormat){Date.prototype.format=Date.prototype.toLocaleFormat}else{Date.prototype.format=function(b){function a(e,d){return(e<10)?(d||"0")+e:e}var c=this;return b.replace(/%[a-zA-Z0-9]/g,function(f){switch(f){case"%a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][c.getDay()];case"%A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][c.getDay()];case"%h":case"%b":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][c.getMonth()];case"%B":return["January","February","March","April","May","June","July","August","September","October","November","December"][c.getMonth()];case"%c":return c.toLocaleString();case"%C":return a(Math.floor(c.getFullYear()/100)%100);case"%d":return a(c.getDate());case"%x":case"%D":return a(c.getMonth()+1)+"/"+a(c.getDate())+"/"+a(c.getFullYear()%100);case"%e":return a(c.getDate()," ");case"%H":return a(c.getHours());case"%I":var e=c.getHours()%12;return e?a(e):12;case"%m":return a(c.getMonth()+1);case"%M":return a(c.getMinutes());case"%n":return"\n";case"%p":return c.getHours()<12?"AM":"PM";case"%T":case"%X":case"%r":var e=c.getHours()%12;return(e?a(e):12)+":"+a(c.getMinutes())+":"+a(c.getSeconds())+" "+(c.getHours()<12?"AM":"PM");case"%R":return a(c.getHours())+":"+a(c.getMinutes());case"%S":return a(c.getSeconds());case"%t":return"\t";case"%u":var d=c.getDay();return d?d:1;case"%w":return c.getDay();case"%y":return a(c.getFullYear()%100);case"%Y":return c.getFullYear();case"%%":return"%"}return f})}};var pv = function() {var pv={};pv.extend=function(b){function a(){}a.prototype=b.prototype||b;return new a()};try{eval("pv.parse = function(x) x;")}catch(e){pv.parse=function(a){var n=new RegExp("function(\\s+\\w+)?\\([^)]*\\)\\s*","mg"),f,k,h=0,o="";while(f=n.exec(a)){var g=f.index+f[0].length;if(a.charAt(g--)!="{"){o+=a.substring(h,g)+"{return ";h=g;for(var b=0;b>=0&&g<a.length;g++){var l=a.charAt(g);switch(l){case'"':case"'":while(++g<a.length&&(k=a.charAt(g))!=l){if(k=="\\"){g++}}break;case"[":case"(":b++;break;case"]":case")":b--;break;case";":case",":if(b==0){b--}break}}o+=pv.parse(a.substring(h,--g))+";}";h=g}n.lastIndex=g}o+=a.substring(h);return o}}pv.identity=function(a){return a};pv.index=function(){return this.index};pv.child=function(){return this.childIndex};pv.parent=function(){return this.parent.index};pv.range=function(g,c,d){if(arguments.length==1){c=g;g=0}if(d==undefined){d=1}else{if(!d){throw new Error("step must be non-zero")}}var f=[],b=0,a;if(d<0){while((a=g+d*b++)>c){f.push(a)}}else{while((a=g+d*b++)<c){f.push(a)}}return f};pv.random=function(b,a,c){if(arguments.length==1){a=b;b=0}if(c==undefined){c=1}return c?(Math.floor(Math.random()*(a-b)/c)*c+b):(Math.random()*(a-b)+b)};pv.repeat=function(b,a){if(arguments.length==1){a=2}return pv.blend(pv.range(a).map(function(){return b}))};pv.cross=function(g,f){var o=[];for(var k=0,l=g.length,d=f.length;k<l;k++){for(var h=0,c=g[k];h<d;h++){o.push([c,f[h]])}}return o};pv.blend=function(a){return Array.prototype.concat.apply([],a)};pv.transpose=function(f){var g=f.length,a=pv.max(f,function(h){return h.length});if(a>g){f.length=a;for(var d=g;d<a;d++){f[d]=new Array(g)}for(var d=0;d<g;d++){for(var b=d+1;b<a;b++){var c=f[d][b];f[d][b]=f[b][d];f[b][d]=c}}}else{for(var d=0;d<a;d++){f[d].length=g}for(var d=0;d<g;d++){for(var b=0;b<d;b++){var c=f[d][b];f[d][b]=f[b][d];f[b][d]=c}}}f.length=a;for(var d=0;d<a;d++){f[d].length=g}return f};pv.keys=function(b){var c=[];for(var a in b){c.push(a)}return c};pv.entries=function(b){var c=[];for(var a in b){c.push({key:a,value:b[a]})}return c};pv.values=function(b){var c=[];for(var a in b){c.push(b[a])}return c};function map(c,a){var b={};return a?c.map(function(g,f){b.index=f;return a.call(b,g)}):c.slice()}pv.normalize=function(g,d){var b=map(g,d),c=pv.sum(b);for(var a=0;a<b.length;a++){b[a]/=c}return b};pv.sum=function(c,a){var b={};return c.reduce(a?function(g,h,f){b.index=f;return g+a.call(b,h)}:function(f,g){return f+g},0)};pv.max=function(b,a){if(a==pv.index){return b.length-1}return Math.max.apply(null,a?map(b,a):b)};pv.max.index=function(j,d){if(d==pv.index){return j.length-1}if(!d){d=pv.identity}var b=-1,h=-Infinity,g={};for(var c=0;c<j.length;c++){g.index=c;var a=d.call(g,j[c]);if(a>h){h=a;b=c}}return b};pv.min=function(b,a){if(a==pv.index){return 0}return Math.min.apply(null,a?map(b,a):b)};pv.min.index=function(j,g){if(g==pv.index){return 0}if(!g){g=pv.identity}var d=-1,b=Infinity,h={};for(var c=0;c<j.length;c++){h.index=c;var a=g.call(h,j[c]);if(a<b){b=a;d=c}}return d};pv.mean=function(b,a){return pv.sum(b,a)/b.length};pv.median=function(c,b){if(b==pv.index){return(c.length-1)/2}c=map(c,b).sort(pv.naturalOrder);if(c.length%2){return c[Math.floor(c.length/2)]}var a=c.length/2;return(c[a-1]+c[a])/2};pv.dict=function(d,g){var a={},h={};for(var c=0;c<d.length;c++){if(c in d){var b=d[c];h.index=c;a[b]=g.call(h,b)}}return a};pv.permute=function(g,a,b){if(!b){b=pv.identity}var c=new Array(a.length),d={};a.forEach(function(f,h){d.index=f;c[h]=b.call(d,g[f])});return c};pv.numerate=function(a,b){if(!b){b=pv.identity}var c={},d={};a.forEach(function(f,g){d.index=g;c[b.call(d,f)]=g});return c};pv.naturalOrder=function(d,c){return(d<c)?-1:((d>c)?1:0)};pv.reverseOrder=function(c,d){return(d<c)?-1:((d>c)?1:0)};pv.css=function(b,a){return window.getComputedStyle?window.getComputedStyle(b,null).getPropertyValue(a):b.currentStyle[a]};pv.ns={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns",xlink:"http://www.w3.org/1999/xlink"};pv.version={major:3,minor:1};pv.error=function(a){(typeof console=="undefined")?alert(a):console.error(a)};pv.listen=function(c,a,b){return c.addEventListener?c.addEventListener(a,b,false):c.attachEvent("on"+a,b)};pv.log=function(c,a){return Math.log(c)/Math.log(a)};pv.logSymmetric=function(c,a){return(c==0)?0:((c<0)?-pv.log(-c,a):pv.log(c,a))};pv.logAdjusted=function(c,a){var d=c<0;if(c<a){c+=(a-c)/a}return d?-pv.log(c,a):pv.log(c,a)};pv.logFloor=function(c,a){return(c>0)?Math.pow(a,Math.floor(pv.log(c,a))):-Math.pow(a,-Math.floor(-pv.log(-c,a)))};pv.logCeil=function(c,a){return(c>0)?Math.pow(a,Math.ceil(pv.log(c,a))):-Math.pow(a,-Math.ceil(-pv.log(-c,a)))};pv.search=function(i,h,g){if(!g){g=pv.identity}var a=0,d=i.length-1;while(a<=d){var b=(a+d)>>1,c=g(i[b]);if(c<h){a=b+1}else{if(c>h){d=b-1}else{return b}}}return -a-1};pv.search.index=function(d,c,b){var a=pv.search(d,c,b);return(a<0)?(-a-1):a};pv.tree=function(a){return new pv.Tree(a)};pv.Tree=function(a){this.array=a};pv.Tree.prototype.keys=function(a){this.k=a;return this};pv.Tree.prototype.value=function(a){this.v=a;return this};pv.Tree.prototype.map=function(){var g={},h={};for(var b=0;b<this.array.length;b++){h.index=b;var f=this.array[b],d=this.k.call(h,f),c=g;for(var a=0;a<d.length-1;a++){c=c[d[a]]||(c[d[a]]={})}c[d[a]]=this.v?this.v.call(h,f):f}return g};pv.nest=function(a){return new pv.Nest(a)};pv.Nest=function(a){this.array=a;this.keys=[]};pv.Nest.prototype.key=function(a){this.keys.push(a);return this};pv.Nest.prototype.sortKeys=function(a){this.keys[this.keys.length-1].order=a||pv.naturalOrder;return this};pv.Nest.prototype.sortValues=function(a){this.order=a||pv.naturalOrder;return this};pv.Nest.prototype.map=function(){var n={},g=[];for(var l,h=0;h<this.array.length;h++){var c=this.array[h];var b=n;for(l=0;l<this.keys.length-1;l++){var f=this.keys[l](c);if(!b[f]){b[f]={}}b=b[f]}f=this.keys[l](c);if(!b[f]){var d=[];g.push(d);b[f]=d}b[f].push(c)}if(this.order){for(var l=0;l<g.length;l++){g[l].sort(this.order)}}return n};pv.Nest.prototype.entries=function(){function a(f){var g=[];for(var d in f){var c=f[d];g.push({key:d,values:(c instanceof Array)?c:a(c)})}return g}function b(g,d){var f=this.keys[d].order;if(f){g.sort(function(i,h){return f(i.key,h.key)})}if(++d<this.keys.length){for(var c=0;c<g.length;c++){b.call(this,g[c].values,d)}}return g}return b.call(this,a(this.map()),0)};pv.Nest.prototype.rollup=function(b){function a(f){for(var c in f){var d=f[c];if(d instanceof Array){f[c]=b(d)}else{a(d)}}return f}return a(this.map())};pv.flatten=function(a){return new pv.Flatten(a)};pv.Flatten=function(a){this.map=a;this.keys=[]};pv.Flatten.prototype.key=function(a,b){this.keys.push({name:a,value:b});return this};pv.Flatten.prototype.array=function(){var b=[],a=[],d=this.keys;function c(h,g){if(g<d.length-1){for(var f in h){a.push(f);c(h[f],g+1);a.pop()}}else{b.push(a.concat(h))}}c(this.map,0);return b.map(function(g){var f={};for(var l=0;l<d.length;l++){var j=d[l],h=g[l];f[j.name]=j.value?j.value.call(null,h):h}return f})};pv.vector=function(a,b){return new pv.Vector(a,b)};pv.Vector=function(a,b){this.x=a;this.y=b};pv.Vector.prototype.perp=function(){return new pv.Vector(-this.y,this.x)};pv.Vector.prototype.norm=function(){var a=this.length();return this.times(a?(1/a):1)};pv.Vector.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};pv.Vector.prototype.times=function(a){return new pv.Vector(this.x*a,this.y*a)};pv.Vector.prototype.plus=function(a,b){return(arguments.length==1)?new pv.Vector(this.x+a.x,this.y+a.y):new pv.Vector(this.x+a,this.y+b)};pv.Vector.prototype.minus=function(a,b){return(arguments.length==1)?new pv.Vector(this.x-a.x,this.y-a.y):new pv.Vector(this.x-a,this.y-b)};pv.Vector.prototype.dot=function(a,b){return(arguments.length==1)?this.x*a.x+this.y*a.y:this.x*a+this.y*b};pv.Scale=function(){};pv.Scale.interpolator=function(b,a){if(typeof b=="number"){return function(c){return c*(a-b)+b}}b=pv.color(b).rgb();a=pv.color(a).rgb();return function(d){var c=b.a*(1-d)+a.a*d;if(c<0.00001){c=0}return(b.a==0)?pv.rgb(a.r,a.g,a.b,c):((a.a==0)?pv.rgb(b.r,b.g,b.b,c):pv.rgb(Math.round(b.r*(1-d)+a.r*d),Math.round(b.g*(1-d)+a.g*d),Math.round(b.b*(1-d)+a.b*d),c))}};pv.Scale.linear=function(){var g=[0,1],c=[0,1],b=[pv.identity],a=0;function f(d){var h=pv.search(g,d);if(h<0){h=-h-2}h=Math.max(0,Math.min(b.length-1,h));return b[h]((d-g[h])/(g[h+1]-g[h]))}f.domain=function(i,h,d){if(arguments.length){if(i instanceof Array){if(arguments.length<2){h=pv.identity}if(arguments.length<3){d=h}g=[pv.min(i,h),pv.max(i,d)]}else{g=Array.prototype.slice.call(arguments)}return this}return g};f.range=function(){if(arguments.length){c=Array.prototype.slice.call(arguments);b=[];for(var d=0;d<c.length-1;d++){b.push(pv.Scale.interpolator(c[d],c[d+1]))}return this}return c};f.invert=function(h){var d=pv.search(c,h);if(d<0){d=-d-2}d=Math.max(0,Math.min(b.length-1,d));return(h-c[d])/(c[d+1]-c[d])*(g[d+1]-g[d])+g[d]};f.ticks=function(){var i=g[0],d=g[g.length-1],j=d-i,k=pv.logCeil(j/10,10);if(j/k<2){k/=5}else{if(j/k<5){k/=2}}var l=Math.ceil(i/k)*k,h=Math.floor(d/k)*k;a=Math.max(0,-Math.floor(pv.log(k,10)+0.01));return pv.range(l,h+k,k)};f.tickFormat=function(d){return d.toFixed(a)};f.nice=function(){var h=g[0],d=g[g.length-1],i=Math.pow(10,Math.round(Math.log(d-h)/Math.log(10))-1);g=[Math.floor(h/i)*i,Math.ceil(d/i)*i];return this};f.by=function(d){function h(){return f(d.apply(this,arguments))}for(var i in f){h[i]=f[i]}return h};f.domain.apply(f,arguments);return f};pv.Scale.log=function(){var k=[1,10],c=[0,1],a=10,h=[0,1],f=[pv.identity];function j(b){var d=pv.search(k,b);if(d<0){d=-d-2}d=Math.max(0,Math.min(f.length-1,d));return f[d]((g(b)-c[d])/(c[d+1]-c[d]))}function g(b){return pv.logSymmetric(b,a)}j.domain=function(i,d,b){if(arguments.length){if(i instanceof Array){if(arguments.length<2){d=pv.identity}if(arguments.length<3){b=d}k=[pv.min(i,d),pv.max(i,b)]}else{k=Array.prototype.slice.call(arguments)}c=k.map(g);return this}return k};j.range=function(){if(arguments.length){h=Array.prototype.slice.call(arguments);f=[];for(var b=0;b<h.length-1;b++){f.push(pv.Scale.interpolator(h[b],h[b+1]))}return this}return h};j.invert=function(i){var b=pv.search(h,i);if(b<0){b=-b-2}b=Math.max(0,Math.min(f.length-1,b));var d=c[b]+(i-h[b])/(h[b+1]-h[b])*(c[b+1]-c[b]);return(k[b]<0)?-Math.pow(a,-d):Math.pow(a,d)};j.ticks=function(){var o=Math.floor(c[0]),d=Math.ceil(c[1]),n=[];for(var m=o;m<d;m++){var b=Math.pow(a,m);if(k[0]<0){b=-b}for(var l=1;l<a;l++){n.push(b*l)}}n.push(Math.pow(a,d));if(n[0]<k[0]){n.shift()}if(n[n.length-1]>k[1]){n.pop()}return n};j.tickFormat=function(b){return b.toPrecision(1)};j.nice=function(){k=[pv.logFloor(k[0],a),pv.logCeil(k[1],a)];c=k.map(g);return this};j.base=function(b){if(arguments.length){a=b;c=k.map(g);return this}return a};j.by=function(b){function d(){return j(b.apply(this,arguments))}for(var i in j){d[i]=j[i]}return d};j.domain.apply(j,arguments);return j};pv.Scale.ordinal=function(){var g=[],a={},b=[],f=0;function c(d){if(!(d in a)){a[d]=g.push(d)-1}return b[a[d]%b.length]}c.domain=function(l,i){if(arguments.length){l=(l instanceof Array)?((arguments.length>1)?map(l,i):l):Array.prototype.slice.call(arguments);g=[];var d={};for(var h=0;h<l.length;h++){var k=l[h];if(!(k in d)){d[k]=true;g.push(k)}}a=pv.numerate(g);return this}return g};c.range=function(h,d){if(arguments.length){b=(h instanceof Array)?((arguments.length>1)?map(h,d):h):Array.prototype.slice.call(arguments);if(typeof b[0]=="string"){b=b.map(pv.color)}return this}return b};c.split=function(h,d){var i=(d-h)/this.domain().length;b=pv.range(h+i/2,d,i);return this};c.splitFlush=function(h,d){var j=this.domain().length,i=(d-h)/(j-1);b=(j==1)?[(h+d)/2]:pv.range(h,d+i/2,i);return this};c.splitBanded=function(h,d,m){if(arguments.length<3){m=1}if(m<0){var o=this.domain().length,k=-m*o,i=d-h-k,l=i/(o+1);b=pv.range(h+l,d,l-m);b.band=-m}else{var j=(d-h)/(this.domain().length+(1-m));b=pv.range(h+j*(1-m),d,j);b.band=j*m}return this};c.by=function(d){function h(){return c(d.apply(this,arguments))}for(var i in c){h[i]=c[i]}return h};c.domain.apply(c,arguments);return c};pv.color=function(n){if(!n||(n=="transparent")){return pv.rgb(0,0,0,0)}if(n instanceof pv.Color){return n}var p=/([a-z]+)\((.*)\)/i.exec(n);if(p){var o=p[2].split(","),m=1;switch(p[1]){case"hsla":case"rgba":m=parseFloat(o[3]);break}switch(p[1]){case"hsla":case"hsl":var i=parseFloat(o[0]),q=parseFloat(o[1])/100,d=parseFloat(o[2])/100;return(new pv.Color.Hsl(i,q,d,m)).rgb();case"rgba":case"rgb":function f(b){var a=parseFloat(b);return(b[b.length-1]=="%")?Math.round(a*2.55):a}var c=f(o[0]),j=f(o[1]),k=f(o[2]);return pv.rgb(c,j,k,m)}}n=pv.Color.names[n]||n;if(n.charAt(0)=="#"){var c,j,k;if(n.length==4){c=n.charAt(1);c+=c;j=n.charAt(2);j+=j;k=n.charAt(3);k+=k}else{if(n.length==7){c=n.substring(1,3);j=n.substring(3,5);k=n.substring(5,7)}}return pv.rgb(parseInt(c,16),parseInt(j,16),parseInt(k,16),1)}return new pv.Color(n,1)};pv.Color=function(a,b){this.color=a;this.opacity=b};pv.Color.prototype.brighter=function(a){return this.rgb().brighter(a)};pv.Color.prototype.darker=function(a){return this.rgb().darker(a)};pv.rgb=function(h,f,c,d){return new pv.Color.Rgb(h,f,c,(arguments.length==4)?d:1)};pv.Color.Rgb=function(h,f,c,d){pv.Color.call(this,d?("rgb("+h+","+f+","+c+")"):"none",d);this.r=h;this.g=f;this.b=c;this.a=d};pv.Color.Rgb.prototype=pv.extend(pv.Color);pv.Color.Rgb.prototype.red=function(a){return pv.rgb(a,this.g,this.b,this.a)};pv.Color.Rgb.prototype.green=function(a){return pv.rgb(this.r,a,this.b,this.a)};pv.Color.Rgb.prototype.blue=function(a){return pv.rgb(this.r,this.g,a,this.a)};pv.Color.Rgb.prototype.alpha=function(b){return pv.rgb(this.r,this.g,this.b,b)};pv.Color.Rgb.prototype.rgb=function(){return this};pv.Color.Rgb.prototype.brighter=function(c){c=Math.pow(0.7,arguments.length?c:1);var h=this.r,f=this.g,a=this.b,d=30;if(!h&&!f&&!a){return pv.rgb(d,d,d,this.a)}if(h&&(h<d)){h=d}if(f&&(f<d)){f=d}if(a&&(a<d)){a=d}return pv.rgb(Math.min(255,Math.floor(h/c)),Math.min(255,Math.floor(f/c)),Math.min(255,Math.floor(a/c)),this.a)};pv.Color.Rgb.prototype.darker=function(a){a=Math.pow(0.7,arguments.length?a:1);return pv.rgb(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)),this.a)};pv.hsl=function(f,d,c,b){return new pv.Color.Hsl(f,d,c,(arguments.length==4)?b:1)};pv.Color.Hsl=function(f,d,c,b){pv.Color.call(this,"hsl("+f+","+(d*100)+"%,"+(c*100)+"%)",b);this.h=f;this.s=d;this.l=c;this.a=b};pv.Color.Hsl.prototype=pv.extend(pv.Color);pv.Color.Hsl.prototype.hue=function(a){return pv.hsl(a,this.s,this.l,this.a)};pv.Color.Hsl.prototype.saturation=function(a){return pv.hsl(this.h,a,this.l,this.a)};pv.Color.Hsl.prototype.lightness=function(a){return pv.hsl(this.h,this.s,a,this.a)};pv.Color.Hsl.prototype.alpha=function(b){return pv.hsl(this.h,this.s,this.l,b)};pv.Color.Hsl.prototype.rgb=function(){var g=this.h,f=this.s,a=this.l;g=g%360;if(g<0){g+=360}f=Math.max(0,Math.min(f,1));a=Math.max(0,Math.min(a,1));var c=(a<=0.5)?(a*(1+f)):(a+f-a*f);var d=2*a-c;function b(j){if(j>360){j-=360}else{if(j<0){j+=360}}if(j<60){return d+(c-d)*j/60}if(j<180){return c}if(j<240){return d+(c-d)*(240-j)/60}return d}function i(j){return Math.round(b(j)*255)}return pv.rgb(i(g+120),i(g),i(g-120),this.a)};pv.Color.names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};pv.colors=function(){var a=pv.Scale.ordinal();a.range.apply(a,arguments);return a};pv.Colors={};pv.Colors.category10=function(){var a=pv.colors("#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf");a.domain.apply(a,arguments);return a};pv.Colors.category20=function(){var a=pv.colors("#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5");a.domain.apply(a,arguments);return a};pv.Colors.category19=function(){var a=pv.colors("#9c9ede","#7375b5","#4a5584","#cedb9c","#b5cf6b","#8ca252","#637939","#e7cb94","#e7ba52","#bd9e39","#8c6d31","#e7969c","#d6616b","#ad494a","#843c39","#de9ed6","#ce6dbd","#a55194","#7b4173");a.domain.apply(a,arguments);return a};pv.ramp=function(c,a){var b=pv.Scale.linear();b.range.apply(b,arguments);return b};pv.SvgScene={};pv.SvgScene.create=function(a){return document.createElementNS(pv.ns.svg,a)};pv.SvgScene.expect=function(a,b){if(!b){return this.create(a)}if(b.tagName=="a"){b=b.firstChild}if(b.tagName==a){return b}var c=this.create(a);b.parentNode.replaceChild(c,b);return c};pv.SvgScene.append=function(c,a,b){c.$scene={scenes:a,index:b};c=this.title(c,a[b]);if(!c.parentNode){a.$g.appendChild(c)}return c.nextSibling};pv.SvgScene.title=function(f,d){var b=f.parentNode,c=String(d.title);if(b&&(b.tagName!="a")){b=null}if(c){if(!b){b=this.create("a");if(f.parentNode){f.parentNode.replaceChild(b,f)}b.appendChild(f)}b.setAttributeNS(pv.ns.xlink,"title",c);return b}if(b){b.parentNode.replaceChild(f,b)}return f};pv.SvgScene.dispatch=function(b){var a=b.target.$scene;if(a){a.scenes.mark.dispatch(b.type,a.scenes,a.index);b.preventDefault()}};pv.SvgScene.area=function(a){var k=a.$g.firstChild;if(!a.length){return k}var p=a[0];if(p.segmented){return this.areaSegment(a)}if(!p.visible){return k}var n=pv.color(p.fillStyle),o=pv.color(p.strokeStyle);if(!n.opacity&&!o.opacity){return k}var m="",l="";for(var h=0,f=a.length-1;f>=0;h++,f--){var g=a[h],d=a[f];m+=g.left+","+g.top+" ";l+=(d.left+d.width)+","+(d.top+d.height)+" ";if(h<a.length-1){var c=a[h+1],b=a[f-1];switch(p.interpolate){case"step-before":m+=g.left+","+c.top+" ";l+=(b.left+b.width)+","+(d.top+d.height)+" ";break;case"step-after":m+=c.left+","+g.top+" ";l+=(d.left+d.width)+","+(b.top+b.height)+" ";break}}}k=this.expect("polygon",k);k.setAttribute("cursor",p.cursor);k.setAttribute("points",m+l);var n=pv.color(p.fillStyle);k.setAttribute("fill",n.color);k.setAttribute("fill-opacity",n.opacity);var o=pv.color(p.strokeStyle);k.setAttribute("stroke",o.color);k.setAttribute("stroke-opacity",o.opacity);k.setAttribute("stroke-width",p.lineWidth);return this.append(k,a,0)};pv.SvgScene.areaSegment=function(a){var f=a.$g.firstChild;for(var d=0,c=a.length-1;d<c;d++){var h=a[d],g=a[d+1];if(!h.visible||!g.visible){continue}var j=pv.color(h.fillStyle),k=pv.color(h.strokeStyle);if(!j.opacity&&!k.opacity){continue}var b=h.left+","+h.top+" "+g.left+","+g.top+" "+(g.left+g.width)+","+(g.top+g.height)+" "+(h.left+h.width)+","+(h.top+h.height);f=this.expect("polygon",f);f.setAttribute("cursor",h.cursor);f.setAttribute("points",b);f.setAttribute("fill",j.color);f.setAttribute("fill-opacity",j.opacity);f.setAttribute("stroke",k.color);f.setAttribute("stroke-opacity",k.opacity);f.setAttribute("stroke-width",h.lineWidth);f=this.append(f,a,d)}return f};pv.SvgScene.bar=function(a){var g=a.$g.firstChild;for(var b=0;b<a.length;b++){var c=a[b];if(!c.visible){continue}var f=pv.color(c.fillStyle),d=pv.color(c.strokeStyle);if(!f.opacity&&!d.opacity){continue}g=this.expect("rect",g);g.setAttribute("cursor",c.cursor);g.setAttribute("x",c.left);g.setAttribute("y",c.top);g.setAttribute("width",Math.max(1e-10,c.width));g.setAttribute("height",Math.max(1e-10,c.height));g.setAttribute("fill",f.color);g.setAttribute("fill-opacity",f.opacity);g.setAttribute("stroke",d.color);g.setAttribute("stroke-opacity",d.opacity);g.setAttribute("stroke-width",c.lineWidth);g=this.append(g,a,b)}return g};pv.SvgScene.dot=function(b){var k=b.$g.firstChild;for(var d=0;d<b.length;d++){var p=b[d];if(!p.visible){continue}var n=pv.color(p.fillStyle),o=pv.color(p.strokeStyle);if(!n.opacity&&!o.opacity){continue}var j=Math.sqrt(p.size),l="",g="";switch(p.shape){case"cross":l="M"+-j+","+-j+"L"+j+","+j+"M"+j+","+-j+"L"+-j+","+j;break;case"triangle":var f=j,m=j*2/Math.sqrt(3);l="M0,"+f+"L"+m+","+-f+" "+-m+","+-f+"Z";break;case"diamond":j*=Math.sqrt(2);l="M0,"+-j+"L"+j+",0 0,"+j+" "+-j+",0Z";break;case"square":l="M"+-j+","+-j+"L"+j+","+-j+" "+j+","+j+" "+-j+","+j+"Z";break;case"tick":l="M0,0L0,"+-p.size;break;default:function a(h){return"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+(-h)+"A"+h+","+h+" 0 1,1 0,"+h+"Z"}if(p.lineWidth/2>j){g=a(p.lineWidth)}l=a(j);break}var c="translate("+p.left+","+p.top+")"+(p.angle?" rotate("+180*p.angle/Math.PI+")":"");k=this.expect("path",k);k.setAttribute("d",l);k.setAttribute("transform",c);k.setAttribute("fill",n.color);k.setAttribute("fill-opacity",n.opacity);k.setAttribute("cursor",p.cursor);if(g){k.setAttribute("stroke","none")}else{k.setAttribute("stroke",o.color);k.setAttribute("stroke-opacity",o.opacity);k.setAttribute("stroke-width",p.lineWidth)}k=this.append(k,b,d);if(g){k=this.expect("path",k);k.setAttribute("d",g);k.setAttribute("transform",c);k.setAttribute("fill",o.color);k.setAttribute("fill-opacity",o.opacity);k.setAttribute("cursor",p.cursor);k=this.append(k,b,d)}}return k};pv.SvgScene.image=function(a){var d=a.$g.firstChild;for(var b=0;b<a.length;b++){var c=a[b];if(!c.visible){continue}d=this.fill(d,a,b);d=this.expect("image",d);d.setAttribute("preserveAspectRatio","none");d.setAttribute("x",c.left);d.setAttribute("y",c.top);d.setAttribute("width",c.width);d.setAttribute("height",c.height);d.setAttribute("cursor",c.cursor);d.setAttributeNS(pv.ns.xlink,"href",c.url);d=this.append(d,a,b);d=this.stroke(d,a,b)}return d};pv.SvgScene.label=function(a){var d=a.$g.firstChild;for(var c=0;c<a.length;c++){var k=a[c];if(!k.visible){continue}var h=pv.color(k.textStyle);if(!h.opacity){continue}var g=0,f=0,j=0,b="start";switch(k.textBaseline){case"middle":j=".35em";break;case"top":j=".71em";f=k.textMargin;break;case"bottom":f="-"+k.textMargin;break}switch(k.textAlign){case"right":b="end";g="-"+k.textMargin;break;case"center":b="middle";break;case"left":g=k.textMargin;break}d=this.expect("text",d);d.setAttribute("pointer-events","none");d.setAttribute("x",g);d.setAttribute("y",f);d.setAttribute("dy",j);d.setAttribute("text-anchor",b);d.setAttribute("transform","translate("+k.left+","+k.top+")"+(k.textAngle?" rotate("+180*k.textAngle/Math.PI+")":""));d.setAttribute("fill",h.color);d.setAttribute("fill-opacity",h.opacity);d.style.font=k.font;d.style.textShadow=k.textShadow;if(d.firstChild){d.firstChild.nodeValue=k.text}else{d.appendChild(document.createTextNode(k.text))}d=this.append(d,a,c)}return d};pv.SvgScene.line=function(a){var g=a.$g.firstChild;if(a.length<2){return g}var k=a[0];if(k.segmented){return this.lineSegment(a)}if(!k.visible){return g}var h=pv.color(k.fillStyle),j=pv.color(k.strokeStyle);if(!h.opacity&&!j.opacity){return g}var b="";for(var d=0;d<a.length;d++){var f=a[d];b+=f.left+","+f.top+" ";if(d<a.length-1){var c=a[d+1];switch(k.interpolate){case"step-before":b+=f.left+","+c.top+" ";break;case"step-after":b+=c.left+","+f.top+" ";break}}}g=this.expect("polyline",g);g.setAttribute("cursor",k.cursor);g.setAttribute("points",b);g.setAttribute("fill",h.color);g.setAttribute("fill-opacity",h.opacity);g.setAttribute("stroke",j.color);g.setAttribute("stroke-opacity",j.opacity);g.setAttribute("stroke-width",k.lineWidth);return this.append(g,a,0)};pv.SvgScene.lineSegment=function(f){var z=f.$g.firstChild;for(var y=0,x=f.length-1;y<x;y++){var m=f[y],k=f[y+1];if(!m.visible||!k.visible){continue}var r=pv.color(m.strokeStyle);if(!r.opacity){continue}function A(d,c,b,a){return d.plus(c.times(b.minus(d).dot(a.perp())/c.dot(a.perp())))}var j=pv.vector(m.left,m.top),h=pv.vector(k.left,k.top),u=h.minus(j),t=u.perp().norm(),s=t.times(m.lineWidth/2),E=j.plus(s),D=h.plus(s),C=h.minus(s),B=j.minus(s);if(y>0){var q=f[y-1];if(q.visible){var o=j.minus(q.left,q.top).perp().norm().plus(t);B=A(j,o,B,u);E=A(j,o,E,u)}}if(y<(x-1)){var g=f[y+2];if(g.visible){var l=pv.vector(g.left,g.top).minus(h).perp().norm().plus(t);C=A(h,l,C,u);D=A(h,l,D,u)}}var u=E.x+","+E.y+" "+D.x+","+D.y+" "+C.x+","+C.y+" "+B.x+","+B.y;z=this.expect("polygon",z);z.setAttribute("cursor",m.cursor);z.setAttribute("points",u);z.setAttribute("fill",r.color);z.setAttribute("fill-opacity",r.opacity);z=this.append(z,f,y)}return z};var guid=0;pv.SvgScene.panel=function(b){var k=b.$g,l=k&&k.firstChild;for(var h=0;h<b.length;h++){var n=b[h];if(!n.visible){continue}if(!b.parent){n.canvas.style.display="inline-block";k=n.canvas.firstChild;if(!k){k=n.canvas.appendChild(this.create("svg"));k.onclick=k.onmousedown=k.onmouseup=k.onmousemove=k.onmouseout=k.onmouseover=pv.SvgScene.dispatch}b.$g=k;k.setAttribute("width",n.width+n.left+n.right);k.setAttribute("height",n.height+n.top+n.bottom);if(typeof l=="undefined"){l=k.firstChild}}if(n.overflow=="hidden"){var m=this.expect("g",l),d=(guid++).toString(36);m.setAttribute("clip-path","url(#"+d+")");if(!m.parentNode){k.appendChild(m)}b.$g=k=m;l=m.firstChild;l=this.expect("clipPath",l);l.setAttribute("id",d);var a=l.firstChild||l.appendChild(this.create("rect"));a.setAttribute("x",n.left);a.setAttribute("y",n.top);a.setAttribute("width",n.width);a.setAttribute("height",n.height);if(!l.parentNode){k.appendChild(l)}l=l.nextSibling}l=this.fill(l,b,h);for(var f=0;f<n.children.length;f++){n.children[f].$g=l=this.expect("g",l);l.setAttribute("transform","translate("+n.left+","+n.top+")");this.updateAll(n.children[f]);if(!l.parentNode){k.appendChild(l)}l=l.nextSibling}l=this.stroke(l,b,h);if(n.overflow=="hidden"){b.$g=k=m.parentNode;l=m.nextSibling}}return l};pv.SvgScene.fill=function(f,a,b){var c=a[b],d=pv.color(c.fillStyle);if(d.opacity){f=this.expect("rect",f);f.setAttribute("x",c.left);f.setAttribute("y",c.top);f.setAttribute("width",c.width);f.setAttribute("height",c.height);f.setAttribute("cursor",c.cursor);f.setAttribute("fill",d.color);f.setAttribute("fill-opacity",d.opacity);f=this.append(f,a,b)}return f};pv.SvgScene.stroke=function(f,a,b){var c=a[b],d=pv.color(c.strokeStyle);if(d.opacity){f=this.expect("rect",f);f.setAttribute("x",c.left);f.setAttribute("y",c.top);f.setAttribute("width",Math.max(1e-10,c.width));f.setAttribute("height",Math.max(1e-10,c.height));f.setAttribute("cursor",c.cursor);f.setAttribute("fill","none");f.setAttribute("stroke",d.color);f.setAttribute("stroke-opacity",d.opacity);f.setAttribute("stroke-width",c.lineWidth);f=this.append(f,a,b)}return f};pv.SvgScene.rule=function(a){var f=a.$g.firstChild;for(var b=0;b<a.length;b++){var c=a[b];if(!c.visible){continue}var d=pv.color(c.strokeStyle);if(!d.opacity){continue}f=this.expect("line",f);f.setAttribute("cursor",c.cursor);f.setAttribute("x1",c.left);f.setAttribute("y1",c.top);f.setAttribute("x2",c.left+c.width);f.setAttribute("y2",c.top+c.height);f.setAttribute("stroke",d.color);f.setAttribute("stroke-opacity",d.opacity);f.setAttribute("stroke-width",c.lineWidth);f=this.append(f,a,b)}return f};pv.SvgScene.wedge=function(b){var k=b.$g.firstChild;for(var j=0;j<b.length;j++){var u=b[j];if(!u.visible){continue}var r=pv.color(u.fillStyle),t=pv.color(u.strokeStyle);if(!r.opacity&&!t.opacity){continue}var f=u.innerRadius,d=u.outerRadius,n=Math.abs(u.angle),c;if(n>=2*Math.PI){if(f){c="M0,"+d+"A"+d+","+d+" 0 1,1 0,"+(-d)+"A"+d+","+d+" 0 1,1 0,"+d+"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+(-f)+"A"+f+","+f+" 0 1,1 0,"+f+"Z"}else{c="M0,"+d+"A"+d+","+d+" 0 1,1 0,"+(-d)+"A"+d+","+d+" 0 1,1 0,"+d+"Z"}}else{var m=Math.min(u.startAngle,u.endAngle),l=Math.max(u.startAngle,u.endAngle),h=Math.cos(m),g=Math.cos(l),q=Math.sin(m),o=Math.sin(l);if(f){c="M"+d*h+","+d*q+"A"+d+","+d+" 0 "+((n<Math.PI)?"0":"1")+",1 "+d*g+","+d*o+"L"+f*g+","+f*o+"A"+f+","+f+" 0 "+((n<Math.PI)?"0":"1")+",0 "+f*h+","+f*q+"Z"}else{c="M"+d*h+","+d*q+"A"+d+","+d+" 0 "+((n<Math.PI)?"0":"1")+",1 "+d*g+","+d*o+"L0,0Z"}}k=this.expect("path",k);k.setAttribute("fill-rule","evenodd");k.setAttribute("cursor",u.cursor);k.setAttribute("transform","translate("+u.left+","+u.top+")");k.setAttribute("d",c);k.setAttribute("fill",r.color);k.setAttribute("fill-opacity",r.opacity);k.setAttribute("stroke",t.color);k.setAttribute("stroke-opacity",t.opacity);k.setAttribute("stroke-width",u.lineWidth);k=this.append(k,b,j)}return k};pv.VmlScene={};pv.VmlScene.init=function(){document.createStyleSheet().addRule("v\\:*","behavior:url(#default#VML);display:inline-block");document.namespaces.add("v","urn:schemas-microsoft-com:vml");this.init=function(){}};pv.VmlScene.create=function(a){this.init();return document.createElement(a)};pv.VmlScene.expect=function(a,b){if(!b){return this.create(a)}if(b.tagName==a){return b}var c=this.create(a);b.parentNode.replaceChild(c,b);return c};pv.VmlScene.append=function(c,a,b){c.$scene={scenes:a,index:b};if(!c.parentNode||c.parentNode.nodeType==11){a.$g.appendChild(c)}return c.nextSibling};pv.VmlScene.dispatch=function(){var b=window.event;var a=b.srcElement.$scene;if(a){a.scenes.mark.dispatch(b.type,a.scenes,a.index);b.returnValue=false}};pv.VmlScene.area=function(b){var k=b.$g.firstChild;if(!b.length){return k}var n=b[0];if(n.segmented){return this.areaSegment(b)}if(!n.visible){return k}var l=pv.color(n.fillStyle),m=pv.color(n.strokeStyle);if(!l.opacity&&!m.opacity){return k}var c="";for(var g=0;g<b.length;g++){var h=b[g];c+=h.left+","+h.top+" "}for(var f=b.length-1;f>=0;f--){var d=b[f];c+=(d.left+d.width)+","+(d.top+d.height)+" "}k=this.expect("v:polyline",k);var a={root:k};a.root.appendChild(a.fill=this.create("v:fill"));a.root.appendChild(a.stroke=this.create("v:stroke"));a.root.style.cursor=n.cursor;a.root.title=n.title||"";a.root.points=c;a.fill.color=l.color;a.fill.opacity=l.opacity;a.stroke.color=m.color;a.stroke.opacity=m.opacity*Math.min(n.lineWidth,1);a.stroke.weight=n.lineWidth+"px";return this.append(k,b,0)};pv.VmlScene.bar=function(b){var h=b.$g.firstChild;for(var c=0;c<b.length;c++){var d=b[c];if(!d.visible){continue}var g=pv.color(d.fillStyle),f=pv.color(d.strokeStyle);if(!g.opacity&&!f.opacity){continue}h=this.expect("v:rect",h);var a={root:h};a.root.appendChild(a.fill=this.create("v:fill"));a.root.appendChild(a.stroke=this.create("v:stroke"));a.root.style.left=d.left;a.root.style.top=d.top;a.root.style.width=d.width;a.root.style.height=d.height;a.root.style.cursor=d.cursor;a.root.title=d.title||"";a.fill.color=g.color;a.fill.opacity=g.opacity;a.stroke.color=f.color;a.stroke.opacity=f.opacity*Math.min(d.lineWidth,1);a.stroke.weight=d.lineWidth+"px";h=this.append(h,b,c)}return h};pv.VmlScene.dot=function(c){var k=c.$g.firstChild;for(var f=0;f<c.length;f++){var u=c[f];if(!u.visible){continue}var r=pv.color(u.fillStyle),t=pv.color(u.strokeStyle);if(!r.opacity&&!t.opacity){continue}var j=Math.round(Math.sqrt(u.size));var l;switch(u.shape){case"cross":l="m"+-j+","+-j+"l"+j+","+j+"m"+j+","+-j+"l"+-j+","+j;break;case"triangle":var g=j,q=Math.round(j*2/Math.sqrt(3));l="m0,"+g+"l"+q+","+-g+" "+-q+","+-g+"x";break;case"diamond":j=Math.round(j*Math.sqrt(2));l="m0,"+-j+"l"+j+",0 0,"+j+" "+-j+",0x";break;case"square":l="m"+-j+","+-j+"l"+j+","+-j+" "+j+","+j+" "+-j+","+j+"x";break;case"tick":l="m0,0l0,"+-Math.round(u.size);break;default:l="ar-"+j+",-"+j+","+j+","+j+",0,0,0,0x";break}k=this.expect("v:group",k);var b={root:k};b.root.appendChild(b.shape=this.create("v:shape"));b.shape.appendChild(b.path=this.create("v:path"));b.shape.appendChild(b.fill=this.create("v:fill"));b.shape.appendChild(b.stroke=this.create("v:stroke"));var p=c.parent[c.parentIndex];var o=u.angle;if(o){var n=u.left,m=u.top;b.shape.style.left=Math.cos(-o)*n-Math.sin(-o)*m;b.shape.style.top=Math.sin(-o)*n+Math.cos(-o)*m;b.root.style.left=-p.width/2;b.root.style.top=-p.height/2;b.root.style.rotation=180*o/Math.PI;b.shape.style.marginLeft=p.width/2;b.shape.style.marginTop=p.height/2}else{b.root.style.rotation="";b.shape.style.left=u.left;b.shape.style.top=u.top}b.root.style.width=p.width;b.root.style.height=p.height;b.shape.style.width=p.width;b.shape.style.height=p.height;b.shape.style.cursor=u.cursor;b.shape.title=u.title||"";b.path.v=l;b.fill.color=r.color;b.fill.opacity=r.opacity;b.stroke.color=t.color;b.stroke.opacity=t.opacity*Math.min(u.lineWidth,1);b.stroke.weight=u.lineWidth+"px";k=this.append(k,c,f)}return k};pv.VmlScene.image=function(b){var h=b.$g.firstChild;for(var c=0;c<b.length;c++){var d=b[c];if(!d.visible){continue}h=this.expect("v:image",h);var a={root:h};a.root.appendChild(a.fill=this.create("v:fill"));a.root.appendChild(a.stroke=this.create("v:stroke"));a.root.filled=true;a.root.stroked=true;a.root.style.left=d.left;a.root.style.top=d.top;a.root.style.width=d.width;a.root.style.height=d.height;a.root.style.cursor=d.cursor;a.root.src=d.url;a.root.title=d.title||"";var g=pv.color(d.fillStyle);a.fill.color=g.color;a.fill.opacity=g.opacity;var f=pv.color(d.strokeStyle);a.stroke.color=f.color;a.stroke.opacity=f.opacity*Math.min(d.lineWidth,1);a.stroke.weight=d.lineWidth+"px";h=this.append(h,b,c)}return h};pv.VmlScene.label=function(b){var f=b.$g.firstChild;for(var d=0;d<b.length;d++){var o=b[d];if(!o.visible){continue}var l=pv.color(o.textStyle);if(!l.opacity){continue}f=this.expect("v:shape",f);var a={root:f};a.root.appendChild(a.path=this.create("v:path"));a.root.appendChild(a.fill=this.create("v:fill"));a.root.appendChild(a.text=this.create("v:textpath"));a.root.filled=true;a.root.stroked=false;a.root.style.width="100%";a.root.style.height="100%";a.path.textpathok=true;a.text.on=true;var q=0,m=0,n=10;switch(o.textBaseline){case"top":q=Math.round(-Math.sin(o.textAngle)*n);m=Math.round(Math.cos(o.textAngle)*n);break;case"bottom":q=-Math.round(-Math.sin(o.textAngle)*n);m=-Math.round(Math.cos(o.textAngle)*n);break}a.root.style.left=o.left+q;a.root.style.top=o.top+m;a.fill.color=l.color;a.fill.opacity=l.opacity;var h=Math.round(Math.cos(o.textAngle)*1000),g=Math.round(Math.sin(o.textAngle)*1000),k=Math.round(Math.cos(o.textAngle)*o.textMargin),j=Math.round(Math.sin(o.textAngle)*o.textMargin),c;switch(o.textAlign){case"right":c="M"+-h+","+-g+"L"+-k+","+-j;break;case"center":c="M"+-h+","+-g+"L"+h+","+g;break;default:c="M"+k+","+j+"L"+h+","+g;break}a.path.v=c;a.text.style.font=o.font;a.text.style.color="black";a.text.style["alignment-baseline"]="alphabetic";a.text.style["v-text-align"]=o.textAlign;a.text.string=o.text;f=this.append(f,b,d)}return f};pv.VmlScene.line=function(b){var g=b.$g.firstChild;if(b.length<2){return g}var m=b[0];if(m.segmented){return this.lineSegment(b)}if(!m.visible){return g}var k=pv.color(m.fillStyle),l=pv.color(m.strokeStyle);if(!k.opacity&&!l.opacity){return g}var c;for(var d=0;d<b.length;d++){var f=b[d],j=Math.round(f.left),h=Math.round(f.top);if(isNaN(j)){j=0}if(isNaN(h)){h=0}if(!c){c="m"+j+","+h+"l"}else{c+=j+","+h+" "}}g=this.expect("v:shape",g);var a={root:g};a.root.appendChild(a.path=this.create("v:path"));a.root.appendChild(a.fill=this.create("v:fill"));a.root.appendChild(a.stroke=this.create("v:stroke"));a.root.style.width="100%";a.root.style.height="100%";a.root.style.cursor=m.cursor;a.root.title=m.title||"";a.path.v=c;a.fill.color=k.color;a.fill.opacity=k.opacity;a.stroke.color=l.color;a.stroke.opacity=l.opacity*Math.min(m.lineWidth,1);a.stroke.weight=m.lineWidth+"px";return this.append(g,b,0)};pv.VmlScene.panel=function(b){var k=b.$g,l=k&&k.firstChild;for(var d=0;d<b.length;d++){var h=b[d];if(!h.visible){continue}if(!b.parent){h.canvas.style.position="relative";k=h.canvas.firstChild;if(!k){h.canvas.appendChild(k=this.create("v:group"));k.onclick=k.onmousedown=k.onmouseup=k.onmousemove=k.onmouseout=k.onmouseover=pv.VmlScene.dispatch}b.$g=k;var f=h.width+h.left+h.right;var a=h.height+h.top+h.bottom;k.style.position="relative";k.style.width=f;k.style.height=a;k.coordsize=f+","+a;if(typeof l=="undefined"){l=k.firstChild}}l=this.fill(l,b,d);for(var c=0;c<h.children.length;c++){h.children[c].$g=l=this.expect("v:group",l);l.style.position="absolute";l.style.width=h.width;l.style.height=h.height;l.style.left=h.left;l.style.top=h.top;l.coordsize=h.width+","+h.height;this.updateAll(h.children[c]);if(!l.parentNode||l.parentNode.nodeType==11){k.appendChild(l)}l=l.nextSibling}l=this.stroke(l,b,d)}return l};pv.VmlScene.fill=function(g,a,b){var d=a[b],f=pv.color(d.fillStyle);if(f.opacity){g=this.expect("v:rect",g);g.style.left=d.left;g.style.top=d.top;g.style.width=d.width;g.style.height=d.height;g.style.cursor=d.cursor;var h=g.appendChild(this.create("v:fill"));h.color=f.color;h.opacity=f.opacity;g=this.append(g,a,b)}return g};pv.VmlScene.stroke=function(j,a,b){var d=a[b],h=pv.color(d.strokeStyle);if(h.opacity){j=this.expect("v:rect",j);j.style.left=d.left;j.style.top=d.top;j.style.width=d.width;j.style.height=d.height;j.style.cursor=d.cursor;var g=j.appendChild(this.create("v:fill"));g.opacity=0;var k=j.appendChild(this.create("v:stroke"));k.color=h.color;k.opacity=h.opacity*Math.min(d.lineWidth,1);k.weight=d.lineWidth+"px";j=this.append(j,a,b)}return j};pv.VmlScene.rule=function(b){var h=b.$g.firstChild;for(var d=0;d<b.length;d++){var f=b[d];if(!f.visible){continue}var g=pv.color(f.strokeStyle);if(!g.opacity){continue}h=this.expect("v:line",h);var a={root:h};a.root.appendChild(a.stroke=this.create("v:stroke"));a.root.title=f.title;a.root.style.cursor=f.cursor;a.root.from=f.left+","+f.top;a.root.to=(f.left+f.width)+","+(f.top+f.height);var c=pv.color(f.strokeStyle);a.stroke.color=c.color;a.stroke.opacity=c.opacity*Math.min(f.lineWidth,1);a.stroke.weight=f.lineWidth+"px";h=this.append(h,b,d)}return h};pv.VmlScene.wedge=function(c){var j=c.$g.firstChild;for(var h=0;h<c.length;h++){var p=c[h];if(!p.visible){continue}var n=pv.color(p.fillStyle),o=pv.color(p.strokeStyle);if(!n.opacity&&!o.opacity){continue}var g=Math.round(p.innerRadius),f=Math.round(p.outerRadius),k;if(p.angle>=2*Math.PI){if(g){k="AE0,0 "+f+","+f+" 0 23592960AL0,0 "+g+","+g+" 0 23592960"}else{k="AE0,0 "+f+","+f+" 0 23592960"}}else{var m=Math.round(p.startAngle/Math.PI*11796480),l=Math.round(p.angle/Math.PI*11796480);if(g){k="AE 0,0 "+f+","+f+" "+-m+" "+-l+" 0,0 "+g+","+g+" "+-(m+l)+" "+l+"X"}else{k="M0,0AE0,0 "+f+","+f+" "+-m+" "+-l+"X"}}j=this.expect("v:shape",j);var b={root:j};b.root.appendChild(b.path=this.create("v:path"));b.root.appendChild(b.fill=this.create("v:fill"));b.root.appendChild(b.stroke=this.create("v:stroke"));b.root.style.left=p.left;b.root.style.top=p.top;b.root.style.width="100%";b.root.style.height="100%";b.root.style.cursor=p.cursor;b.root.title=p.title||"";b.fill.color=n.color;b.fill.opacity=n.opacity;b.stroke.color=o.color;b.stroke.opacity=o.opacity*Math.min(p.lineWidth,1);b.stroke.weight=p.lineWidth+"px";b.path.v=k;j=this.append(j,c,h)}return j};pv.Scene=document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?pv.SvgScene:pv.VmlScene;pv.Scene.updateAll=function(a){if(!a.length){return}if((a[0].reverse)&&(a.type!="line")&&(a.type!="area")){var d=pv.extend(a);for(var c=0,b=a.length-1;b>=0;c++,b--){d[c]=a[b]}a=d}this.removeSiblings(this[a.type](a))};pv.Scene.removeSiblings=function(a){while(a){var b=a.nextSibling;a.parentNode.removeChild(a);a=b}};pv.Mark=function(){this.$properties=[]};pv.Mark.prototype.properties={};pv.Mark.prototype.property=function(a){if(!this.hasOwnProperty("properties")){this.properties=pv.extend(this.properties)}this.properties[a]=true;pv.Mark.prototype[a]=function(b){if(arguments.length){this.$properties.push({name:a,type:(typeof b=="function")?3:2,value:b});return this}return this.scene[this.index][a]};return this};pv.Mark.prototype.property("data").property("visible").property("left").property("right").property("top").property("bottom").property("cursor").property("title").property("reverse");pv.Mark.prototype.childIndex=-1;pv.Mark.prototype.index=-1;pv.Mark.prototype.defaults=new pv.Mark().data(function(a){return[a]}).visible(true).reverse(false).cursor("").title("");var defaultFillStyle=pv.Colors.category20().by(pv.parent),defaultStrokeStyle=pv.Colors.category10().by(pv.parent);pv.Mark.prototype.extend=function(a){this.proto=a;return this};pv.Mark.prototype.add=function(a){return this.parent.add(a).extend(this)};pv.Mark.prototype.def=function(a,b){this.$properties.push({name:a,type:(typeof b=="function")?1:0,value:b});return this};pv.Mark.prototype.anchor=function(b){var a=new pv.Anchor().extend(this).name(b);a.parent=this.parent;return a};pv.Mark.prototype.anchorTarget=function(){var a=this;while(!(a instanceof pv.Anchor)){a=a.proto;if(!a){return null}}return a.proto};pv.Mark.prototype.first=function(){return this.scene[0]};pv.Mark.prototype.last=function(){return this.scene[this.scene.length-1]};pv.Mark.prototype.sibling=function(){return(this.index==0)?null:this.scene[this.index-1]};pv.Mark.prototype.cousin=function(){var b=this.parent,a=b&&b.sibling();return(a&&a.children)?a.children[this.childIndex][this.index]:null};pv.Mark.prototype.render=function(){this.bind();this.build();pv.Scene.updateAll(this.scene)};function argv(b){var a=[];while(b){a.push(b.scene[b.index].data);b=b.parent}return a}pv.Mark.prototype.bind=function(){var a={},l=[[],[],[],[]],k,f;function n(r){do{var o=r.$properties;for(var d=o.length-1;d>=0;d--){var q=o[d];if(!(q.name in a)){a[q.name]=1;switch(q.name){case"data":k=q;break;case"visible":f=q;break;default:l[q.type].push(q);break}}}}while(r=r.proto)}function c(d){return function(o){var i=this.scene.defs;if(arguments.length){if(o==undefined){delete i.locked[d]}else{i.locked[d]=true}i.values[d]=o;return this}else{return i.values[d]}}}n(this);n(this.defaults);l[1].reverse();l[3].reverse();var g=this;do{for(var b in g.properties){if(!(b in a)){a[b]=1;l[2].push({name:b,type:2,value:null})}}}while(g=g.proto);var h=l[0].concat(l[1]);for(var j=0;j<h.length;j++){var m=h[j];this[m.name]=c(m.name)}this.binds={data:k,visible:f,defs:h,properties:pv.blend(l)}};pv.Mark.prototype.build=function(){var g=this.scene;if(!g){g=this.scene=[];g.mark=this;g.type=this.type;g.childIndex=this.childIndex;if(this.parent){g.parent=this.parent.scene;g.parentIndex=this.parent.index}}var j=this.root.scene.data;if(!j){this.root.scene.data=j=argv(this.parent)}if(this.binds.defs.length){var b=g.defs;if(!b){g.defs=b={values:{},locked:{}}}for(var f=0;f<this.binds.defs.length;f++){var h=this.binds.defs[f];if(!(h.name in b.locked)){var k=h.value;if(h.type==1){property=h.name;k=k.apply(this,j)}b.values[h.name]=k}}}var c=this.binds.data;switch(c.type){case 0:case 1:c=b.values.data;break;case 2:c=c.value;break;case 3:property="data";c=c.value.apply(this,j);break}j.unshift(null);g.length=c.length;for(var f=0;f<c.length;f++){pv.Mark.prototype.index=this.index=f;var l=g[f];if(!l){g[f]=l={}}l.data=j[0]=c[f];var a=this.binds.visible;switch(a.type){case 0:case 1:a=b.values.visible;break;case 2:a=a.value;break;case 3:property="visible";a=a.value.apply(this,j);break}if(l.visible=a){this.buildInstance(l)}}j.shift();delete this.index;pv.Mark.prototype.index=-1;if(!this.parent){g.data=null}return this};pv.Mark.prototype.buildProperties=function(d,c){for(var b=0,g=c.length;b<g;b++){var f=c[b],a=f.value;switch(f.type){case 0:case 1:a=this.scene.defs.values[f.name];break;case 3:property=f.name;a=a.apply(this,this.root.scene.data);break}d[f.name]=a}};pv.Mark.prototype.buildInstance=function(a){this.buildProperties(a,this.binds.properties);this.buildImplied(a)};pv.Mark.prototype.buildImplied=function(n){var f=n.left;var a=n.right;var m=n.top;var i=n.bottom;var d=this.properties;var j=d.width?n.width:0;var g=d.height?n.height:0;var c=this.parent?this.parent.width():(j+f+a);if(j==null){j=c-(a=a||0)-(f=f||0)}else{if(a==null){a=c-j-(f=f||0)}else{if(f==null){f=c-j-(a=a||0)}}}var k=this.parent?this.parent.height():(g+m+i);if(g==null){g=k-(m=m||0)-(i=i||0)}else{if(i==null){i=k-g-(m=m||0)}else{if(m==null){m=k-g-(i=i||0)}}}n.left=f;n.right=a;n.top=m;n.bottom=i;if(d.width){n.width=j}if(d.height){n.height=g}};var property;var pageX=0,pageY=0;pv.listen(document,"mousemove",function(c){c=c||window.event;pageX=c.pageX;pageY=c.pageY;if(pageX==undefined&&c.clientX!=undefined){var b=document.documentElement,a=document.body;pageX=c.clientX+(b&&b.scrollLeft||a&&a.scrollLeft||0)-(b&&b.clientLeft||a&&a.clientLeft||0);pageY=c.clientY+(b&&b.scrollTop||a&&a.scrollTop||0)-(b&&b.clientTop||a&&a.clientTop||0)}});pv.Mark.prototype.mouse=function(){var a=0,d=0,c=(this instanceof pv.Panel)?this:this.parent;do{a+=c.left();d+=c.top()}while(c=c.parent);var b=this.root.canvas();do{a+=b.offsetLeft;d+=b.offsetTop}while(b=b.offsetParent);return pv.vector(pageX-a,pageY-d)};pv.Mark.prototype.event=function(b,a){if(!this.$handlers){this.$handlers={}}this.$handlers[b]=a;return this};pv.Mark.prototype.dispatch=function(d,a,c){var b=this.$handlers&&this.$handlers[d];if(!b){if(this.parent){this.parent.dispatch(d,a.parent,a.parentIndex)}return}try{var f=this;do{f.index=c;f.scene=a;c=a.parentIndex;a=a.parent}while(f=f.parent);try{f=b.apply(this,this.root.scene.data=argv(this))}finally{this.root.scene.data=null}if(f instanceof pv.Mark){f.render()}}finally{var f=this;do{if(f.parent){delete f.scene}delete f.index}while(f=f.parent)}};pv.Anchor=function(){pv.Mark.call(this)};pv.Anchor.prototype=pv.extend(pv.Mark).property("name");pv.Area=function(){pv.Mark.call(this)};pv.Area.prototype=pv.extend(pv.Mark).property("width").property("height").property("lineWidth").property("strokeStyle").property("fillStyle").property("segmented").property("interpolate");pv.Area.prototype.type="area";pv.Area.prototype.defaults=new pv.Area().extend(pv.Mark.prototype.defaults).lineWidth(1.5).fillStyle(defaultFillStyle).interpolate("linear");pv.Area.prototype.anchor=function(a){var b=this;return pv.Mark.prototype.anchor.call(this,a).left(function(){switch(this.name()){case"bottom":case"top":case"center":return b.left()+b.width()/2;case"right":return b.left()+b.width()}return null}).right(function(){switch(this.name()){case"bottom":case"top":case"center":return b.right()+b.width()/2;case"left":return b.right()+b.width()}return null}).top(function(){switch(this.name()){case"left":case"right":case"center":return b.top()+b.height()/2;case"bottom":return b.top()+b.height()}return null}).bottom(function(){switch(this.name()){case"left":case"right":case"center":return b.bottom()+b.height()/2;case"top":return b.bottom()+b.height()}return null}).textAlign(function(){switch(this.name()){case"bottom":case"top":case"center":return"center";case"right":return"right"}return"left"}).textBaseline(function(){switch(this.name()){case"right":case"left":case"center":return"middle";case"top":return"top"}return"bottom"})};pv.Area.prototype.buildImplied=function(a){if(a.height==null){a.height=0}if(a.width==null){a.width=0}pv.Mark.prototype.buildImplied.call(this,a)};var pv_Area_specials={left:1,top:1,right:1,bottom:1,width:1,height:1,name:1};pv.Area.prototype.bind=function(){pv.Mark.prototype.bind.call(this);var d=this.binds,c=d.properties,a=d.specials=[];for(var b=0,g=c.length;b<g;b++){var f=c[b];if(f.name in pv_Area_specials){a.push(f)}}};pv.Area.prototype.buildInstance=function(a){if(this.index&&!this.scene[0].segmented){this.buildProperties(a,this.binds.specials);this.buildImplied(a)}else{pv.Mark.prototype.buildInstance.call(this,a)}};pv.Bar=function(){pv.Mark.call(this)};pv.Bar.prototype=pv.extend(pv.Mark).property("width").property("height").property("lineWidth").property("strokeStyle").property("fillStyle");pv.Bar.prototype.type="bar";pv.Bar.prototype.defaults=new pv.Bar().extend(pv.Mark.prototype.defaults).lineWidth(1.5).fillStyle(defaultFillStyle);pv.Bar.prototype.anchor=function(a){var b=this;return pv.Mark.prototype.anchor.call(this,a).left(function(){switch(this.name()){case"bottom":case"top":case"center":return b.left()+(this.properties.width?0:(b.width()/2));case"right":return b.left()+b.width()}return null}).right(function(){switch(this.name()){case"bottom":case"top":case"center":return b.right()+(this.properties.width?0:(b.width()/2));case"left":return b.right()+b.width()}return null}).top(function(){switch(this.name()){case"left":case"right":case"center":return b.top()+(this.properties.height?0:(b.height()/2));case"bottom":return b.top()+b.height()}return null}).bottom(function(){switch(this.name()){case"left":case"right":case"center":return b.bottom()+(this.properties.height?0:(b.height()/2));case"top":return b.bottom()+b.height()}return null}).textAlign(function(){switch(this.name()){case"bottom":case"top":case"center":return"center";case"right":return"right"}return"left"}).textBaseline(function(){switch(this.name()){case"right":case"left":case"center":return"middle";case"top":return"top"}return"bottom"})};pv.Dot=function(){pv.Mark.call(this)};pv.Dot.prototype=pv.extend(pv.Mark).property("size").property("shape").property("angle").property("lineWidth").property("strokeStyle").property("fillStyle");pv.Dot.prototype.type="dot";pv.Dot.prototype.defaults=new pv.Dot().extend(pv.Mark.prototype.defaults).size(20).shape("circle").lineWidth(1.5).strokeStyle(defaultStrokeStyle);pv.Dot.prototype.anchor=function(b){var a=this;return pv.Mark.prototype.anchor.call(this,b).left(function(c){switch(this.name()){case"bottom":case"top":case"center":return a.left();case"right":return a.left()+a.radius()}return null}).right(function(c){switch(this.name()){case"bottom":case"top":case"center":return a.right();case"left":return a.right()+a.radius()}return null}).top(function(c){switch(this.name()){case"left":case"right":case"center":return a.top();case"bottom":return a.top()+a.radius()}return null}).bottom(function(c){switch(this.name()){case"left":case"right":case"center":return a.bottom();case"top":return a.bottom()+a.radius()}return null}).textAlign(function(c){switch(this.name()){case"left":return"right";case"bottom":case"top":case"center":return"center"}return"left"}).textBaseline(function(c){switch(this.name()){case"right":case"left":case"center":return"middle";case"bottom":return"top"}return"bottom"})};pv.Dot.prototype.radius=function(){return Math.sqrt(this.size())};pv.Label=function(){pv.Mark.call(this)};pv.Label.prototype=pv.extend(pv.Mark).property("text").property("font").property("textAngle").property("textStyle").property("textAlign").property("textBaseline").property("textMargin").property("textShadow");pv.Label.prototype.type="label";pv.Label.prototype.defaults=new pv.Label().extend(pv.Mark.prototype.defaults).text(pv.identity).font("10px sans-serif").textAngle(0).textStyle("black").textAlign("left").textBaseline("bottom").textMargin(3);pv.Line=function(){pv.Mark.call(this)};pv.Line.prototype=pv.extend(pv.Mark).property("lineWidth").property("strokeStyle").property("fillStyle").property("segmented").property("interpolate");pv.Line.prototype.type="line";pv.Line.prototype.defaults=new pv.Line().extend(pv.Mark.prototype.defaults).lineWidth(1.5).strokeStyle(defaultStrokeStyle).interpolate("linear");var pv_Line_specials={left:1,top:1,right:1,bottom:1,name:1};pv.Line.prototype.bind=function(){pv.Mark.prototype.bind.call(this);var d=this.binds,c=d.properties,a=d.specials=[];for(var b=0,g=c.length;b<g;b++){var f=c[b];if(f.name in pv_Line_specials){a.push(f)}}};pv.Line.prototype.buildInstance=function(a){if(this.index&&!this.scene[0].segmented){this.buildProperties(a,this.binds.specials);this.buildImplied(a)}else{pv.Mark.prototype.buildInstance.call(this,a)}};pv.Rule=function(){pv.Mark.call(this)};pv.Rule.prototype=pv.extend(pv.Mark).property("width").property("height").property("lineWidth").property("strokeStyle");pv.Rule.prototype.type="rule";pv.Rule.prototype.defaults=new pv.Rule().extend(pv.Mark.prototype.defaults).lineWidth(1).strokeStyle("black");pv.Rule.prototype.anchor=function(a){return pv.Bar.prototype.anchor.call(this,a).textAlign(function(b){switch(this.name()){case"left":return"right";case"bottom":case"top":case"center":return"center";case"right":return"left"}}).textBaseline(function(b){switch(this.name()){case"right":case"left":case"center":return"middle";case"top":return"bottom";case"bottom":return"top"}})};pv.Rule.prototype.buildImplied=function(f){var c=f.left,g=f.right,d=f.top,a=f.bottom;if((f.width!=null)||((c==null)&&(g==null))||((g!=null)&&(c!=null))){f.height=0}else{f.width=0}pv.Mark.prototype.buildImplied.call(this,f)};pv.Panel=function(){pv.Bar.call(this);this.children=[];this.root=this;this.$dom=pv.Panel.$dom};pv.Panel.prototype=pv.extend(pv.Bar).property("canvas").property("overflow");pv.Panel.prototype.type="panel";pv.Panel.prototype.defaults=new pv.Panel().extend(pv.Bar.prototype.defaults).fillStyle(null).overflow("visible");pv.Panel.prototype.anchor=function(b){function c(){return 0}c.prototype=this;c.prototype.left=c.prototype.right=c.prototype.top=c.prototype.bottom=c;var a=pv.Bar.prototype.anchor.call(new c(),b).data(function(f){return[f]});a.parent=this;return a};pv.Panel.prototype.add=function(a){var b=new a();b.parent=this;b.root=this.root;b.childIndex=this.children.length;this.children.push(b);return b};pv.Panel.prototype.bind=function(){pv.Mark.prototype.bind.call(this);for(var a=0;a<this.children.length;a++){this.children[a].bind()}};pv.Panel.prototype.buildInstance=function(b){pv.Bar.prototype.buildInstance.call(this,b);if(!b.children){b.children=[]}for(var a=0;a<this.children.length;a++){this.children[a].scene=b.children[a];this.children[a].build()}for(var a=0;a<this.children.length;a++){b.children[a]=this.children[a].scene;delete this.children[a].scene}b.children.length=this.children.length};pv.Panel.prototype.buildImplied=function(d){if(!this.parent){var g=d.canvas;if(g){if(typeof g=="string"){g=document.getElementById(g)}if(g.$panel!=this){g.$panel=this;g.innerHTML=""}var a,b;if(d.width==null){a=parseFloat(pv.css(g,"width"));d.width=a-d.left-d.right}if(d.height==null){b=parseFloat(pv.css(g,"height"));d.height=b-d.top-d.bottom}}else{if(d.$canvas){g=d.$canvas}else{function f(){var c=document.body;while(c.lastChild&&c.lastChild.tagName){c=c.lastChild}return(c==document.body)?c:c.parentNode}g=d.$canvas=document.createElement("span");this.$dom?this.$dom.parentNode.insertBefore(g,this.$dom):f().appendChild(g)}}d.canvas=g}pv.Bar.prototype.buildImplied.call(this,d)};pv.Image=function(){pv.Bar.call(this)};pv.Image.prototype=pv.extend(pv.Bar).property("url");pv.Image.prototype.type="image";pv.Image.prototype.defaults=new pv.Image().extend(pv.Bar.prototype.defaults).fillStyle(null);pv.Wedge=function(){pv.Mark.call(this)};pv.Wedge.prototype=pv.extend(pv.Mark).property("startAngle").property("endAngle").property("angle").property("innerRadius").property("outerRadius").property("lineWidth").property("strokeStyle").property("fillStyle");pv.Wedge.prototype.type="wedge";pv.Wedge.prototype.defaults=new pv.Wedge().extend(pv.Mark.prototype.defaults).startAngle(function(){var a=this.sibling();return a?a.endAngle:-Math.PI/2}).innerRadius(0).lineWidth(1.5).strokeStyle(null).fillStyle(defaultFillStyle.by(pv.index));pv.Wedge.prototype.midRadius=function(){return(this.innerRadius()+this.outerRadius())/2};pv.Wedge.prototype.midAngle=function(){return(this.startAngle()+this.endAngle())/2};pv.Wedge.prototype.anchor=function(b){var a=this;return pv.Mark.prototype.anchor.call(this,b).left(function(){switch(this.name()){case"outer":return a.left()+a.outerRadius()*Math.cos(a.midAngle());case"inner":return a.left()+a.innerRadius()*Math.cos(a.midAngle());case"start":return a.left()+a.midRadius()*Math.cos(a.startAngle());case"center":return a.left()+a.midRadius()*Math.cos(a.midAngle());case"end":return a.left()+a.midRadius()*Math.cos(a.endAngle())}}).right(function(){switch(this.name()){case"outer":return a.right()+a.outerRadius()*Math.cos(a.midAngle());case"inner":return a.right()+a.innerRadius()*Math.cos(a.midAngle());case"start":return a.right()+a.midRadius()*Math.cos(a.startAngle());case"center":return a.right()+a.midRadius()*Math.cos(a.midAngle());case"end":return a.right()+a.midRadius()*Math.cos(a.endAngle())}}).top(function(){switch(this.name()){case"outer":return a.top()+a.outerRadius()*Math.sin(a.midAngle());case"inner":return a.top()+a.innerRadius()*Math.sin(a.midAngle());case"start":return a.top()+a.midRadius()*Math.sin(a.startAngle());case"center":return a.top()+a.midRadius()*Math.sin(a.midAngle());case"end":return a.top()+a.midRadius()*Math.sin(a.endAngle())}}).bottom(function(){switch(this.name()){case"outer":return a.bottom()+a.outerRadius()*Math.sin(a.midAngle());case"inner":return a.bottom()+a.innerRadius()*Math.sin(a.midAngle());case"start":return a.bottom()+a.midRadius()*Math.sin(a.startAngle());case"center":return a.bottom()+a.midRadius()*Math.sin(a.midAngle());case"end":return a.bottom()+a.midRadius()*Math.sin(a.endAngle())}}).textAlign(function(){switch(this.name()){case"outer":return pv.Wedge.upright(a.midAngle())?"right":"left";case"inner":return pv.Wedge.upright(a.midAngle())?"left":"right"}return"center"}).textBaseline(function(){switch(this.name()){case"start":return pv.Wedge.upright(a.startAngle())?"top":"bottom";case"end":return pv.Wedge.upright(a.endAngle())?"bottom":"top"}return"middle"}).textAngle(function(){var c=0;switch(this.name()){case"center":case"inner":case"outer":c=a.midAngle();break;case"start":c=a.startAngle();break;case"end":c=a.endAngle();break}return pv.Wedge.upright(c)?c:(c+Math.PI)})};pv.Wedge.upright=function(a){a=a%(2*Math.PI);a=(a<0)?(2*Math.PI+a):a;return(a<Math.PI/2)||(a>3*Math.PI/2)};pv.Wedge.prototype.buildImplied=function(a){pv.Mark.prototype.buildImplied.call(this,a);if(a.endAngle==null){a.endAngle=a.startAngle+a.angle}if(a.angle==null){a.angle=a.endAngle-a.startAngle}};pv.Layout={};pv.Layout.grid=function(d){var c=d.length,f=d[0].length;function a(){return this.parent.width()/f}function b(){return this.parent.height()/c}return new pv.Mark().data(pv.blend(d)).left(function(){return a.call(this)*(this.index%f)}).top(function(){return b.call(this)*Math.floor(this.index/f)}).width(a).height(b)};pv.Layout.stack=function(){var b=function(){return 0};function a(){var d=this.parent.index,f,g;while((d-->0)&&!g){f=this.parent.scene[d];if(f.visible){g=f.children[this.childIndex][this.index]}}if(g){switch(property){case"bottom":return g.bottom+g.height;case"top":return g.top+g.height;case"left":return g.left+g.width;case"right":return g.right+g.width}}return b.apply(this,arguments)}a.offset=function(c){b=(c instanceof Function)?c:function(){return c};return this};return a};pv.Layout.icicle=function(l){var j=[],c=Number;function k(p){var o={size:0,children:[],keys:j.slice()};for(var n in p){var q=p[n],m=c(q);j.push(n);if(isNaN(m)){q=k(q)}else{q={size:m,data:q,keys:j.slice()}}o.children.push(q);o.size+=q.size;j.pop()}o.children.sort(function(s,r){return r.size-s.size});return o}function d(o,m){o.size*=m;if(o.children){for(var n=0;n<o.children.length;n++){d(o.children[n],m)}}}function h(n,m){m=m?(m+1):1;return n.children?pv.max(n.children,function(o){return h(o,m)}):m}function i(n){if(n.children){b(n);for(var m=0;m<n.children.length;m++){i(n.children[m])}}}function b(o){var p=o.left;for(var m=0;m<o.children.length;m++){var q=o.children[m],n=(q.size/o.size)*o.width;q.left=p;q.top=o.top+o.height;q.width=n;q.height=o.height;q.depth=o.depth+1;p+=n;if(q.children){b(q)}}}function a(n,o){if(n.children){for(var m=0;m<n.children.length;m++){a(n.children[m],o)}}o.push(n);return o}function g(){var m=k(l);m.top=0;m.left=0;m.width=this.parent.width();m.height=this.parent.height()/h(m);m.depth=0;i(m);return a(m,[]).reverse()}var f=new pv.Mark().data(g).left(function(m){return m.left}).top(function(m){return m.top}).width(function(m){return m.width}).height(function(m){return m.height});f.root=function(m){j=[m];return this};f.size=function(m){c=m;return this};return f};pv.Layout.sunburst=function(p){var n=[],d=Number,m,k,c;function o(s){var r={size:0,children:[],keys:n.slice()};for(var q in s){var t=s[q],h=d(t);n.push(q);if(isNaN(h)){t=o(t)}else{t={size:h,data:t,keys:n.slice()}}r.children.push(t);r.size+=t.size;n.pop()}r.children.sort(function(v,u){return u.size-v.size});return r}function f(r,h){r.size*=h;if(r.children){for(var q=0;q<r.children.length;q++){f(r.children[q],h)}}}function j(q,h){h=h?(h+1):1;return q.children?pv.max(q.children,function(r){return j(r,h)}):h}function l(q){if(q.children){b(q);for(var h=0;h<q.children.length;h++){l(q.children[h])}}}function b(r){var q=r.startAngle;for(var h=0;h<r.children.length;h++){var t=r.children[h],s=(t.size/r.size)*r.angle;t.startAngle=q;t.angle=s;t.endAngle=q+s;t.depth=r.depth+1;t.left=m/2;t.top=k/2;t.innerRadius=Math.max(0,t.depth-0.5)*c;t.outerRadius=(t.depth+0.5)*c;q+=s;if(t.children){b(t)}}}function a(q,r){if(q.children){for(var h=0;h<q.children.length;h++){a(q.children[h],r)}}r.push(q);return r}function i(){var h=o(p);m=this.parent.width();k=this.parent.height();c=Math.min(m,k)/2/(j(h)-0.5);h.left=m/2;h.top=k/2;h.startAngle=0;h.angle=2*Math.PI;h.endAngle=2*Math.PI;h.innerRadius=0;h.outerRadius=c;h.depth=0;l(h);return a(h,[]).reverse()}var g=new pv.Mark().data(i).left(function(h){return h.left}).top(function(h){return h.top}).startAngle(function(h){return h.startAngle}).angle(function(h){return h.angle}).innerRadius(function(h){return h.innerRadius}).outerRadius(function(h){return h.outerRadius});g.root=function(h){n=[h];return this};g.size=function(h){d=h;return this};return g};pv.Layout.treemap=function(o){var k=[],l,n,c=Number;function b(p){return l?Math.round(p):p}function m(s){var r={size:0,children:[],keys:k.slice()};for(var q in s){var t=s[q],p=c(t);k.push(q);if(isNaN(p)){t=m(t)}else{t={size:p,data:t,keys:k.slice()}}r.children.push(t);r.size+=t.size;k.pop()}r.children.sort(function(v,u){return v.size-u.size});return r}function d(r,p){r.size*=p;if(r.children){for(var q=0;q<r.children.length;q++){d(r.children[q],p)}}}function j(w,p){var x=-Infinity,q=Infinity,u=0;for(var t=0;t<w.length;t++){var v=w[t].size;if(v<q){q=v}if(v>x){x=v}u+=v}u=u*u;p=p*p;return Math.max(p*x/u,u/(p*q))}function h(r){var E=[],A=Infinity;var C=r.left+(n?n.left:0),B=r.top+(n?n.top:0),D=r.width-(n?n.left+n.right:0),z=r.height-(n?n.top+n.bottom:0),s=Math.min(D,z);d(r,D*z/r.size);function v(H){var F=pv.sum(H,function(J){return J.size}),y=(s==0)?0:b(F/s);for(var x=0,G=0;x<H.length;x++){var I=H[x],w=b(I.size/y);if(D==s){I.left=C+G;I.top=B;I.width=w;I.height=y}else{I.left=C;I.top=B+G;I.width=y;I.height=w}G+=w}if(D==s){if(I){I.width+=D-G}B+=y;z-=y}else{if(I){I.height+=z-G}C+=y;D-=y}s=Math.min(D,z)}var q=r.children.slice();while(q.length>0){var p=q[q.length-1];if(p.size<=0){q.pop();continue}E.push(p);var t=j(E,s);if(t<=A){q.pop();A=t}else{E.pop();v(E);E.length=0;A=Infinity}}if(E.length>0){v(E)}if(D==s){for(var u=0;u<E.length;u++){E[u].width+=D}}else{for(var u=0;u<E.length;u++){E[u].height+=z}}}function i(q){if(q.children){h(q);for(var p=0;p<q.children.length;p++){var r=q.children[p];r.depth=q.depth+1;i(r)}}}function a(q,r){if(q.children){for(var p=0;p<q.children.length;p++){a(q.children[p],r)}}if(n||!q.children){r.push(q)}return r}function g(){var p=m(o);p.left=0;p.top=0;p.width=this.parent.width();p.height=this.parent.height();p.depth=0;i(p);return a(p,[]).reverse()}var f=new pv.Mark().data(g).left(function(p){return p.left}).top(function(p){return p.top}).width(function(p){return p.width}).height(function(p){return p.height});f.round=function(p){l=p;return this};f.inset=function(s,q,p,r){if(arguments.length==1){q=p=r=s}n={top:s,right:q,bottom:p,left:r};return this};f.root=function(p){k=[p];return this};f.size=function(p){c=p;return this};return f}; return pv;}();pv.listen(window,"load",function(){pv.$={i:0,x:document.getElementsByTagName("script")};for(;pv.$.i<pv.$.x.length;pv.$.i++){pv.$.s=pv.Panel.$dom=pv.$.x[pv.$.i];if(pv.$.s.type=="text/javascript+protovis"){try{window.eval(pv.parse(pv.$.s.textContent||pv.$.s.innerHTML))}catch(e){pv.error(e)}}}delete pv.Panel.$dom;delete pv.$});/*! 583 * jQuery JavaScript Library v1.4.1 584 * http://jquery.com/ 585 * 586 * Copyright 2010, John Resig 587 * Dual licensed under the MIT or GPL Version 2 licenses. 588 * http://jquery.org/license 589 * 590 * Includes Sizzle.js 591 * http://sizzlejs.com/ 592 * Copyright 2010, The Dojo Foundation 593 * Released under the MIT, BSD, and GPL Licenses. 594 * 595 * Date: Mon Jan 25 19:43:33 2010 -0500 596 */ 597 (function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n<j;n++)e(a[n],b,f?d.call(a[n],n,e(a[n],b)):d,i);return a}return j? 598 e(a[0],b):null}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function ma(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function na(a){var b,d=[],f=[],e=arguments,i,j,n,o,m,s,x=c.extend({},c.data(this,"events").live);if(!(a.button&&a.type==="click")){for(o in x){j=x[o];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f, 599 a.currentTarget);m=0;for(s=i.length;m<s;m++)for(o in x){j=x[o];n=i[m].elem;f=null;if(i[m].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==n)d.push({elem:n,fn:j})}}m=0;for(s=d.length;m<s;m++){i=d[m];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}}function oa(a,b){return"live."+(a?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function pa(a){return!a||!a.parentNode||a.parentNode.nodeType=== 600 11}function qa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ra(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0&&(c.support.checkClone||!sa.test(a[0]))){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r;f=b.createDocumentFragment(); 601 c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(ta.concat.apply([],ta.slice(0,b)),function(){d[this]=a});return d}function ua(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Na=z.jQuery,Oa=z.$,r=z.document,S,Pa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent, 602 va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]], 603 [f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a, 604 this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this, 605 a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice}; 606 c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];n=e[i];if(a!==n)if(f&&n&&(c.isPlainObject(n)||c.isArray(n))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(n)?[]:{};a[i]=c.extend(f,j,n)}else if(n!==v)a[i]=n}return a};c.extend({noConflict:function(a){z.$= 607 Oa;if(a)z.jQuery=Na;return c},isReady:false,ready:function(){if(!c.isReady){if(!r.body)return setTimeout(c.ready,13);c.isReady=true;if(P){for(var a,b=0;a=P[b++];)a.call(r,c);P=null}c.fn.triggerHandler&&c(r).triggerHandler("ready")}},bindReady:function(){if(!va){va=true;if(r.readyState==="complete")return c.ready();if(r.addEventListener){r.addEventListener("DOMContentLoaded",L,false);z.addEventListener("load",c.ready,false)}else if(r.attachEvent){r.attachEvent("onreadystatechange",L);z.attachEvent("onload", 608 c.ready);var a=false;try{a=z.frameElement==null}catch(b){}r.documentElement.doScroll&&a&&la()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===v||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false; 609 return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]|| 610 r.documentElement,d=r.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(r.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===v||c.isFunction(a);if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d= 611 a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Sa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!== 612 v;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=v}else if(b&&!c.isFunction(b)){d=b;b=v}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b}, 613 uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});O=c.uaMatch(O);if(O.browser){c.browser[O.browser]=true;c.browser.version=O.version}if(c.browser.webkit)c.browser.safari=true;if(wa)c.inArray=function(a,b){return wa.call(b,a)};S=c(r);if(r.addEventListener)L=function(){r.removeEventListener("DOMContentLoaded", 614 L,false);c.ready()};else if(r.attachEvent)L=function(){if(r.readyState==="complete"){r.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=r.documentElement,b=r.createElement("script"),d=r.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support= 615 {leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null}; 616 b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=r.createDocumentFragment();a.appendChild(d.firstChild); 617 c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props= 618 {"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true, 619 {},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this, 620 a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d); 621 return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]|| 622 a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m= 623 c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,n=b.length;j<n;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=c(this);m.removeClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(ca), 624 d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(ya," "),j=0,n=b.length;j<n;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),n=b,o= 625 a.split(ca);e=o[i++];){n=f?n:!j.hasClass(e);j[n?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ya," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value|| 626 {}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(za.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Wa,"")}return v}var n=c.isFunction(a);return this.each(function(o){var m=c(this),s=a;if(this.nodeType===1){if(n)s=a.call(this,o,m.val()); 627 if(typeof s==="number")s+="";if(c.isArray(s)&&za.test(this.type))this.checked=c.inArray(m.val(),s)>=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d); 628 f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText= 629 ""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j= 630 function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a, 631 d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+ 632 s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a, 633 "events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d, 634 b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b, 635 d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), 636 fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| 637 d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b= 638 0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true}; 639 c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b= 640 a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!== 641 "form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this, 642 "keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"|| 643 d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a= 644 a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this, 645 f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a, 646 b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+ 647 a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e){var i,j=0;if(c.isFunction(f)){e=f;f=v}for(d=(d||"").split(/\s+/);(i=d[j++])!=null;){i=i==="focus"?"focusin":i==="blur"?"focusout":i==="hover"?d.push("mouseleave")&&"mouseenter":i;b==="live"?c(this.context).bind(oa(i,this.selector),{data:f,selector:this.selector, 648 live:i},e):c(this.context).unbind(oa(i,this.selector),e?{guid:e.guid+this.selector+i}:null)}return this}});c.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".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});z.attachEvent&&!z.addEventListener&&z.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); 649 (function(){function a(g){for(var h="",k,l=0;g[l];l++){k=g[l];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===k){y=l[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=k;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}l[q]=y}}}function d(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache=== 650 k){y=l[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=k;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(o.filter(h,[t]).length>0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g|| 651 typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u= 652 l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&& 653 y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};o.matches=function(g,h){return o(g,null,null,h)};o.find=function(g,h,k){var l,q;if(!g)return[];for(var p=0,u=m.order.length;p<u;p++){var t=m.order[p];if(q=m.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");l=m.find[t](q, 654 h,k);if(l!=null){g=g.replace(m.match[t],"");break}}}}l||(l=h.getElementsByTagName("*"));return{set:l,expr:g}};o.filter=function(g,h,k,l){for(var q=g,p=[],u=h,t,y,R=h&&h[0]&&w(h[0]);g&&h.length;){for(var H in m.filter)if((t=m.leftMatch[H].exec(g))!=null&&t[2]){var M=m.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(u===p)p=[];if(m.preFilter[H])if(t=m.preFilter[H](t,u,k,p,l,R)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=u[U])!=null;U++)if(D){I=M(D,t,U,u);var Da= 655 l^!!I;if(k&&I!=null)if(Da)y=true;else u[U]=false;else if(Da){p.push(D);y=true}}if(I!==v){k||(u=p);g=g.replace(m.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)o.error(g);else break;q=g}return u};o.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var m=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, 656 TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var k=typeof h==="string",l=k&&!/\W/.test(h);k=k&&!l;if(l)h=h.toLowerCase();l=0;for(var q=g.length, 657 p;l<q;l++)if(p=g[l]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[l]=k||p&&p.nodeName.toLowerCase()===h?p||false:p===h}k&&o.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l<q;l++){var p=g[l];if(p){k=p.parentNode;g[l]=k.nodeName.toLowerCase()===h?k:false}}}else{l=0;for(q=g.length;l<q;l++)if(p=g[l])g[l]=k?p.parentNode:p.parentNode===h;k&&o.filter(h,g,true)}},"":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p= 658 h=h.toLowerCase();q=b}q("parentNode",h,l,g,p,k)},"~":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,l,g,p,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];h=h.getElementsByName(g[1]);for(var l=0,q=h.length;l<q;l++)h[l].getAttribute("name")===g[1]&&k.push(h[l]);return k.length===0?null:k}}, 659 TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,l,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var u;(u=h[p])!=null;p++)if(u)if(q^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&& 660 "2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true); 661 return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"=== 662 g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2=== 663 0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k<l;k++)if(h[k]===g)return false;return true}else o.error("Syntax error, unrecognized expression: "+ 664 q)},CHILD:function(g,h){var k=h[1],l=g;switch(k){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(k==="first")return true;l=g;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":k=h[2];var q=h[3];if(k===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var u=0;for(l=p.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++u;p.sizcache=h}g=g.nodeIndex-q;return k===0?g===0:g%k===0&&g/k>= 665 0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="? 666 k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g}; 667 try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k<l;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var C;if(r.documentElement.compareDocumentPosition)C=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g=== 668 h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in r.documentElement)C=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(r.createRange)C=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),l=h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);l.setStart(h,0);l.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END, 669 l);if(g===0)j=true;return g};(function(){var g=r.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id"); 670 return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href", 671 2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== 672 0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[], 673 l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)o(g,h[q],k);return o.filter(l,k)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.getText=a;c.isXMLDoc=w;c.contains=E})();var bb=/Until$/,cb=/^(?:parents|prevUntil|prevAll)/,db=/,/;Q=Array.prototype.slice;var Ea=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a, 674 function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Qa.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d= 675 0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ea(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e<n;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)> 676 -1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), 677 a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")}, 678 nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e): 679 e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!== 680 b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ia=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"], 681 col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)}, 682 wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length? 683 d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments, 684 false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& 685 !c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(Ha.exec(a)|| 686 ["",""])[1].toLowerCase()]){a=a.replace(Ga,Ia);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this, 687 b,f))});else a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(s){return c.nodeName(s,"table")?s.getElementsByTagName("tbody")[0]||s.appendChild(s.ownerDocument.createElement("tbody")):s}var e,i,j=a[0],n=[];if(!c.support.checkClone&&arguments.length===3&&typeof j=== 688 "string"&&sa.test(j))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(j))return this.each(function(s){var x=c(this);a[0]=j.call(this,s,b?x.html():v);x.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ra(a,this,n);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var o=0,m=this.length;o<m;o++)d.call(b?f(this[o],i):this[o],e.cacheable||this.length>1||o>0?e.fragment.cloneNode(true):e.fragment)}n&&c.each(n, 689 Ma)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){c.cleanData(this.getElementsByTagName("*"));c.cleanData([this])}this.parentNode&& 690 this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&c.cleanData(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||r;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||r;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j=== 691 "string"){j=j.replace(Ga,Ia);var n=(Ha.exec(j)||["",""])[1].toLowerCase(),o=F[n]||F._default,m=o[0];i=b.createElement("div");for(i.innerHTML=o[1]+j+o[2];m--;)i=i.lastChild;if(!c.support.tbody){m=fb.test(j);n=n==="table"&&!m?i.firstChild&&i.firstChild.childNodes:o[1]==="<table>"&&!m?i.childNodes:[];for(o=n.length-1;o>=0;--o)c.nodeName(n[o],"tbody")&&!n[o].childNodes.length&&n[o].parentNode.removeChild(n[o])}!c.support.leadingWhitespace&&V.test(j)&&i.insertBefore(b.createTextNode(V.exec(j)[0]),i.firstChild); 692 j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()==="text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e},cleanData:function(a){for(var b=0,d;(d=a[b])!=null;b++){c.event.remove(d);c.removeData(d)}}});var hb=/z-?index|font-?weight|opacity|zoom|line-?height/i, 693 Ja=/alpha\([^)]*\)/,Ka=/opacity=([^)]*)/,ga=/float/i,ha=/-([a-z])/ig,ib=/([A-Z])/g,jb=/^-?\d+(?:px)?$/i,kb=/^-?\d/,lb={position:"absolute",visibility:"hidden",display:"block"},mb=["Left","Right"],nb=["Top","Bottom"],ob=r.defaultView&&r.defaultView.getComputedStyle,La=c.support.cssFloat?"cssFloat":"styleFloat",ia=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===v)return c.curCSS(d,f);if(typeof e==="number"&&!hb.test(f))e+="px";c.style(d,f,e)})}; 694 c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(d)<0)d=v;var f=a.style||a,e=d!==v;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ja.test(a)?a.replace(Ja,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ka.exec(f.filter)[1])/100+"":""}if(ga.test(b))b=La;b=b.replace(ha,ia);if(e)f[b]=d;return f[b]},css:function(a, 695 b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?mb:nb;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,lb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&& 696 a.currentStyle){f=Ka.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ga.test(b))b=La;if(!d&&e&&e[b])f=e[b];else if(ob){if(ga.test(b))b="float";b=b.replace(ib,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ha,ia);f=a.currentStyle[b]||a.currentStyle[d];if(!jb.test(f)&&kb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left= 697 a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var pb= 698 J(),qb=/<script(.|\s)*?\/script>/gi,rb=/select|textarea/i,sb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ja=/\?/,tb=/(\?|&)_=.*?(&|$)/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b= 699 c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(j,n){if(n==="success"||n==="notmodified")i.html(e?c("<div />").append(j.responseText.replace(qb,"")).find(e):j.responseText);d&&i.each(d,[j.responseText,n,j])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&& 700 (this.checked||rb.test(this.nodeName)||sb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a, 701 b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:z.XMLHttpRequest&&(z.location.protocol!=="file:"||!z.ActiveXObject)?function(){return new z.XMLHttpRequest}: 702 function(){try{return new z.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(o,n,j,w);e.global&&f("ajaxSuccess",[w,e])}function d(){e.complete&&e.complete.call(o,w,j);e.global&&f("ajaxComplete",[w,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")} 703 function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,n,o=a&&a.context||e,m=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(m==="GET")N.test(e.url)||(e.url+=(ja.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)|| 704 N.test(e.url))){i=e.jsonpCallback||"jsonp"+pb++;if(e.data)e.data=(e.data+"").replace(N,"="+i+"$1");e.url=e.url.replace(N,"="+i+"$1");e.dataType="script";z[i]=z[i]||function(q){n=q;b();d();z[i]=v;try{delete z[i]}catch(p){}A&&A.removeChild(B)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&m==="GET"){var s=J(),x=e.url.replace(tb,"$1_="+s+"$2");e.url=x+(x===e.url?(ja.test(e.url)?"&":"?")+"_="+s:"")}if(e.data&&m==="GET")e.url+=(ja.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&& 705 c.event.trigger("ajaxStart");s=(s=ub.exec(e.url))&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType==="script"&&m==="GET"&&s){var A=r.getElementsByTagName("head")[0]||r.documentElement,B=r.createElement("script");B.src=e.url;if(e.scriptCharset)B.charset=e.scriptCharset;if(!i){var C=false;B.onload=B.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;b();d();B.onload=B.onreadystatechange=null;A&&B.parentNode&& 706 A.removeChild(B)}}}A.insertBefore(B,A.firstChild);return v}var E=false,w=e.xhr();if(w){e.username?w.open(m,e.url,e.async,e.username,e.password):w.open(m,e.url,e.async);try{if(e.data||a&&a.contentType)w.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&w.setRequestHeader("If-None-Match",c.etag[e.url])}s||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept", 707 e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(fa){}if(e.beforeSend&&e.beforeSend.call(o,w,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");w.abort();return false}e.global&&f("ajaxSend",[w,e]);var g=w.onreadystatechange=function(q){if(!w||w.readyState===0||q==="abort"){E||d();E=true;if(w)w.onreadystatechange=c.noop}else if(!E&&w&&(w.readyState===4||q==="timeout")){E=true;w.onreadystatechange=c.noop;j=q==="timeout"?"timeout":!c.httpSuccess(w)? 708 "error":e.ifModified&&c.httpNotModified(w,e.url)?"notmodified":"success";var p;if(j==="success")try{n=c.httpData(w,e.dataType,e)}catch(u){j="parsererror";p=u}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,w,j,p);d();q==="timeout"&&w.abort();if(e.async)w=null}};try{var h=w.abort;w.abort=function(){w&&h.call(w);g("abort")}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){w&&!E&&g("timeout")},e.timeout);try{w.send(m==="POST"||m==="PUT"||m==="DELETE"?e.data:null)}catch(l){c.handleError(e, 709 w,null,l);d()}e.async||g();return w}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]= 710 f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(j,n){if(c.isArray(n))c.each(n, 711 function(o,m){b?f(j,m):d(j+"["+(typeof m==="object"||c.isArray(m)?o:"")+"]",m)});else!b&&n!=null&&typeof n==="object"?c.each(n,function(o,m){d(j+"["+o+"]",m)}):f(j,n)}function f(j,n){n=c.isFunction(n)?n():n;e[e.length]=encodeURIComponent(j)+"="+encodeURIComponent(n)}var e=[];if(b===v)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var i in a)d(i,a[i]);return e.join("&").replace(vb,"+")}});var ka={},wb=/toggle|show|hide/,xb=/^([+-]=)?([\d+-.]+)(.*)$/, 712 W,ta=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(ka[d])f=ka[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove(); 713 ka[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&& 714 c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,n=this.nodeType===1&&c(this).is(":hidden"), 715 o=this;for(j in a){var m=j.replace(ha,ia);if(j!==m){a[m]=a[j];delete a[j];j=m}if(a[j]==="hide"&&n||a[j]==="show"&&!n)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(s,x){var A=new c.fx(o,i,s);if(wb.test(x))A[x==="toggle"?n?"show":"hide":x](a); 716 else{var B=xb.exec(x),C=A.cur(true)||0;if(B){x=parseFloat(B[2]);var E=B[3]||"px";if(E!=="px"){o.style[s]=(x||1)+E;C=(x||1)/A.cur(true)*C;o.style[s]=C+E}if(B[1])x=(B[1]==="-="?-1:1)*x+C;A.custom(C,x,E)}else A.custom(C,x,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle", 717 1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a, 718 b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]== 719 null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop=== 720 "width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow= 721 this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos= 722 c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!= 723 null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(), 724 f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f= 725 b,e=b.ownerDocument,i,j=e.documentElement,n=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,m=b.offsetLeft;(b=b.parentNode)&&b!==n&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;m-=b.scrollLeft;if(b===d){o+=b.offsetTop;m+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){o+=parseFloat(i.borderTopWidth)|| 726 0;m+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){o+=parseFloat(i.borderTopWidth)||0;m+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){o+=n.offsetTop;m+=n.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){o+=Math.max(j.scrollTop,n.scrollTop);m+=Math.max(j.scrollLeft,n.scrollLeft)}return{top:o,left:m}};c.offset={initialize:function(){var a=r.body,b=r.createElement("div"), 727 d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild); 728 d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop}, 729 bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left- 730 e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a= 731 this.offsetParent||r.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==v)return this.each(function(){if(i=ua(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=ua(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}}); 732 c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(i){var j=c(this);j[d](f.call(this,i,j[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]|| 733 e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===v?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});z.jQuery=z.$=c})(window); 734 /* 735 * Raphael 1.3.1 - JavaScript Vector Library 736 * 737 * Copyright (c) 2008 - 2009 Dmitry Baranovskiy (http://raphaeljs.com) 738 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. 739 */ 740 Raphael=(function(){var a=/[, ]+/,aO=/^(circle|rect|path|ellipse|text|image)$/,L=document,au=window,l={was:"Raphael" in au,is:au.Raphael},an=function(){if(an.is(arguments[0],"array")){var d=arguments[0],e=w[aW](an,d.splice(0,3+an.is(d[0],al))),S=e.set();for(var R=0,a0=d[m];R<a0;R++){var E=d[R]||{};aO.test(E.type)&&S[f](e[E.type]().attr(E));}return S;}return w[aW](an,arguments);},aT=function(){},aL="appendChild",aW="apply",aS="concat",at="",am=" ",z="split",F="click dblclick mousedown mousemove mouseout mouseover mouseup"[z](am),Q="hasOwnProperty",az="join",m="length",aY="prototype",aZ=String[aY].toLowerCase,ab=Math,g=ab.max,aI=ab.min,al="number",aA="toString",aw=Object[aY][aA],aQ={},aM=ab.pow,f="push",aU=/^(?=[\da-f]$)/,c=/^url\(['"]?([^\)]+)['"]?\)$/i,x=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,O=ab.round,v="setAttribute",W=parseFloat,G=parseInt,aN=String[aY].toUpperCase,j={"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},Z={along:"along","clip-rect":"csv",cx:al,cy:al,fill:"colour","fill-opacity":al,"font-size":al,height:al,opacity:al,path:"path",r:al,rotation:"csv",rx:al,ry:al,scale:"csv",stroke:"colour","stroke-opacity":al,"stroke-width":al,translation:"csv",width:al,x:al,y:al},aP="replace";an.version="1.3.1";an.type=(au.SVGAngle||L.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML");if(an.type=="VML"){var ag=document.createElement("div");ag.innerHTML="<!--[if vml]><br><br><![endif]-->";if(ag.childNodes[m]!=2){return null;}}an.svg=!(an.vml=an.type=="VML");aT[aY]=an[aY];an._id=0;an._oid=0;an.fn={};an.is=function(e,d){d=aZ.call(d);return((d=="object"||d=="undefined")&&typeof e==d)||(e==null&&d=="null")||aZ.call(aw.call(e).slice(8,-1))==d;};an.setWindow=function(d){au=d;L=au.document;};var aD=function(e){if(an.vml){var d=/^\s+|\s+$/g;aD=aj(function(R){var S;R=(R+at)[aP](d,at);try{var a0=new ActiveXObject("htmlfile");a0.write("<body>");a0.close();S=a0.body;}catch(a2){S=createPopup().document.body;}var i=S.createTextRange();try{S.style.color=R;var a1=i.queryCommandValue("ForeColor");a1=((a1&255)<<16)|(a1&65280)|((a1&16711680)>>>16);return"#"+("000000"+a1[aA](16)).slice(-6);}catch(a2){return"none";}});}else{var E=L.createElement("i");E.title="Rapha\xebl Colour Picker";E.style.display="none";L.body[aL](E);aD=aj(function(i){E.style.color=i;return L.defaultView.getComputedStyle(E,at).getPropertyValue("color");});}return aD(e);};an.hsb2rgb=aj(function(a3,a1,a7){if(an.is(a3,"object")&&"h" in a3&&"s" in a3&&"b" in a3){a7=a3.b;a1=a3.s;a3=a3.h;}var R,S,a8;if(a7==0){return{r:0,g:0,b:0,hex:"#000"};}if(a3>1||a1>1||a7>1){a3/=255;a1/=255;a7/=255;}var a0=~~(a3*6),a4=(a3*6)-a0,E=a7*(1-a1),e=a7*(1-(a1*a4)),a9=a7*(1-(a1*(1-a4)));R=[a7,e,E,E,a9,a7,a7][a0];S=[a9,a7,a7,e,E,E,a9][a0];a8=[E,E,a9,a7,a7,e,E][a0];R*=255;S*=255;a8*=255;var a5={r:R,g:S,b:a8},d=(~~R)[aA](16),a2=(~~S)[aA](16),a6=(~~a8)[aA](16);d=d[aP](aU,"0");a2=a2[aP](aU,"0");a6=a6[aP](aU,"0");a5.hex="#"+d+a2+a6;return a5;},an);an.rgb2hsb=aj(function(d,e,a1){if(an.is(d,"object")&&"r" in d&&"g" in d&&"b" in d){a1=d.b;e=d.g;d=d.r;}if(an.is(d,"string")){var a3=an.getRGB(d);d=a3.r;e=a3.g;a1=a3.b;}if(d>1||e>1||a1>1){d/=255;e/=255;a1/=255;}var a0=g(d,e,a1),i=aI(d,e,a1),R,E,S=a0;if(i==a0){return{h:0,s:0,b:a0};}else{var a2=(a0-i);E=a2/a0;if(d==a0){R=(e-a1)/a2;}else{if(e==a0){R=2+((a1-d)/a2);}else{R=4+((d-e)/a2);}}R/=6;R<0&&R++;R>1&&R--;}return{h:R,s:E,b:S};},an);var aE=/,?([achlmqrstvxz]),?/gi;an._path2string=function(){return this.join(",")[aP](aE,"$1");};function aj(E,e,d){function i(){var R=Array[aY].slice.call(arguments,0),a0=R[az]("\u25ba"),S=i.cache=i.cache||{},a1=i.count=i.count||[];if(S[Q](a0)){return d?d(S[a0]):S[a0];}a1[m]>=1000&&delete S[a1.shift()];a1[f](a0);S[a0]=E[aW](e,R);return d?d(S[a0]):S[a0];}return i;}an.getRGB=aj(function(d){if(!d||!!((d=d+at).indexOf("-")+1)){return{r:-1,g:-1,b:-1,hex:"none",error:1};}if(d=="none"){return{r:-1,g:-1,b:-1,hex:"none"};}!(({hs:1,rg:1})[Q](d.substring(0,2))||d.charAt()=="#")&&(d=aD(d));var S,i,E,a2,a3,a0=d.match(x);if(a0){if(a0[2]){a2=G(a0[2].substring(5),16);E=G(a0[2].substring(3,5),16);i=G(a0[2].substring(1,3),16);}if(a0[3]){a2=G((a3=a0[3].charAt(3))+a3,16);E=G((a3=a0[3].charAt(2))+a3,16);i=G((a3=a0[3].charAt(1))+a3,16);}if(a0[4]){a0=a0[4][z](/\s*,\s*/);i=W(a0[0]);E=W(a0[1]);a2=W(a0[2]);}if(a0[5]){a0=a0[5][z](/\s*,\s*/);i=W(a0[0])*2.55;E=W(a0[1])*2.55;a2=W(a0[2])*2.55;}if(a0[6]){a0=a0[6][z](/\s*,\s*/);i=W(a0[0]);E=W(a0[1]);a2=W(a0[2]);return an.hsb2rgb(i,E,a2);}if(a0[7]){a0=a0[7][z](/\s*,\s*/);i=W(a0[0])*2.55;E=W(a0[1])*2.55;a2=W(a0[2])*2.55;return an.hsb2rgb(i,E,a2);}a0={r:i,g:E,b:a2};var e=(~~i)[aA](16),R=(~~E)[aA](16),a1=(~~a2)[aA](16);e=e[aP](aU,"0");R=R[aP](aU,"0");a1=a1[aP](aU,"0");a0.hex="#"+e+R+a1;return a0;}return{r:-1,g:-1,b:-1,hex:"none",error:1};},an);an.getColor=function(e){var i=this.getColor.start=this.getColor.start||{h:0,s:1,b:e||0.75},d=this.hsb2rgb(i.h,i.s,i.b);i.h+=0.075;if(i.h>1){i.h=0;i.s-=0.2;i.s<=0&&(this.getColor.start={h:0,s:1,b:i.b});}return d.hex;};an.getColor.reset=function(){delete this.start;};an.parsePathString=aj(function(d){if(!d){return null;}var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},e=[];if(an.is(d,"array")&&an.is(d[0],"array")){e=av(d);}if(!e[m]){(d+at)[aP](/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(R,E,a1){var a0=[],S=aZ.call(E);a1[aP](/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(a3,a2){a2&&a0[f](+a2);});while(a0[m]>=i[S]){e[f]([E][aS](a0.splice(0,i[S])));if(!i[S]){break;}}});}e[aA]=an._path2string;return e;});an.findDotsAtSegment=function(e,d,be,bc,a0,R,a2,a1,a8){var a6=1-a8,a5=aM(a6,3)*e+aM(a6,2)*3*a8*be+a6*3*a8*a8*a0+aM(a8,3)*a2,a3=aM(a6,3)*d+aM(a6,2)*3*a8*bc+a6*3*a8*a8*R+aM(a8,3)*a1,ba=e+2*a8*(be-e)+a8*a8*(a0-2*be+e),a9=d+2*a8*(bc-d)+a8*a8*(R-2*bc+d),bd=be+2*a8*(a0-be)+a8*a8*(a2-2*a0+be),bb=bc+2*a8*(R-bc)+a8*a8*(a1-2*R+bc),a7=(1-a8)*e+a8*be,a4=(1-a8)*d+a8*bc,E=(1-a8)*a0+a8*a2,i=(1-a8)*R+a8*a1,S=(90-ab.atan((ba-bd)/(a9-bb))*180/ab.PI);(ba>bd||a9<bb)&&(S+=180);return{x:a5,y:a3,m:{x:ba,y:a9},n:{x:bd,y:bb},start:{x:a7,y:a4},end:{x:E,y:i},alpha:S};};var U=aj(function(a5){if(!a5){return{x:0,y:0,width:0,height:0};}a5=H(a5);var a2=0,a1=0,R=[],e=[],E;for(var S=0,a4=a5[m];S<a4;S++){E=a5[S];if(E[0]=="M"){a2=E[1];a1=E[2];R[f](a2);e[f](a1);}else{var a0=aC(a2,a1,E[1],E[2],E[3],E[4],E[5],E[6]);R=R[aS](a0.min.x,a0.max.x);e=e[aS](a0.min.y,a0.max.y);a2=E[5];a1=E[6];}}var d=aI[aW](0,R),a3=aI[aW](0,e);return{x:d,y:a3,width:g[aW](0,R)-d,height:g[aW](0,e)-a3};}),av=function(a0){var E=[];if(!an.is(a0,"array")||!an.is(a0&&a0[0],"array")){a0=an.parsePathString(a0);}for(var e=0,R=a0[m];e<R;e++){E[e]=[];for(var d=0,S=a0[e][m];d<S;d++){E[e][d]=a0[e][d];}}E[aA]=an._path2string;return E;},ad=aj(function(R){if(!an.is(R,"array")||!an.is(R&&R[0],"array")){R=an.parsePathString(R);}var a4=[],a6=0,a5=0,a9=0,a8=0,E=0;if(R[0][0]=="M"){a6=R[0][1];a5=R[0][2];a9=a6;a8=a5;E++;a4[f](["M",a6,a5]);}for(var a1=E,ba=R[m];a1<ba;a1++){var d=a4[a1]=[],a7=R[a1];if(a7[0]!=aZ.call(a7[0])){d[0]=aZ.call(a7[0]);switch(d[0]){case"a":d[1]=a7[1];d[2]=a7[2];d[3]=a7[3];d[4]=a7[4];d[5]=a7[5];d[6]=+(a7[6]-a6).toFixed(3);d[7]=+(a7[7]-a5).toFixed(3);break;case"v":d[1]=+(a7[1]-a5).toFixed(3);break;case"m":a9=a7[1];a8=a7[2];default:for(var a0=1,a2=a7[m];a0<a2;a0++){d[a0]=+(a7[a0]-((a0%2)?a6:a5)).toFixed(3);}}}else{d=a4[a1]=[];if(a7[0]=="m"){a9=a7[1]+a6;a8=a7[2]+a5;}for(var S=0,e=a7[m];S<e;S++){a4[a1][S]=a7[S];}}var a3=a4[a1][m];switch(a4[a1][0]){case"z":a6=a9;a5=a8;break;case"h":a6+=+a4[a1][a3-1];break;case"v":a5+=+a4[a1][a3-1];break;default:a6+=+a4[a1][a3-2];a5+=+a4[a1][a3-1];}}a4[aA]=an._path2string;return a4;},0,av),r=aj(function(R){if(!an.is(R,"array")||!an.is(R&&R[0],"array")){R=an.parsePathString(R);}var a3=[],a5=0,a4=0,a8=0,a7=0,E=0;if(R[0][0]=="M"){a5=+R[0][1];a4=+R[0][2];a8=a5;a7=a4;E++;a3[0]=["M",a5,a4];}for(var a1=E,a9=R[m];a1<a9;a1++){var d=a3[a1]=[],a6=R[a1];if(a6[0]!=aN.call(a6[0])){d[0]=aN.call(a6[0]);switch(d[0]){case"A":d[1]=a6[1];d[2]=a6[2];d[3]=a6[3];d[4]=a6[4];d[5]=a6[5];d[6]=+(a6[6]+a5);d[7]=+(a6[7]+a4);break;case"V":d[1]=+a6[1]+a4;break;case"H":d[1]=+a6[1]+a5;break;case"M":a8=+a6[1]+a5;a7=+a6[2]+a4;default:for(var a0=1,a2=a6[m];a0<a2;a0++){d[a0]=+a6[a0]+((a0%2)?a5:a4);}}}else{for(var S=0,e=a6[m];S<e;S++){a3[a1][S]=a6[S];}}switch(d[0]){case"Z":a5=a8;a4=a7;break;case"H":a5=d[1];break;case"V":a4=d[1];break;default:a5=a3[a1][a3[a1][m]-2];a4=a3[a1][a3[a1][m]-1];}}a3[aA]=an._path2string;return a3;},null,av),aX=function(e,E,d,i){return[e,E,d,i,d,i];},aK=function(e,E,a0,R,d,i){var S=1/3,a1=2/3;return[S*e+a1*a0,S*E+a1*R,S*d+a1*a0,S*i+a1*R,d,i];},K=function(a9,bE,bi,bg,ba,a4,S,a8,bD,bb){var R=ab.PI,bf=R*120/180,d=R/180*(+ba||0),bm=[],bj,bA=aj(function(bF,bI,i){var bH=bF*ab.cos(i)-bI*ab.sin(i),bG=bF*ab.sin(i)+bI*ab.cos(i);return{x:bH,y:bG};});if(!bb){bj=bA(a9,bE,-d);a9=bj.x;bE=bj.y;bj=bA(a8,bD,-d);a8=bj.x;bD=bj.y;var e=ab.cos(R/180*ba),a6=ab.sin(R/180*ba),bo=(a9-a8)/2,bn=(bE-bD)/2;bi=g(bi,ab.abs(bo));bg=g(bg,ab.abs(bn));var by=(bo*bo)/(bi*bi)+(bn*bn)/(bg*bg);if(by>1){bi=ab.sqrt(by)*bi;bg=ab.sqrt(by)*bg;}var E=bi*bi,br=bg*bg,bt=(a4==S?-1:1)*ab.sqrt(ab.abs((E*br-E*bn*bn-br*bo*bo)/(E*bn*bn+br*bo*bo))),bd=bt*bi*bn/bg+(a9+a8)/2,bc=bt*-bg*bo/bi+(bE+bD)/2,a3=ab.asin(((bE-bc)/bg).toFixed(7)),a2=ab.asin(((bD-bc)/bg).toFixed(7));a3=a9<bd?R-a3:a3;a2=a8<bd?R-a2:a2;a3<0&&(a3=R*2+a3);a2<0&&(a2=R*2+a2);if(S&&a3>a2){a3=a3-R*2;}if(!S&&a2>a3){a2=a2-R*2;}}else{a3=bb[0];a2=bb[1];bd=bb[2];bc=bb[3];}var a7=a2-a3;if(ab.abs(a7)>bf){var be=a2,bh=a8,a5=bD;a2=a3+bf*(S&&a2>a3?1:-1);a8=bd+bi*ab.cos(a2);bD=bc+bg*ab.sin(a2);bm=K(a8,bD,bi,bg,ba,0,S,bh,a5,[a2,be,bd,bc]);}a7=a2-a3;var a1=ab.cos(a3),bC=ab.sin(a3),a0=ab.cos(a2),bB=ab.sin(a2),bp=ab.tan(a7/4),bs=4/3*bi*bp,bq=4/3*bg*bp,bz=[a9,bE],bx=[a9+bs*bC,bE-bq*a1],bw=[a8+bs*bB,bD-bq*a0],bu=[a8,bD];bx[0]=2*bz[0]-bx[0];bx[1]=2*bz[1]-bx[1];if(bb){return[bx,bw,bu][aS](bm);}else{bm=[bx,bw,bu][aS](bm)[az]()[z](",");var bk=[];for(var bv=0,bl=bm[m];bv<bl;bv++){bk[bv]=bv%2?bA(bm[bv-1],bm[bv],d).y:bA(bm[bv],bm[bv+1],d).x;}return bk;}},M=function(e,d,E,i,a2,a1,a0,S,a3){var R=1-a3;return{x:aM(R,3)*e+aM(R,2)*3*a3*E+R*3*a3*a3*a2+aM(a3,3)*a0,y:aM(R,3)*d+aM(R,2)*3*a3*i+R*3*a3*a3*a1+aM(a3,3)*S};},aC=aj(function(i,d,R,E,a9,a8,a5,a2){var a7=(a9-2*R+i)-(a5-2*a9+R),a4=2*(R-i)-2*(a9-R),a1=i-R,a0=(-a4+ab.sqrt(a4*a4-4*a7*a1))/2/a7,S=(-a4-ab.sqrt(a4*a4-4*a7*a1))/2/a7,a3=[d,a2],a6=[i,a5],e;ab.abs(a0)>1000000000000&&(a0=0.5);ab.abs(S)>1000000000000&&(S=0.5);if(a0>0&&a0<1){e=M(i,d,R,E,a9,a8,a5,a2,a0);a6[f](e.x);a3[f](e.y);}if(S>0&&S<1){e=M(i,d,R,E,a9,a8,a5,a2,S);a6[f](e.x);a3[f](e.y);}a7=(a8-2*E+d)-(a2-2*a8+E);a4=2*(E-d)-2*(a8-E);a1=d-E;a0=(-a4+ab.sqrt(a4*a4-4*a7*a1))/2/a7;S=(-a4-ab.sqrt(a4*a4-4*a7*a1))/2/a7;ab.abs(a0)>1000000000000&&(a0=0.5);ab.abs(S)>1000000000000&&(S=0.5);if(a0>0&&a0<1){e=M(i,d,R,E,a9,a8,a5,a2,a0);a6[f](e.x);a3[f](e.y);}if(S>0&&S<1){e=M(i,d,R,E,a9,a8,a5,a2,S);a6[f](e.x);a3[f](e.y);}return{min:{x:aI[aW](0,a6),y:aI[aW](0,a3)},max:{x:g[aW](0,a6),y:g[aW](0,a3)}};}),H=aj(function(a9,a4){var R=r(a9),a5=a4&&r(a4),a6={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},d={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a0=function(ba,bb){var i,bc;if(!ba){return["C",bb.x,bb.y,bb.x,bb.y,bb.x,bb.y];}!(ba[0] in {T:1,Q:1})&&(bb.qx=bb.qy=null);switch(ba[0]){case"M":bb.X=ba[1];bb.Y=ba[2];break;case"A":ba=["C"][aS](K[aW](0,[bb.x,bb.y][aS](ba.slice(1))));break;case"S":i=bb.x+(bb.x-(bb.bx||bb.x));bc=bb.y+(bb.y-(bb.by||bb.y));ba=["C",i,bc][aS](ba.slice(1));break;case"T":bb.qx=bb.x+(bb.x-(bb.qx||bb.x));bb.qy=bb.y+(bb.y-(bb.qy||bb.y));ba=["C"][aS](aK(bb.x,bb.y,bb.qx,bb.qy,ba[1],ba[2]));break;case"Q":bb.qx=ba[1];bb.qy=ba[2];ba=["C"][aS](aK(bb.x,bb.y,ba[1],ba[2],ba[3],ba[4]));break;case"L":ba=["C"][aS](aX(bb.x,bb.y,ba[1],ba[2]));break;case"H":ba=["C"][aS](aX(bb.x,bb.y,ba[1],bb.y));break;case"V":ba=["C"][aS](aX(bb.x,bb.y,bb.x,ba[1]));break;case"Z":ba=["C"][aS](aX(bb.x,bb.y,bb.X,bb.Y));break;}return ba;},e=function(ba,bb){if(ba[bb][m]>7){ba[bb].shift();var bc=ba[bb];while(bc[m]){ba.splice(bb++,0,["C"][aS](bc.splice(0,6)));}ba.splice(bb,1);a7=g(R[m],a5&&a5[m]||0);}},E=function(be,bd,bb,ba,bc){if(be&&bd&&be[bc][0]=="M"&&bd[bc][0]!="M"){bd.splice(bc,0,["M",ba.x,ba.y]);bb.bx=0;bb.by=0;bb.x=be[bc][1];bb.y=be[bc][2];a7=g(R[m],a5&&a5[m]||0);}};for(var a2=0,a7=g(R[m],a5&&a5[m]||0);a2<a7;a2++){R[a2]=a0(R[a2],a6);e(R,a2);a5&&(a5[a2]=a0(a5[a2],d));a5&&e(a5,a2);E(R,a5,a6,d,a2);E(a5,R,d,a6,a2);var a1=R[a2],a8=a5&&a5[a2],S=a1[m],a3=a5&&a8[m];a6.x=a1[S-2];a6.y=a1[S-1];a6.bx=W(a1[S-4])||a6.x;a6.by=W(a1[S-3])||a6.y;d.bx=a5&&(W(a8[a3-4])||d.x);d.by=a5&&(W(a8[a3-3])||d.y);d.x=a5&&a8[a3-2];d.y=a5&&a8[a3-1];}return a5?[R,a5]:R;},null,av),p=aj(function(a4){var a3=[];for(var a0=0,a5=a4[m];a0<a5;a0++){var e={},a2=a4[a0].match(/^([^:]*):?([\d\.]*)/);e.color=an.getRGB(a2[1]);if(e.color.error){return null;}e.color=e.color.hex;a2[2]&&(e.offset=a2[2]+"%");a3[f](e);}for(var a0=1,a5=a3[m]-1;a0<a5;a0++){if(!a3[a0].offset){var E=W(a3[a0-1].offset||0),R=0;for(var S=a0+1;S<a5;S++){if(a3[S].offset){R=a3[S].offset;break;}}if(!R){R=100;S=a5;}R=W(R);var a1=(R-E)/(S-a0+1);for(;a0<S;a0++){E+=a1;a3[a0].offset=E+"%";}}}return a3;}),ao=function(){var i,e,R,E,d;if(an.is(arguments[0],"string")||an.is(arguments[0],"object")){if(an.is(arguments[0],"string")){i=L.getElementById(arguments[0]);}else{i=arguments[0];}if(i.tagName){if(arguments[1]==null){return{container:i,width:i.style.pixelWidth||i.offsetWidth,height:i.style.pixelHeight||i.offsetHeight};}else{return{container:i,width:arguments[1],height:arguments[2]};}}}else{if(an.is(arguments[0],al)&&arguments[m]>3){return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]};}}},aG=function(d,i){var e=this;for(var E in i){if(i[Q](E)&&!(E in d)){switch(typeof i[E]){case"function":(function(R){d[E]=d===e?R:function(){return R[aW](e,arguments);};})(i[E]);break;case"object":d[E]=d[E]||{};aG.call(this,d[E],i[E]);break;default:d[E]=i[E];break;}}}},ak=function(d,e){d==e.top&&(e.top=d.prev);d==e.bottom&&(e.bottom=d.next);d.next&&(d.next.prev=d.prev);d.prev&&(d.prev.next=d.next);},Y=function(d,e){if(e.top===d){return;}ak(d,e);d.next=null;d.prev=e.top;e.top.next=d;e.top=d;},k=function(d,e){if(e.bottom===d){return;}ak(d,e);d.next=e.bottom;d.prev=null;e.bottom.prev=d;e.bottom=d;},A=function(e,d,i){ak(e,i);d==i.top&&(i.top=e);d.next&&(d.next.prev=e);e.next=d.next;e.prev=d;d.next=e;},aq=function(e,d,i){ak(e,i);d==i.bottom&&(i.bottom=e);d.prev&&(d.prev.next=e);e.prev=d.prev;d.prev=e;e.next=d;},s=function(d){return function(){throw new Error("Rapha\xebl: you are calling to method \u201c"+d+"\u201d of removed object");};},ar=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(an.svg){aT[aY].svgns="http://www.w3.org/2000/svg";aT[aY].xlink="http://www.w3.org/1999/xlink";var O=function(d){return +d+(~~d===d)*0.5;},V=function(S){for(var e=0,E=S[m];e<E;e++){if(aZ.call(S[e][0])!="a"){for(var d=1,R=S[e][m];d<R;d++){S[e][d]=O(S[e][d]);}}else{S[e][6]=O(S[e][6]);S[e][7]=O(S[e][7]);}}return S;},aJ=function(i,d){if(d){for(var e in d){if(d[Q](e)){i[v](e,d[e]);}}}else{return L.createElementNS(aT[aY].svgns,i);}};an[aA]=function(){return"Your browser supports SVG.\nYou are running Rapha\xebl "+this.version;};var q=function(d,E){var e=aJ("path");E.canvas&&E.canvas[aL](e);var i=new ax(e,E);i.type="path";aa(i,{fill:"none",stroke:"#000",path:d});return i;};var b=function(E,a7,d){var a4="linear",a1=0.5,S=0.5,a9=E.style;a7=(a7+at)[aP](ar,function(bb,i,bc){a4="radial";if(i&&bc){a1=W(i);S=W(bc);var ba=((S>0.5)*2-1);aM(a1-0.5,2)+aM(S-0.5,2)>0.25&&(S=ab.sqrt(0.25-aM(a1-0.5,2))*ba+0.5)&&S!=0.5&&(S=S.toFixed(5)-0.00001*ba);}return at;});a7=a7[z](/\s*\-\s*/);if(a4=="linear"){var a0=a7.shift();a0=-W(a0);if(isNaN(a0)){return null;}var R=[0,0,ab.cos(a0*ab.PI/180),ab.sin(a0*ab.PI/180)],a6=1/(g(ab.abs(R[2]),ab.abs(R[3]))||1);R[2]*=a6;R[3]*=a6;if(R[2]<0){R[0]=-R[2];R[2]=0;}if(R[3]<0){R[1]=-R[3];R[3]=0;}}var a3=p(a7);if(!a3){return null;}var e=aJ(a4+"Gradient");e.id="r"+(an._id++)[aA](36);aJ(e,a4=="radial"?{fx:a1,fy:S}:{x1:R[0],y1:R[1],x2:R[2],y2:R[3]});d.defs[aL](e);for(var a2=0,a8=a3[m];a2<a8;a2++){var a5=aJ("stop");aJ(a5,{offset:a3[a2].offset?a3[a2].offset:!a2?"0%":"100%","stop-color":a3[a2].color||"#fff"});e[aL](a5);}aJ(E,{fill:"url(#"+e.id+")",opacity:1,"fill-opacity":1});a9.fill=at;a9.opacity=1;a9.fillOpacity=1;return 1;};var N=function(e){var d=e.getBBox();aJ(e.pattern,{patternTransform:an.format("translate({0},{1})",d.x,d.y)});};var aa=function(a6,bf){var a9={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},bb=a6.node,a7=a6.attrs,a3=a6.rotate(),S=function(bm,bl){bl=a9[aZ.call(bl)];if(bl){var bj=bm.attrs["stroke-width"]||"1",bh={round:bj,square:bj,butt:0}[bm.attrs["stroke-linecap"]||bf["stroke-linecap"]]||0,bk=[];var bi=bl[m];while(bi--){bk[bi]=bl[bi]*bj+((bi%2)?1:-1)*bh;}aJ(bb,{"stroke-dasharray":bk[az](",")});}};bf[Q]("rotation")&&(a3=bf.rotation);var a2=(a3+at)[z](a);if(!(a2.length-1)){a2=null;}else{a2[1]=+a2[1];a2[2]=+a2[2];}W(a3)&&a6.rotate(0,true);for(var ba in bf){if(bf[Q](ba)){if(!j[Q](ba)){continue;}var a8=bf[ba];a7[ba]=a8;switch(ba){case"rotation":a6.rotate(a8,true);break;case"href":case"title":case"target":var bd=bb.parentNode;if(aZ.call(bd.tagName)!="a"){var E=aJ("a");bd.insertBefore(E,bb);E[aL](bb);bd=E;}bd.setAttributeNS(a6.paper.xlink,ba,a8);break;case"cursor":bb.style.cursor=a8;break;case"clip-rect":var e=(a8+at)[z](a);if(e[m]==4){a6.clip&&a6.clip.parentNode.parentNode.removeChild(a6.clip.parentNode);var i=aJ("clipPath"),bc=aJ("rect");i.id="r"+(an._id++)[aA](36);aJ(bc,{x:e[0],y:e[1],width:e[2],height:e[3]});i[aL](bc);a6.paper.defs[aL](i);aJ(bb,{"clip-path":"url(#"+i.id+")"});a6.clip=bc;}if(!a8){var be=L.getElementById(bb.getAttribute("clip-path")[aP](/(^url\(#|\)$)/g,at));be&&be.parentNode.removeChild(be);aJ(bb,{"clip-path":at});delete a6.clip;}break;case"path":if(a8&&a6.type=="path"){a7.path=V(r(a8));aJ(bb,{d:a7.path});}break;case"width":bb[v](ba,a8);if(a7.fx){ba="x";a8=a7.x;}else{break;}case"x":if(a7.fx){a8=-a7.x-(a7.width||0);}case"rx":if(ba=="rx"&&a6.type=="rect"){break;}case"cx":a2&&(ba=="x"||ba=="cx")&&(a2[1]+=a8-a7[ba]);bb[v](ba,O(a8));a6.pattern&&N(a6);break;case"height":bb[v](ba,a8);if(a7.fy){ba="y";a8=a7.y;}else{break;}case"y":if(a7.fy){a8=-a7.y-(a7.height||0);}case"ry":if(ba=="ry"&&a6.type=="rect"){break;}case"cy":a2&&(ba=="y"||ba=="cy")&&(a2[2]+=a8-a7[ba]);bb[v](ba,O(a8));a6.pattern&&N(a6);break;case"r":if(a6.type=="rect"){aJ(bb,{rx:a8,ry:a8});}else{bb[v](ba,a8);}break;case"src":if(a6.type=="image"){bb.setAttributeNS(a6.paper.xlink,"href",a8);}break;case"stroke-width":bb.style.strokeWidth=a8;bb[v](ba,a8);if(a7["stroke-dasharray"]){S(a6,a7["stroke-dasharray"]);}break;case"stroke-dasharray":S(a6,a8);break;case"translation":var a0=(a8+at)[z](a);a0[0]=+a0[0]||0;a0[1]=+a0[1]||0;if(a2){a2[1]+=a0[0];a2[2]+=a0[1];}t.call(a6,a0[0],a0[1]);break;case"scale":var a0=(a8+at)[z](a);a6.scale(+a0[0]||1,+a0[1]||+a0[0]||1,+a0[2]||null,+a0[3]||null);break;case"fill":var R=(a8+at).match(c);if(R){var i=aJ("pattern"),a5=aJ("image");i.id="r"+(an._id++)[aA](36);aJ(i,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});aJ(a5,{x:0,y:0});a5.setAttributeNS(a6.paper.xlink,"href",R[1]);i[aL](a5);var bg=L.createElement("img");bg.style.cssText="position:absolute;left:-9999em;top-9999em";bg.onload=function(){aJ(i,{width:this.offsetWidth,height:this.offsetHeight});aJ(a5,{width:this.offsetWidth,height:this.offsetHeight});L.body.removeChild(this);a6.paper.safari();};L.body[aL](bg);bg.src=R[1];a6.paper.defs[aL](i);bb.style.fill="url(#"+i.id+")";aJ(bb,{fill:"url(#"+i.id+")"});a6.pattern=i;a6.pattern&&N(a6);break;}if(!an.getRGB(a8).error){delete bf.gradient;delete a7.gradient;!an.is(a7.opacity,"undefined")&&an.is(bf.opacity,"undefined")&&aJ(bb,{opacity:a7.opacity});!an.is(a7["fill-opacity"],"undefined")&&an.is(bf["fill-opacity"],"undefined")&&aJ(bb,{"fill-opacity":a7["fill-opacity"]});}else{if((({circle:1,ellipse:1})[Q](a6.type)||(a8+at).charAt()!="r")&&b(bb,a8,a6.paper)){a7.gradient=a8;a7.fill="none";break;}}case"stroke":bb[v](ba,an.getRGB(a8).hex);break;case"gradient":(({circle:1,ellipse:1})[Q](a6.type)||(a8+at).charAt()!="r")&&b(bb,a8,a6.paper);break;case"opacity":case"fill-opacity":if(a7.gradient){var d=L.getElementById(bb.getAttribute("fill")[aP](/^url\(#|\)$/g,at));if(d){var a1=d.getElementsByTagName("stop");a1[a1[m]-1][v]("stop-opacity",a8);}break;}default:ba=="font-size"&&(a8=G(a8,10)+"px");var a4=ba[aP](/(\-.)/g,function(bh){return aN.call(bh.substring(1));});bb.style[a4]=a8;bb[v](ba,a8);break;}}}D(a6,bf);if(a2){a6.rotate(a2.join(am));}else{W(a3)&&a6.rotate(a3,true);}};var h=1.2;var D=function(d,R){if(d.type!="text"||!(R[Q]("text")||R[Q]("font")||R[Q]("font-size")||R[Q]("x")||R[Q]("y"))){return;}var a3=d.attrs,e=d.node,a5=e.firstChild?G(L.defaultView.getComputedStyle(e.firstChild,at).getPropertyValue("font-size"),10):10;if(R[Q]("text")){a3.text=R.text;while(e.firstChild){e.removeChild(e.firstChild);}var E=(R.text+at)[z]("\n");for(var S=0,a4=E[m];S<a4;S++){if(E[S]){var a1=aJ("tspan");S&&aJ(a1,{dy:a5*h,x:a3.x});a1[aL](L.createTextNode(E[S]));e[aL](a1);}}}else{var E=e.getElementsByTagName("tspan");for(var S=0,a4=E[m];S<a4;S++){S&&aJ(E[S],{dy:a5*h,x:a3.x});}}aJ(e,{y:a3.y});var a0=d.getBBox(),a2=a3.y-(a0.y+a0.height/2);a2&&isFinite(a2)&&aJ(e,{y:a3.y+a2});};var ax=function(e,d){var E=0,i=0;this[0]=e;this.id=an._oid++;this.node=e;e.raphael=this;this.paper=d;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!d.bottom&&(d.bottom=this);this.prev=d.top;d.top&&(d.top.next=this);d.top=this;this.next=null;};ax[aY].rotate=function(e,d,E){if(this.removed){return this;}if(e==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][az](am);}return this._.rt.deg;}var i=this.getBBox();e=(e+at)[z](a);if(e[m]-1){d=W(e[1]);E=W(e[2]);}e=W(e[0]);if(d!=null){this._.rt.deg=e;}else{this._.rt.deg+=e;}(E==null)&&(d=null);this._.rt.cx=d;this._.rt.cy=E;d=d==null?i.x+i.width/2:d;E=E==null?i.y+i.height/2:E;if(this._.rt.deg){this.transformations[0]=an.format("rotate({0} {1} {2})",this._.rt.deg,d,E);this.clip&&aJ(this.clip,{transform:an.format("rotate({0} {1} {2})",-this._.rt.deg,d,E)});}else{this.transformations[0]=at;this.clip&&aJ(this.clip,{transform:at});}aJ(this.node,{transform:this.transformations[az](am)});return this;};ax[aY].hide=function(){!this.removed&&(this.node.style.display="none");return this;};ax[aY].show=function(){!this.removed&&(this.node.style.display="");return this;};ax[aY].remove=function(){if(this.removed){return;}ak(this,this.paper);this.node.parentNode.removeChild(this.node);for(var d in this){delete this[d];}this.removed=true;};ax[aY].getBBox=function(){if(this.removed){return this;}if(this.type=="path"){return U(this.attrs.path);}if(this.node.style.display=="none"){this.show();var E=true;}var a1={};try{a1=this.node.getBBox();}catch(S){}finally{a1=a1||{};}if(this.type=="text"){a1={x:a1.x,y:Infinity,width:0,height:0};for(var d=0,R=this.node.getNumberOfChars();d<R;d++){var a0=this.node.getExtentOfChar(d);(a0.y<a1.y)&&(a1.y=a0.y);(a0.y+a0.height-a1.y>a1.height)&&(a1.height=a0.y+a0.height-a1.y);(a0.x+a0.width-a1.x>a1.width)&&(a1.width=a0.x+a0.width-a1.x);}}E&&this.hide();return a1;};ax[aY].attr=function(){if(this.removed){return this;}if(arguments[m]==0){var R={};for(var E in this.attrs){if(this.attrs[Q](E)){R[E]=this.attrs[E];}}this._.rt.deg&&(R.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(R.scale=this.scale());R.gradient&&R.fill=="none"&&(R.fill=R.gradient)&&delete R.gradient;return R;}if(arguments[m]==1&&an.is(arguments[0],"string")){if(arguments[0]=="translation"){return t.call(this);}if(arguments[0]=="rotation"){return this.rotate();}if(arguments[0]=="scale"){return this.scale();}if(arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient;}return this.attrs[arguments[0]];}if(arguments[m]==1&&an.is(arguments[0],"array")){var d={};for(var e in arguments[0]){if(arguments[0][Q](e)){d[arguments[0][e]]=this.attrs[arguments[0][e]];}}return d;}if(arguments[m]==2){var S={};S[arguments[0]]=arguments[1];aa(this,S);}else{if(arguments[m]==1&&an.is(arguments[0],"object")){aa(this,arguments[0]);}}return this;};ax[aY].toFront=function(){if(this.removed){return this;}this.node.parentNode[aL](this.node);var d=this.paper;d.top!=this&&Y(this,d);return this;};ax[aY].toBack=function(){if(this.removed){return this;}if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);k(this,this.paper);var d=this.paper;}return this;};ax[aY].insertAfter=function(d){if(this.removed){return this;}var e=d.node;if(e.nextSibling){e.parentNode.insertBefore(this.node,e.nextSibling);}else{e.parentNode[aL](this.node);}A(this,d,this.paper);return this;};ax[aY].insertBefore=function(d){if(this.removed){return this;}var e=d.node;e.parentNode.insertBefore(this.node,e);aq(this,d,this.paper);return this;};var P=function(e,d,S,R){d=O(d);S=O(S);var E=aJ("circle");e.canvas&&e.canvas[aL](E);var i=new ax(E,e);i.attrs={cx:d,cy:S,r:R,fill:"none",stroke:"#000"};i.type="circle";aJ(E,i.attrs);return i;};var aF=function(i,d,a1,e,S,a0){d=O(d);a1=O(a1);var R=aJ("rect");i.canvas&&i.canvas[aL](R);var E=new ax(R,i);E.attrs={x:d,y:a1,width:e,height:S,r:a0||0,rx:a0||0,ry:a0||0,fill:"none",stroke:"#000"};E.type="rect";aJ(R,E.attrs);return E;};var ai=function(e,d,a0,S,R){d=O(d);a0=O(a0);var E=aJ("ellipse");e.canvas&&e.canvas[aL](E);var i=new ax(E,e);i.attrs={cx:d,cy:a0,rx:S,ry:R,fill:"none",stroke:"#000"};i.type="ellipse";aJ(E,i.attrs);return i;};var o=function(i,a0,d,a1,e,S){var R=aJ("image");aJ(R,{x:d,y:a1,width:e,height:S,preserveAspectRatio:"none"});R.setAttributeNS(i.xlink,"href",a0);i.canvas&&i.canvas[aL](R);var E=new ax(R,i);E.attrs={x:d,y:a1,width:e,height:S,src:a0};E.type="image";return E;};var X=function(e,d,S,R){var E=aJ("text");aJ(E,{x:d,y:S,"text-anchor":"middle"});e.canvas&&e.canvas[aL](E);var i=new ax(E,e);i.attrs={x:d,y:S,"text-anchor":"middle",text:R,font:j.font,stroke:"none",fill:"#000"};i.type="text";aa(i,i.attrs);return i;};var aV=function(e,d){this.width=e||this.width;this.height=d||this.height;this.canvas[v]("width",this.width);this.canvas[v]("height",this.height);return this;};var w=function(){var E=ao[aW](null,arguments),i=E&&E.container,e=E.x,a0=E.y,R=E.width,d=E.height;if(!i){throw new Error("SVG container not found.");}var S=aJ("svg");R=R||512;d=d||342;aJ(S,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:R,height:d});if(i==1){S.style.cssText="position:absolute;left:"+e+"px;top:"+a0+"px";L.body[aL](S);}else{if(i.firstChild){i.insertBefore(S,i.firstChild);}else{i[aL](S);}}i=new aT;i.width=R;i.height=d;i.canvas=S;aG.call(i,i,an.fn);i.clear();return i;};aT[aY].clear=function(){var d=this.canvas;while(d.firstChild){d.removeChild(d.firstChild);}this.bottom=this.top=null;(this.desc=aJ("desc"))[aL](L.createTextNode("Created with Rapha\xebl"));d[aL](this.desc);d[aL](this.defs=aJ("defs"));};aT[aY].remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var d in this){this[d]=s(d);}};}if(an.vml){var aH=function(a8){var a5=/[ahqstv]/ig,a0=r;(a8+at).match(a5)&&(a0=H);a5=/[clmz]/g;if(a0==r&&!(a8+at).match(a5)){var e={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},R=/([clmz]),?([^clmz]*)/gi,S=/-?[^,\s-]+/g;var a4=(a8+at)[aP](R,function(a9,bb,i){var ba=[];i[aP](S,function(bc){ba[f](O(bc));});return e[bb]+ba;});return a4;}var a6=a0(a8),E,a4=[],d;for(var a2=0,a7=a6[m];a2<a7;a2++){E=a6[a2];d=aZ.call(a6[a2][0]);d=="z"&&(d="x");for(var a1=1,a3=E[m];a1<a3;a1++){d+=O(E[a1])+(a1!=a3-1?",":at);}a4[f](d);}return a4[az](am);};an[aA]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl "+this.version;};var q=function(d,S){var E=ah("group");E.style.cssText="position:absolute;left:0;top:0;width:"+S.width+"px;height:"+S.height+"px";E.coordsize=S.coordsize;E.coordorigin=S.coordorigin;var i=ah("shape"),e=i.style;e.width=S.width+"px";e.height=S.height+"px";i.coordsize=this.coordsize;i.coordorigin=this.coordorigin;E[aL](i);var R=new ax(i,E,S);R.isAbsolute=true;R.type="path";R.path=[];R.Path=at;d&&aa(R,{fill:"none",stroke:"#000",path:d});S.canvas[aL](E);return R;};var aa=function(a3,a8){a3.attrs=a3.attrs||{};var a6=a3.node,a9=a3.attrs,a0=a6.style,E,bd=a3;for(var a1 in a8){if(a8[Q](a1)){a9[a1]=a8[a1];}}a8.href&&(a6.href=a8.href);a8.title&&(a6.title=a8.title);a8.target&&(a6.target=a8.target);a8.cursor&&(a0.cursor=a8.cursor);if(a8.path&&a3.type=="path"){a9.path=a8.path;a6.path=aH(a9.path);}if(a8.rotation!=null){a3.rotate(a8.rotation,true);}if(a8.translation){E=(a8.translation+at)[z](a);t.call(a3,E[0],E[1]);if(a3._.rt.cx!=null){a3._.rt.cx+=+E[0];a3._.rt.cy+=+E[1];a3.setBox(a3.attrs,E[0],E[1]);}}if(a8.scale){E=(a8.scale+at)[z](a);a3.scale(+E[0]||1,+E[1]||+E[0]||1,+E[2]||null,+E[3]||null);}if("clip-rect" in a8){var d=(a8["clip-rect"]+at)[z](a);if(d[m]==4){d[2]=+d[2]+(+d[0]);d[3]=+d[3]+(+d[1]);var a2=a6.clipRect||L.createElement("div"),bc=a2.style,S=a6.parentNode;bc.clip=an.format("rect({1}px {2}px {3}px {0}px)",d);if(!a6.clipRect){bc.position="absolute";bc.top=0;bc.left=0;bc.width=a3.paper.width+"px";bc.height=a3.paper.height+"px";S.parentNode.insertBefore(a2,S);a2[aL](S);a6.clipRect=a2;}}if(!a8["clip-rect"]){a6.clipRect&&(a6.clipRect.style.clip=at);}}if(a3.type=="image"&&a8.src){a6.src=a8.src;}if(a3.type=="image"&&a8.opacity){a6.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(a8.opacity*100)+")";a0.filter=(a6.filterMatrix||at)+(a6.filterOpacity||at);}a8.font&&(a0.font=a8.font);a8["font-family"]&&(a0.fontFamily='"'+a8["font-family"][z](",")[0][aP](/^['"]+|['"]+$/g,at)+'"');a8["font-size"]&&(a0.fontSize=a8["font-size"]);a8["font-weight"]&&(a0.fontWeight=a8["font-weight"]);a8["font-style"]&&(a0.fontStyle=a8["font-style"]);if(a8.opacity!=null||a8["stroke-width"]!=null||a8.fill!=null||a8.stroke!=null||a8["stroke-width"]!=null||a8["stroke-opacity"]!=null||a8["fill-opacity"]!=null||a8["stroke-dasharray"]!=null||a8["stroke-miterlimit"]!=null||a8["stroke-linejoin"]!=null||a8["stroke-linecap"]!=null){a6=a3.shape||a6;var a7=(a6.getElementsByTagName("fill")&&a6.getElementsByTagName("fill")[0]),ba=false;!a7&&(ba=a7=ah("fill"));if("fill-opacity" in a8||"opacity" in a8){var e=((+a9["fill-opacity"]+1||2)-1)*((+a9.opacity+1||2)-1);e<0&&(e=0);e>1&&(e=1);a7.opacity=e;}a8.fill&&(a7.on=true);if(a7.on==null||a8.fill=="none"){a7.on=false;}if(a7.on&&a8.fill){var i=a8.fill.match(c);if(i){a7.src=i[1];a7.type="tile";}else{a7.color=an.getRGB(a8.fill).hex;a7.src=at;a7.type="solid";if(an.getRGB(a8.fill).error&&(bd.type in {circle:1,ellipse:1}||(a8.fill+at).charAt()!="r")&&b(bd,a8.fill)){a9.fill="none";a9.gradient=a8.fill;}}}ba&&a6[aL](a7);var R=(a6.getElementsByTagName("stroke")&&a6.getElementsByTagName("stroke")[0]),bb=false;!R&&(bb=R=ah("stroke"));if((a8.stroke&&a8.stroke!="none")||a8["stroke-width"]||a8["stroke-opacity"]!=null||a8["stroke-dasharray"]||a8["stroke-miterlimit"]||a8["stroke-linejoin"]||a8["stroke-linecap"]){R.on=true;}(a8.stroke=="none"||R.on==null||a8.stroke==0||a8["stroke-width"]==0)&&(R.on=false);R.on&&a8.stroke&&(R.color=an.getRGB(a8.stroke).hex);var e=((+a9["stroke-opacity"]+1||2)-1)*((+a9.opacity+1||2)-1),a4=(W(a8["stroke-width"])||1)*0.75;e<0&&(e=0);e>1&&(e=1);a8["stroke-width"]==null&&(a4=a9["stroke-width"]);a8["stroke-width"]&&(R.weight=a4);a4&&a4<1&&(e*=a4)&&(R.weight=1);R.opacity=e;a8["stroke-linejoin"]&&(R.joinstyle=a8["stroke-linejoin"]||"miter");R.miterlimit=a8["stroke-miterlimit"]||8;a8["stroke-linecap"]&&(R.endcap=a8["stroke-linecap"]=="butt"?"flat":a8["stroke-linecap"]=="square"?"square":"round");if(a8["stroke-dasharray"]){var a5={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};R.dashstyle=a5[Q](a8["stroke-dasharray"])?a5[a8["stroke-dasharray"]]:at;}bb&&a6[aL](R);}if(bd.type=="text"){var a0=bd.paper.span.style;a9.font&&(a0.font=a9.font);a9["font-family"]&&(a0.fontFamily=a9["font-family"]);a9["font-size"]&&(a0.fontSize=a9["font-size"]);a9["font-weight"]&&(a0.fontWeight=a9["font-weight"]);a9["font-style"]&&(a0.fontStyle=a9["font-style"]);bd.node.string&&(bd.paper.span.innerHTML=(bd.node.string+at)[aP](/</g,"<")[aP](/&/g,"&")[aP](/\n/g,"<br>"));bd.W=a9.w=bd.paper.span.offsetWidth;bd.H=a9.h=bd.paper.span.offsetHeight;bd.X=a9.x;bd.Y=a9.y+O(bd.H/2);switch(a9["text-anchor"]){case"start":bd.node.style["v-text-align"]="left";bd.bbx=O(bd.W/2);break;case"end":bd.node.style["v-text-align"]="right";bd.bbx=-O(bd.W/2);break;default:bd.node.style["v-text-align"]="center";break;}}};var b=function(d,a1){d.attrs=d.attrs||{};var a2=d.attrs,a4=d.node.getElementsByTagName("fill"),S="linear",a0=".5 .5";d.attrs.gradient=a1;a1=(a1+at)[aP](ar,function(a6,a7,i){S="radial";if(a7&&i){a7=W(a7);i=W(i);aM(a7-0.5,2)+aM(i-0.5,2)>0.25&&(i=ab.sqrt(0.25-aM(a7-0.5,2))*((i>0.5)*2-1)+0.5);a0=a7+am+i;}return at;});a1=a1[z](/\s*\-\s*/);if(S=="linear"){var e=a1.shift();e=-W(e);if(isNaN(e)){return null;}}var R=p(a1);if(!R){return null;}d=d.shape||d.node;a4=a4[0]||ah("fill");if(R[m]){a4.on=true;a4.method="none";a4.type=(S=="radial")?"gradientradial":"gradient";a4.color=R[0].color;a4.color2=R[R[m]-1].color;var a5=[];for(var E=0,a3=R[m];E<a3;E++){R[E].offset&&a5[f](R[E].offset+am+R[E].color);}a4.colors&&(a4.colors.value=a5[m]?a5[az](","):"0% "+a4.color);if(S=="radial"){a4.focus="100%";a4.focussize=a0;a4.focusposition=a0;}else{a4.angle=(270-e)%360;}}return 1;};var ax=function(R,a0,d){var S=0,i=0,e=0,E=1;this[0]=R;this.id=an._oid++;this.node=R;R.raphael=this;this.X=0;this.Y=0;this.attrs={};this.Group=a0;this.paper=d;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!d.bottom&&(d.bottom=this);this.prev=d.top;d.top&&(d.top.next=this);d.top=this;this.next=null;};ax[aY].rotate=function(e,d,i){if(this.removed){return this;}if(e==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][az](am);}return this._.rt.deg;}e=(e+at)[z](a);if(e[m]-1){d=W(e[1]);i=W(e[2]);}e=W(e[0]);if(d!=null){this._.rt.deg=e;}else{this._.rt.deg+=e;}i==null&&(d=null);this._.rt.cx=d;this._.rt.cy=i;this.setBox(this.attrs,d,i);this.Group.style.rotation=this._.rt.deg;return this;};ax[aY].setBox=function(bb,e,d){if(this.removed){return this;}var a5=this.Group.style,R=(this.shape&&this.shape.style)||this.node.style;bb=bb||{};for(var a9 in bb){if(bb[Q](a9)){this.attrs[a9]=bb[a9];}}e=e||this._.rt.cx;d=d||this._.rt.cy;var a7=this.attrs,a1,a0,a2,ba;switch(this.type){case"circle":a1=a7.cx-a7.r;a0=a7.cy-a7.r;a2=ba=a7.r*2;break;case"ellipse":a1=a7.cx-a7.rx;a0=a7.cy-a7.ry;a2=a7.rx*2;ba=a7.ry*2;break;case"rect":case"image":a1=+a7.x;a0=+a7.y;a2=a7.width||0;ba=a7.height||0;break;case"text":this.textpath.v=["m",O(a7.x),", ",O(a7.y-2),"l",O(a7.x)+1,", ",O(a7.y-2)][az](at);a1=a7.x-O(this.W/2);a0=a7.y-this.H/2;a2=this.W;ba=this.H;break;case"path":if(!this.attrs.path){a1=0;a0=0;a2=this.paper.width;ba=this.paper.height;}else{var a8=U(this.attrs.path);a1=a8.x;a0=a8.y;a2=a8.width;ba=a8.height;}break;default:a1=0;a0=0;a2=this.paper.width;ba=this.paper.height;break;}e=(e==null)?a1+a2/2:e;d=(d==null)?a0+ba/2:d;var E=e-this.paper.width/2,a4=d-this.paper.height/2;if(this.type=="path"||this.type=="text"){(a5.left!=E+"px")&&(a5.left=E+"px");(a5.top!=a4+"px")&&(a5.top=a4+"px");this.X=this.type=="text"?a1:-E;this.Y=this.type=="text"?a0:-a4;this.W=a2;this.H=ba;(R.left!=-E+"px")&&(R.left=-E+"px");(R.top!=-a4+"px")&&(R.top=-a4+"px");}else{(a5.left!=E+"px")&&(a5.left=E+"px");(a5.top!=a4+"px")&&(a5.top=a4+"px");this.X=a1;this.Y=a0;this.W=a2;this.H=ba;(a5.width!=this.paper.width+"px")&&(a5.width=this.paper.width+"px");(a5.height!=this.paper.height+"px")&&(a5.height=this.paper.height+"px");(R.left!=a1-E+"px")&&(R.left=a1-E+"px");(R.top!=a0-a4+"px")&&(R.top=a0-a4+"px");(R.width!=a2+"px")&&(R.width=a2+"px");(R.height!=ba+"px")&&(R.height=ba+"px");var S=(+bb.r||0)/aI(a2,ba);if(this.type=="rect"&&this.arcsize.toFixed(4)!=S.toFixed(4)&&(S||this.arcsize)){var a6=ah("roundrect"),bc={},a9=0,a3=this.events&&this.events[m];a6.arcsize=S;a6.raphael=this;this.Group[aL](a6);this.Group.removeChild(this.node);this[0]=this.node=a6;this.arcsize=S;for(var a9 in a7){bc[a9]=a7[a9];}delete bc.scale;this.attr(bc);if(this.events){for(;a9<a3;a9++){this.events[a9].unbind=ae(this.node,this.events[a9].name,this.events[a9].f,this);}}}}};ax[aY].hide=function(){!this.removed&&(this.Group.style.display="none");return this;};ax[aY].show=function(){!this.removed&&(this.Group.style.display="block");return this;};ax[aY].getBBox=function(){if(this.removed){return this;}if(this.type=="path"){return U(this.attrs.path);}return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H};};ax[aY].remove=function(){if(this.removed){return;}ak(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var d in this){delete this[d];}this.removed=true;};ax[aY].attr=function(){if(this.removed){return this;}if(arguments[m]==0){var E={};for(var e in this.attrs){if(this.attrs[Q](e)){E[e]=this.attrs[e];}}this._.rt.deg&&(E.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(E.scale=this.scale());E.gradient&&E.fill=="none"&&(E.fill=E.gradient)&&delete E.gradient;return E;}if(arguments[m]==1&&an.is(arguments[0],"string")){if(arguments[0]=="translation"){return t.call(this);}if(arguments[0]=="rotation"){return this.rotate();}if(arguments[0]=="scale"){return this.scale();}if(arguments[0]=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient;}return this.attrs[arguments[0]];}if(this.attrs&&arguments[m]==1&&an.is(arguments[0],"array")){var d={};for(var e=0,R=arguments[0][m];e<R;e++){d[arguments[0][e]]=this.attrs[arguments[0][e]];}return d;}var S;if(arguments[m]==2){S={};S[arguments[0]]=arguments[1];}arguments[m]==1&&an.is(arguments[0],"object")&&(S=arguments[0]);if(S){if(S.text&&this.type=="text"){this.node.string=S.text;}aa(this,S);if(S.gradient&&(({circle:1,ellipse:1})[Q](this.type)||(S.gradient+at).charAt()!="r")){b(this,S.gradient);}(this.type!="path"||this._.rt.deg)&&this.setBox(this.attrs);}return this;};ax[aY].toFront=function(){!this.removed&&this.Group.parentNode[aL](this.Group);this.paper.top!=this&&Y(this,this.paper);return this;};ax[aY].toBack=function(){if(this.removed){return this;}if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);k(this,this.paper);}return this;};ax[aY].insertAfter=function(d){if(this.removed){return this;}if(d.Group.nextSibling){d.Group.parentNode.insertBefore(this.Group,d.Group.nextSibling);}else{d.Group.parentNode[aL](this.Group);}A(this,d,this.paper);return this;};ax[aY].insertBefore=function(d){if(this.removed){return this;}d.Group.parentNode.insertBefore(this.Group,d.Group);aq(this,d,this.paper);return this;};var P=function(e,d,a1,S){var R=ah("group"),a0=ah("oval"),i=a0.style;R.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px";R.coordsize=e.coordsize;R.coordorigin=e.coordorigin;R[aL](a0);var E=new ax(a0,R,e);E.type="circle";aa(E,{stroke:"#000",fill:"none"});E.attrs.cx=d;E.attrs.cy=a1;E.attrs.r=S;E.setBox({x:d-S,y:a1-S,width:S*2,height:S*2});e.canvas[aL](R);return E;},aF=function(e,a1,a0,a2,E,d){var R=ah("group"),i=ah("roundrect"),a3=(+d||0)/(aI(a2,E));R.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px";R.coordsize=e.coordsize;R.coordorigin=e.coordorigin;R[aL](i);i.arcsize=a3;var S=new ax(i,R,e);S.type="rect";aa(S,{stroke:"#000"});S.arcsize=a3;S.setBox({x:a1,y:a0,width:a2,height:E,r:d});e.canvas[aL](R);return S;},ai=function(d,a2,a1,i,e){var R=ah("group"),E=ah("oval"),a0=E.style;R.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";R.coordsize=d.coordsize;R.coordorigin=d.coordorigin;R[aL](E);var S=new ax(E,R,d);S.type="ellipse";aa(S,{stroke:"#000"});S.attrs.cx=a2;S.attrs.cy=a1;S.attrs.rx=i;S.attrs.ry=e;S.setBox({x:a2-i,y:a1-e,width:i*2,height:e*2});d.canvas[aL](R);return S;},o=function(e,d,a2,a1,a3,E){var R=ah("group"),i=ah("image"),a0=i.style;R.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px";R.coordsize=e.coordsize;R.coordorigin=e.coordorigin;i.src=d;R[aL](i);var S=new ax(i,R,e);S.type="image";S.attrs.src=d;S.attrs.x=a2;S.attrs.y=a1;S.attrs.w=a3;S.attrs.h=E;S.setBox({x:a2,y:a1,width:a3,height:E});e.canvas[aL](R);return S;},X=function(e,a2,a1,a3){var R=ah("group"),E=ah("shape"),a0=E.style,a4=ah("path"),d=a4.style,i=ah("textpath");R.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px";R.coordsize=e.coordsize;R.coordorigin=e.coordorigin;a4.v=an.format("m{0},{1}l{2},{1}",O(a2),O(a1),O(a2)+1);a4.textpathok=true;a0.width=e.width;a0.height=e.height;i.string=a3+at;i.on=true;E[aL](i);E[aL](a4);R[aL](E);var S=new ax(i,R,e);S.shape=E;S.textpath=a4;S.type="text";S.attrs.text=a3;S.attrs.x=a2;S.attrs.y=a1;S.attrs.w=1;S.attrs.h=1;aa(S,{font:j.font,stroke:"none",fill:"#000"});S.setBox();e.canvas[aL](R);return S;},aV=function(i,d){var e=this.canvas.style;i==+i&&(i+="px");d==+d&&(d+="px");e.width=i;e.height=d;e.clip="rect(0 "+i+" "+d+" 0)";return this;},ah;L.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!L.namespaces.rvml&&L.namespaces.add("rvml","urn:schemas-microsoft-com:vml");ah=function(d){return L.createElement("<rvml:"+d+' class="rvml">');};}catch(af){ah=function(d){return L.createElement("<"+d+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');};}var w=function(){var i=ao[aW](null,arguments),d=i.container,a2=i.height,a3,e=i.width,a1=i.x,a0=i.y;if(!d){throw new Error("VML container not found.");}var R=new aT,S=R.canvas=L.createElement("div"),E=S.style;e=e||512;a2=a2||342;e==+e&&(e+="px");a2==+a2&&(a2+="px");R.width=1000;R.height=1000;R.coordsize="1000 1000";R.coordorigin="0 0";R.span=L.createElement("span");R.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";S[aL](R.span);E.cssText=an.format("width:{0};height:{1};position:absolute;clip:rect(0 {0} {1} 0);overflow:hidden",e,a2);if(d==1){L.body[aL](S);E.left=a1+"px";E.top=a0+"px";}else{d.style.width=e;d.style.height=a2;if(d.firstChild){d.insertBefore(S,d.firstChild);}else{d[aL](S);}}aG.call(R,R,an.fn);return R;};aT[aY].clear=function(){this.canvas.innerHTML=at;this.span=L.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[aL](this.span);this.bottom=this.top=null;};aT[aY].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var d in this){this[d]=s(d);}};}if((/^Apple|^Google/).test(navigator.vendor)&&!(navigator.userAgent.indexOf("Version/4.0")+1)){aT[aY].safari=function(){var d=this.rect(-99,-99,this.width+99,this.height+99);setTimeout(function(){d.remove();});};}else{aT[aY].safari=function(){};}var ae=(function(){if(L.addEventListener){return function(R,i,e,d){var E=function(S){return e.call(d,S);};R.addEventListener(i,E,false);return function(){R.removeEventListener(i,E,false);return true;};};}else{if(L.attachEvent){return function(S,E,i,e){var R=function(a0){return i.call(e,a0||au.event);};S.attachEvent("on"+E,R);var d=function(){S.detachEvent("on"+E,R);return true;};return d;};}}})();for(var ac=F[m];ac--;){(function(d){ax[aY][d]=function(e){if(an.is(e,"function")){this.events=this.events||[];this.events.push({name:d,f:e,unbind:ae(this.shape||this.node,d,e,this)});}return this;};ax[aY]["un"+d]=function(E){var i=this.events,e=i[m];while(e--){if(i[e].name==d&&i[e].f==E){i[e].unbind();i.splice(e,1);!i.length&&delete this.events;return this;}}return this;};})(F[ac]);}ax[aY].hover=function(e,d){return this.mouseover(e).mouseout(d);};ax[aY].unhover=function(e,d){return this.unmouseover(e).unmouseout(d);};aT[aY].circle=function(d,i,e){return P(this,d||0,i||0,e||0);};aT[aY].rect=function(d,R,e,i,E){return aF(this,d||0,R||0,e||0,i||0,E||0);};aT[aY].ellipse=function(d,E,i,e){return ai(this,d||0,E||0,i||0,e||0);};aT[aY].path=function(d){d&&!an.is(d,"string")&&!an.is(d[0],"array")&&(d+=at);return q(an.format[aW](an,arguments),this);};aT[aY].image=function(E,d,R,e,i){return o(this,E||"about:blank",d||0,R||0,e||0,i||0);};aT[aY].text=function(d,i,e){return X(this,d||0,i||0,e||at);};aT[aY].set=function(d){arguments[m]>1&&(d=Array[aY].splice.call(arguments,0,arguments[m]));return new T(d);};aT[aY].setSize=aV;aT[aY].top=aT[aY].bottom=null;aT[aY].raphael=an;function u(){return this.x+am+this.y;}ax[aY].scale=function(a6,a5,E,e){if(a6==null&&a5==null){return{x:this._.sx,y:this._.sy,toString:u};}a5=a5||a6;!+a5&&(a5=a6);var ba,a8,a9,a7,bm=this.attrs;if(a6!=0){var a4=this.getBBox(),a1=a4.x+a4.width/2,R=a4.y+a4.height/2,bl=a6/this._.sx,bk=a5/this._.sy;E=(+E||E==0)?E:a1;e=(+e||e==0)?e:R;var a3=~~(a6/ab.abs(a6)),a0=~~(a5/ab.abs(a5)),be=this.node.style,bo=E+(a1-E)*bl,bn=e+(R-e)*bk;switch(this.type){case"rect":case"image":var a2=bm.width*a3*bl,bd=bm.height*a0*bk;this.attr({height:bd,r:bm.r*aI(a3*bl,a0*bk),width:a2,x:bo-a2/2,y:bn-bd/2});break;case"circle":case"ellipse":this.attr({rx:bm.rx*a3*bl,ry:bm.ry*a0*bk,r:bm.r*aI(a3*bl,a0*bk),cx:bo,cy:bn});break;case"path":var bg=ad(bm.path),bh=true;for(var bj=0,bc=bg[m];bj<bc;bj++){var bf=bg[bj],bi,S=aN.call(bf[0]);if(S=="M"&&bh){continue;}else{bh=false;}if(S=="A"){bf[bg[bj][m]-2]*=bl;bf[bg[bj][m]-1]*=bk;bf[1]*=a3*bl;bf[2]*=a0*bk;bf[5]=+(a3+a0?!!+bf[5]:!+bf[5]);}else{if(S=="H"){for(bi=1,jj=bf[m];bi<jj;bi++){bf[bi]*=bl;}}else{if(S=="V"){for(bi=1,jj=bf[m];bi<jj;bi++){bf[bi]*=bk;}}else{for(bi=1,jj=bf[m];bi<jj;bi++){bf[bi]*=(bi%2)?bl:bk;}}}}}var d=U(bg),ba=bo-d.x-d.width/2,a8=bn-d.y-d.height/2;bg[0][1]+=ba;bg[0][2]+=a8;this.attr({path:bg});break;}if(this.type in {text:1,image:1}&&(a3!=1||a0!=1)){if(this.transformations){this.transformations[2]="scale("[aS](a3,",",a0,")");this.node[v]("transform",this.transformations[az](am));ba=(a3==-1)?-bm.x-(a2||0):bm.x;a8=(a0==-1)?-bm.y-(bd||0):bm.y;this.attr({x:ba,y:a8});bm.fx=a3-1;bm.fy=a0-1;}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11="[aS](a3,", M12=0, M21=0, M22=",a0,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");be.filter=(this.node.filterMatrix||at)+(this.node.filterOpacity||at);}}else{if(this.transformations){this.transformations[2]=at;this.node[v]("transform",this.transformations[az](am));bm.fx=0;bm.fy=0;}else{this.node.filterMatrix=at;be.filter=(this.node.filterMatrix||at)+(this.node.filterOpacity||at);}}bm.scale=[a6,a5,E,e][az](am);this._.sx=a6;this._.sy=a5;}return this;};ax[aY].clone=function(){var d=this.attr();delete d.scale;delete d.translation;return this.paper[this.type]().attr(d);};var aB=function(d,e){return function(a9,S,a0){a9=H(a9);var a5,a4,E,a1,R="",a8={},a6,a3=0;for(var a2=0,a7=a9.length;a2<a7;a2++){E=a9[a2];if(E[0]=="M"){a5=+E[1];a4=+E[2];}else{a1=n(a5,a4,E[1],E[2],E[3],E[4],E[5],E[6]);if(a3+a1>S){if(e&&!a8.start){a6=an.findDotsAtSegment(a5,a4,E[1],E[2],E[3],E[4],E[5],E[6],(S-a3)/a1);R+=["C",a6.start.x,a6.start.y,a6.m.x,a6.m.y,a6.x,a6.y];if(a0){return R;}a8.start=R;R=["M",a6.x,a6.y+"C",a6.n.x,a6.n.y,a6.end.x,a6.end.y,E[5],E[6]][az]();a3+=a1;a5=+E[5];a4=+E[6];continue;}if(!d&&!e){a6=an.findDotsAtSegment(a5,a4,E[1],E[2],E[3],E[4],E[5],E[6],(S-a3)/a1);return{x:a6.x,y:a6.y,alpha:a6.alpha};}}a3+=a1;a5=+E[5];a4=+E[6];}R+=E;}a8.end=R;a6=d?a3:e?a8:an.findDotsAtSegment(a5,a4,E[1],E[2],E[3],E[4],E[5],E[6],1);a6.alpha&&(a6={x:a6.x,y:a6.y,alpha:a6.alpha});return a6;};},n=aj(function(E,d,a0,S,a6,a5,a4,a3){var R={x:0,y:0},a2=0;for(var a1=0;a1<1.01;a1+=0.01){var e=M(E,d,a0,S,a6,a5,a4,a3,a1);a1&&(a2+=ab.sqrt(aM(R.x-e.x,2)+aM(R.y-e.y,2)));R=e;}return a2;});var ap=aB(1),C=aB(),J=aB(0,1);ax[aY].getTotalLength=function(){if(this.type!="path"){return;}return ap(this.attrs.path);};ax[aY].getPointAtLength=function(d){if(this.type!="path"){return;}return C(this.attrs.path,d);};ax[aY].getSubpath=function(i,e){if(this.type!="path"){return;}if(ab.abs(this.getTotalLength()-e)<0.000001){return J(this.attrs.path,i).end;}var d=J(this.attrs.path,e,1);return i?J(d,i).end:d;};an.easing_formulas={linear:function(d){return d;},"<":function(d){return aM(d,3);},">":function(d){return aM(d-1,3)+1;},"<>":function(d){d=d*2;if(d<1){return aM(d,3)/2;}d-=2;return(aM(d,3)+2)/2;},backIn:function(e){var d=1.70158;return e*e*((d+1)*e-d);},backOut:function(e){e=e-1;var d=1.70158;return e*e*((d+1)*e+d)+1;},elastic:function(i){if(i==0||i==1){return i;}var e=0.3,d=e/4;return aM(2,-10*i)*ab.sin((i-d)*(2*ab.PI)/e)+1;},bounce:function(E){var e=7.5625,i=2.75,d;if(E<(1/i)){d=e*E*E;}else{if(E<(2/i)){E-=(1.5/i);d=e*E*E+0.75;}else{if(E<(2.5/i)){E-=(2.25/i);d=e*E*E+0.9375;}else{E-=(2.625/i);d=e*E*E+0.984375;}}}return d;}};var I={length:0},aR=function(){var a2=+new Date;for(var be in I){if(be!="length"&&I[Q](be)){var bj=I[be];if(bj.stop){delete I[be];I[m]--;continue;}var a0=a2-bj.start,bb=bj.ms,ba=bj.easing,bf=bj.from,a7=bj.diff,E=bj.to,a6=bj.t,a9=bj.prev||0,a1=bj.el,R=bj.callback,a8={},d;if(a0<bb){var S=an.easing_formulas[ba]?an.easing_formulas[ba](a0/bb):a0/bb;for(var bc in bf){if(bf[Q](bc)){switch(Z[bc]){case"along":d=S*bb*a7[bc];E.back&&(d=E.len-d);var bd=C(E[bc],d);a1.translate(a7.sx-a7.x||0,a7.sy-a7.y||0);a7.x=bd.x;a7.y=bd.y;a1.translate(bd.x-a7.sx,bd.y-a7.sy);E.rot&&a1.rotate(a7.r+bd.alpha,bd.x,bd.y);break;case"number":d=+bf[bc]+S*bb*a7[bc];break;case"colour":d="rgb("+[B(O(bf[bc].r+S*bb*a7[bc].r)),B(O(bf[bc].g+S*bb*a7[bc].g)),B(O(bf[bc].b+S*bb*a7[bc].b))][az](",")+")";break;case"path":d=[];for(var bh=0,a5=bf[bc][m];bh<a5;bh++){d[bh]=[bf[bc][bh][0]];for(var bg=1,bi=bf[bc][bh][m];bg<bi;bg++){d[bh][bg]=+bf[bc][bh][bg]+S*bb*a7[bc][bh][bg];}d[bh]=d[bh][az](am);}d=d[az](am);break;case"csv":switch(bc){case"translation":var a4=a7[bc][0]*(a0-a9),a3=a7[bc][1]*(a0-a9);a6.x+=a4;a6.y+=a3;d=a4+am+a3;break;case"rotation":d=+bf[bc][0]+S*bb*a7[bc][0];bf[bc][1]&&(d+=","+bf[bc][1]+","+bf[bc][2]);break;case"scale":d=[+bf[bc][0]+S*bb*a7[bc][0],+bf[bc][1]+S*bb*a7[bc][1],(2 in E[bc]?E[bc][2]:at),(3 in E[bc]?E[bc][3]:at)][az](am);break;case"clip-rect":d=[];var bh=4;while(bh--){d[bh]=+bf[bc][bh]+S*bb*a7[bc][bh];}break;}break;}a8[bc]=d;}}a1.attr(a8);a1._run&&a1._run.call(a1);}else{if(E.along){var bd=C(E.along,E.len*!E.back);a1.translate(a7.sx-(a7.x||0)+bd.x-a7.sx,a7.sy-(a7.y||0)+bd.y-a7.sy);E.rot&&a1.rotate(a7.r+bd.alpha,bd.x,bd.y);}(a6.x||a6.y)&&a1.translate(-a6.x,-a6.y);E.scale&&(E.scale=E.scale+at);a1.attr(E);delete I[be];I[m]--;a1.in_animation=null;an.is(R,"function")&&R.call(a1);}bj.prev=a0;}}an.svg&&a1&&a1.paper.safari();I[m]&&setTimeout(aR);},B=function(d){return d>255?255:(d<0?0:d);},t=function(d,i){if(d==null){return{x:this._.tx,y:this._.ty,toString:u};}this._.tx+=+d;this._.ty+=+i;switch(this.type){case"circle":case"ellipse":this.attr({cx:+d+this.attrs.cx,cy:+i+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+d+this.attrs.x,y:+i+this.attrs.y});break;case"path":var e=ad(this.attrs.path);e[0][1]+=+d;e[0][2]+=+i;this.attr({path:e});break;}return this;};ax[aY].animateWith=function(e,i,d,R,E){I[e.id]&&(i.start=I[e.id].start);return this.animate(i,d,R,E);};ax[aY].animateAlong=ay();ax[aY].animateAlongBack=ay(1);function ay(d){return function(E,i,e,S){var R={back:d};an.is(e,"function")?(S=e):(R.rot=e);E&&E.constructor==ax&&(E=E.attrs.path);E&&(R.along=E);return this.animate(R,i,S);};}ax[aY].onAnimation=function(d){this._run=d||0;return this;};ax[aY].animate=function(be,a5,a4,E){if(an.is(a4,"function")||!a4){E=a4||null;}var a9={},e={},a2={};for(var a6 in be){if(be[Q](a6)){if(Z[Q](a6)){a9[a6]=this.attr(a6);(a9[a6]==null)&&(a9[a6]=j[a6]);e[a6]=be[a6];switch(Z[a6]){case"along":var bc=ap(be[a6]),a7=C(be[a6],bc*!!be.back),R=this.getBBox();a2[a6]=bc/a5;a2.tx=R.x;a2.ty=R.y;a2.sx=a7.x;a2.sy=a7.y;e.rot=be.rot;e.back=be.back;e.len=bc;be.rot&&(a2.r=W(this.rotate())||0);break;case"number":a2[a6]=(e[a6]-a9[a6])/a5;break;case"colour":a9[a6]=an.getRGB(a9[a6]);var a8=an.getRGB(e[a6]);a2[a6]={r:(a8.r-a9[a6].r)/a5,g:(a8.g-a9[a6].g)/a5,b:(a8.b-a9[a6].b)/a5};break;case"path":var S=H(a9[a6],e[a6]);a9[a6]=S[0];var a3=S[1];a2[a6]=[];for(var bb=0,a1=a9[a6][m];bb<a1;bb++){a2[a6][bb]=[0];for(var ba=1,bd=a9[a6][bb][m];ba<bd;ba++){a2[a6][bb][ba]=(a3[bb][ba]-a9[a6][bb][ba])/a5;}}break;case"csv":var d=(be[a6]+at)[z](a),a0=(a9[a6]+at)[z](a);switch(a6){case"translation":a9[a6]=[0,0];a2[a6]=[d[0]/a5,d[1]/a5];break;case"rotation":a9[a6]=(a0[1]==d[1]&&a0[2]==d[2])?a0:[0,d[1],d[2]];a2[a6]=[(d[0]-a9[a6][0])/a5,0,0];break;case"scale":be[a6]=d;a9[a6]=(a9[a6]+at)[z](a);a2[a6]=[(d[0]-a9[a6][0])/a5,(d[1]-a9[a6][1])/a5,0,0];break;case"clip-rect":a9[a6]=(a9[a6]+at)[z](a);a2[a6]=[];var bb=4;while(bb--){a2[a6][bb]=(d[bb]-a9[a6][bb])/a5;}break;}e[a6]=d;}}}}this.stop();this.in_animation=1;I[this.id]={start:be.start||+new Date,ms:a5,easing:a4,from:a9,diff:a2,to:e,el:this,callback:E,t:{x:0,y:0}};++I[m]==1&&aR();return this;};ax[aY].stop=function(){I[this.id]&&I[m]--;delete I[this.id];return this;};ax[aY].translate=function(d,e){return this.attr({translation:d+" "+e});};ax[aY][aA]=function(){return"Rapha\xebl\u2019s object";};an.ae=I;var T=function(d){this.items=[];this[m]=0;if(d){for(var e=0,E=d[m];e<E;e++){if(d[e]&&(d[e].constructor==ax||d[e].constructor==T)){this[this.items[m]]=this.items[this.items[m]]=d[e];this[m]++;}}}};T[aY][f]=function(){var R,d;for(var e=0,E=arguments[m];e<E;e++){R=arguments[e];if(R&&(R.constructor==ax||R.constructor==T)){d=this.items[m];this[d]=this.items[d]=R;this[m]++;}}return this;};T[aY].pop=function(){delete this[this[m]--];return this.items.pop();};for(var y in ax[aY]){if(ax[aY][Q](y)){T[aY][y]=(function(d){return function(){for(var e=0,E=this.items[m];e<E;e++){this.items[e][d][aW](this.items[e],arguments);}return this;};})(y);}}T[aY].attr=function(e,a0){if(e&&an.is(e,"array")&&an.is(e[0],"object")){for(var d=0,S=e[m];d<S;d++){this.items[d].attr(e[d]);}}else{for(var E=0,R=this.items[m];E<R;E++){this.items[E].attr[aW](this.items[E],arguments);}}return this;};T[aY].animate=function(S,e,a2,a1){(an.is(a2,"function")||!a2)&&(a1=a2||null);var d=this.items[m],E=d,a0=this,R;a1&&(R=function(){!--d&&a1.call(a0);});this.items[--E].animate(S,e,a2||R,R);while(E--){this.items[E].animateWith(this.items[d-1],S,e,a2||R,R);}return this;};T[aY].insertAfter=function(e){var d=this.items[m];while(d--){this.items[d].insertAfter(e);}return this;};T[aY].getBBox=function(){var d=[],a0=[],e=[],R=[];for(var E=this.items[m];E--;){var S=this.items[E].getBBox();d[f](S.x);a0[f](S.y);e[f](S.x+S.width);R[f](S.y+S.height);}d=aI[aW](0,d);a0=aI[aW](0,a0);return{x:d,y:a0,width:g[aW](0,e)-d,height:g[aW](0,R)-a0};};an.registerFont=function(e){if(!e.face){return e;}this.fonts=this.fonts||{};var E={w:e.w,face:{},glyphs:{}},i=e.face["font-family"];for(var a0 in e.face){if(e.face[Q](a0)){E.face[a0]=e.face[a0];}}if(this.fonts[i]){this.fonts[i][f](E);}else{this.fonts[i]=[E];}if(!e.svg){E.face["units-per-em"]=G(e.face["units-per-em"],10);for(var R in e.glyphs){if(e.glyphs[Q](R)){var S=e.glyphs[R];E.glyphs[R]={w:S.w,k:{},d:S.d&&"M"+S.d[aP](/[mlcxtrv]/g,function(a1){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a1]||"M";})+"z"};if(S.k){for(var d in S.k){if(S[Q](d)){E.glyphs[R].k[d]=S.k[d];}}}}}}return e;};aT[aY].getFont=function(a2,a3,e,R){R=R||"normal";e=e||"normal";a3=+a3||{normal:400,bold:700,lighter:300,bolder:800}[a3]||400;var S=an.fonts[a2];if(!S){var E=new RegExp("(^|\\s)"+a2[aP](/[^\w\d\s+!~.:_-]/g,at)+"(\\s|$)","i");for(var d in an.fonts){if(an.fonts[Q](d)){if(E.test(d)){S=an.fonts[d];break;}}}}var a0;if(S){for(var a1=0,a4=S[m];a1<a4;a1++){a0=S[a1];if(a0.face["font-weight"]==a3&&(a0.face["font-style"]==e||!a0.face["font-style"])&&a0.face["font-stretch"]==R){break;}}}return a0;};aT[aY].print=function(R,E,d,a1,a2,bb){bb=bb||"middle";var a7=this.set(),ba=(d+at)[z](at),a8=0,a4=at,bc;an.is(a1,"string")&&(a1=this.getFont(a1));if(a1){bc=(a2||16)/a1.face["units-per-em"];var e=a1.face.bbox.split(a),a0=+e[0],a3=+e[1]+(bb=="baseline"?e[3]-e[1]+(+a1.face.descent):(e[3]-e[1])/2);for(var a6=0,S=ba[m];a6<S;a6++){var a5=a6&&a1.glyphs[ba[a6-1]]||{},a9=a1.glyphs[ba[a6]];a8+=a6?(a5.w||a1.w)+(a5.k&&a5.k[ba[a6]]||0):0;a9&&a9.d&&a7[f](this.path(a9.d).attr({fill:"#000",stroke:"none",translation:[a8,0]}));}a7.scale(bc,bc,a0,a3).translate(R-a0,E-a3);}return a7;};an.format=function(i){var e=an.is(arguments[1],"array")?[0][aS](arguments[1]):arguments,d=/\{(\d+)\}/g;i&&an.is(i,"string")&&e[m]-1&&(i=i[aP](d,function(R,E){return e[++E]==null?at:e[E];}));return i||at;};an.ninja=function(){var d=Raphael;if(l.was){Raphael=l.is;}else{delete Raphael;}return d;};an.el=ax[aY];return an;})();(function(){function b(){}function c(w,u){for(var v in (u||{})){w[v]=u[v]}return w}function m(u){return(typeof u=="function")?u:function(){return u}}var k=Date.now||function(){return +new Date};function j(v){var u=h(v);return(u)?((u!="array")?[v]:v):[]}var h=function(u){return h.s.call(u).match(/^\[object\s(.*)\]$/)[1].toLowerCase()};h.s=Object.prototype.toString;function g(y,x){var w=h(y);if(w=="object"){for(var v in y){x(y[v],v)}}else{for(var u=0;u<y.length;u++){x(y[u],u)}}}function r(){var y={};for(var x=0,u=arguments.length;x<u;x++){var v=arguments[x];if(h(v)!="object"){continue}for(var w in v){var A=v[w],z=y[w];y[w]=(z&&h(A)=="object"&&h(z)=="object")?r(z,A):n(A)}}return y}function n(w){var v;switch(h(w)){case"object":v={};for(var y in w){v[y]=n(w[y])}break;case"array":v=[];for(var x=0,u=w.length;x<u;x++){v[x]=n(w[x])}break;default:return w}return v}function d(y,x){if(y.length<3){return null}if(y.length==4&&y[3]==0&&!x){return"transparent"}var v=[];for(var u=0;u<3;u++){var w=(y[u]-0).toString(16);v.push((w.length==1)?"0"+w:w)}return(x)?v:"#"+v.join("")}function i(u){f(u);if(u.parentNode){u.parentNode.removeChild(u)}if(u.clearAttributes){u.clearAttributes()}}function f(w){for(var v=w.childNodes,u=0;u<v.length;u++){i(v[u])}}function t(w,v,u){if(w.addEventListener){w.addEventListener(v,u,false)}else{w.attachEvent("on"+v,u)}}function s(v,u){return(" "+v.className+" ").indexOf(" "+u+" ")>-1}function p(v,u){if(!s(v,u)){v.className=(v.className+" "+u)}}function a(v,u){v.className=v.className.replace(new RegExp("(^|\\s)"+u+"(?:\\s|$)"),"$1")}function e(u){return document.getElementById(u)}var o=function(v){v=v||{};var u=function(){this.constructor=u;if(o.prototyping){return this}var x=(this.initialize)?this.initialize.apply(this,arguments):this;return x};for(var w in o.Mutators){if(!v[w]){continue}v=o.Mutators[w](v,v[w]);delete v[w]}c(u,this);u.constructor=o;u.prototype=v;return u};o.Mutators={Extends:function(w,u){o.prototyping=u.prototype;var v=new u;delete v.parent;v=o.inherit(v,w);delete o.prototyping;return v},Implements:function(u,v){g(j(v),function(w){o.prototying=w;c(u,(h(w)=="function")?new w:w);delete o.prototyping});return u}};c(o,{inherit:function(v,y){var u=arguments.callee.caller;for(var x in y){var w=y[x];var A=v[x];var z=h(w);if(A&&z=="function"){if(w!=A){if(u){w.__parent=A;v[x]=w}else{o.override(v,x,w)}}}else{if(z=="object"){v[x]=r(A,w)}else{v[x]=w}}}if(u){v.parent=function(){return arguments.callee.caller.__parent.apply(this,arguments)}}return v},override:function(v,u,y){var x=o.prototyping;if(x&&v[u]!=x[u]){x=null}var w=function(){var z=this.parent;this.parent=x?x[u]:v[u];var A=y.apply(this,arguments);this.parent=z;return A};v[u]=w}});o.prototype.implement=function(){var u=this.prototype;g(Array.prototype.slice.call(arguments||[]),function(v){o.inherit(u,v)});return this};this.TreeUtil={prune:function(v,u){this.each(v,function(x,w){if(w==u&&x.children){delete x.children;x.children=[]}})},getParent:function(u,y){if(u.id==y){return false}var x=u.children;if(x&&x.length>0){for(var w=0;w<x.length;w++){if(x[w].id==y){return u}else{var v=this.getParent(x[w],y);if(v){return v}}}}return false},getSubtree:function(u,y){if(u.id==y){return u}for(var w=0,x=u.children;w<x.length;w++){var v=this.getSubtree(x[w],y);if(v!=null){return v}}return null},getLeaves:function(w,u){var x=[],v=u||Number.MAX_VALUE;this.each(w,function(z,y){if(y<v&&(!z.children||z.children.length==0)){x.push({node:z,level:v-y})}});return x},eachLevel:function(u,z,w,y){if(z<=w){y(u,z);for(var v=0,x=u.children;v<x.length;v++){this.eachLevel(x[v],z+1,w,y)}}},each:function(u,v){this.eachLevel(u,0,Number.MAX_VALUE,v)},loadSubtrees:function(D,x){var C=x.request&&x.levelsToShow;var y=this.getLeaves(D,C),A=y.length,z={};if(A==0){x.onComplete()}for(var w=0,u=0;w<A;w++){var B=y[w],v=B.node.id;z[v]=B.node;x.request(v,B.level,{onComplete:function(G,E){var F=E.children;z[G].children=F;if(++u==A){x.onComplete()}}})}}};this.Canvas=(function(){var v={injectInto:"id",width:200,height:200,backgroundColor:"#333333",styles:{fillStyle:"#000000",strokeStyle:"#000000"},backgroundCanvas:false};function x(){x.t=x.t||typeof(HTMLCanvasElement);return"function"==x.t||"object"==x.t}function w(z,C,B){var A=document.createElement(z);(function(E,F){if(F){for(var D in F){E[D]=F[D]}}return arguments.callee})(A,C)(A.style,B);if(z=="canvas"&&!x()&&G_vmlCanvasManager){A=G_vmlCanvasManager.initElement(document.body.appendChild(A))}return A}function u(z){return document.getElementById(z)}function y(C,B,A,E){var D=A?(C.width-A):C.width;var z=E?(C.height-E):C.height;B.translate(D/2,z/2)}return function(B,C){var N,G,z,K,D,J;if(arguments.length<1){throw"Arguments missing"}var A=B+"-label",I=B+"-canvas",E=B+"-bkcanvas";C=r(v,C||{});var F={width:C.width,height:C.height};z=w("div",{id:B},r(F,{position:"relative"}));K=w("div",{id:A},{overflow:"visible",position:"absolute",top:0,left:0,width:F.width+"px",height:0});var L={position:"absolute",top:0,left:0,width:F.width+"px",height:F.height+"px"};D=w("canvas",r({id:I},F),L);var H=C.backgroundCanvas;if(H){J=w("canvas",r({id:E},F),L);z.appendChild(J)}z.appendChild(D);z.appendChild(K);u(C.injectInto).appendChild(z);N=D.getContext("2d");y(D,N);var M=C.styles;var O;for(O in M){N[O]=M[O]}if(H){G=J.getContext("2d");M=H.styles;for(O in M){G[O]=M[O]}y(J,G);H.impl.init(J,G);H.impl.plot(J,G)}return{id:B,getCtx:function(){return N},getElement:function(){return z},resize:function(T,P){var S=D.width,U=D.height;D.width=T;D.height=P;D.style.width=T+"px";D.style.height=P+"px";if(H){J.width=T;J.height=P;J.style.width=T+"px";J.style.height=P+"px"}if(!x()){y(D,N,S,U)}else{y(D,N)}var Q=C.styles;var R;for(R in Q){N[R]=Q[R]}if(H){Q=H.styles;for(R in Q){G[R]=Q[R]}if(!x()){y(J,G,S,U)}else{y(J,G)}H.impl.init(J,G);H.impl.plot(J,G)}},getSize:function(){return{width:D.width,height:D.height}},path:function(P,Q){N.beginPath();Q(N);N[P]();N.closePath()},clear:function(){var P=this.getSize();N.clearRect(-P.width/2,-P.height/2,P.width,P.height)},clearRectangle:function(T,R,Q,S){if(!x()){var P=N.fillStyle;N.fillStyle=C.backgroundColor;N.fillRect(S,T,Math.abs(R-S),Math.abs(Q-T));N.fillStyle=P}else{N.clearRect(S,T,Math.abs(R-S),Math.abs(Q-T))}}}}})();this.Polar=function(v,u){this.theta=v;this.rho=u};Polar.prototype={getc:function(u){return this.toComplex(u)},getp:function(){return this},set:function(u){u=u.getp();this.theta=u.theta;this.rho=u.rho},setc:function(u,v){this.rho=Math.sqrt(u*u+v*v);this.theta=Math.atan2(v,u);if(this.theta<0){this.theta+=Math.PI*2}},setp:function(v,u){this.theta=v;this.rho=u},clone:function(){return new Polar(this.theta,this.rho)},toComplex:function(w){var u=Math.cos(this.theta)*this.rho;var v=Math.sin(this.theta)*this.rho;if(w){return{x:u,y:v}}return new Complex(u,v)},add:function(u){return new Polar(this.theta+u.theta,this.rho+u.rho)},scale:function(u){return new Polar(this.theta,this.rho*u)},equals:function(u){return this.theta==u.theta&&this.rho==u.rho},$add:function(u){this.theta=this.theta+u.theta;this.rho+=u.rho;return this},$madd:function(u){this.theta=(this.theta+u.theta)%(Math.PI*2);this.rho+=u.rho;return this},$scale:function(u){this.rho*=u;return this},interpolate:function(w,C){var x=Math.PI,A=x*2;var v=function(D){return(D<0)?(D%A)+A:D%A};var z=this.theta,B=w.theta;var y;if(Math.abs(z-B)>x){if(z>B){y=v((B+((z-A)-B)*C))}else{y=v((B-A+(z-(B-A))*C))}}else{y=v((B+(z-B)*C))}var u=(this.rho-w.rho)*C+w.rho;return{theta:y,rho:u}}};var l=function(v,u){return new Polar(v,u)};Polar.KER=l(0,0);this.Complex=function(u,v){this.x=u;this.y=v};Complex.prototype={getc:function(){return this},getp:function(u){return this.toPolar(u)},set:function(u){u=u.getc(true);this.x=u.x;this.y=u.y},setc:function(u,v){this.x=u;this.y=v},setp:function(v,u){this.x=Math.cos(v)*u;this.y=Math.sin(v)*u},clone:function(){return new Complex(this.x,this.y)},toPolar:function(w){var u=this.norm();var v=Math.atan2(this.y,this.x);if(v<0){v+=Math.PI*2}if(w){return{theta:v,rho:u}}return new Polar(v,u)},norm:function(){return Math.sqrt(this.squaredNorm())},squaredNorm:function(){return this.x*this.x+this.y*this.y},add:function(u){return new Complex(this.x+u.x,this.y+u.y)},prod:function(u){return new Complex(this.x*u.x-this.y*u.y,this.y*u.x+this.x*u.y)},conjugate:function(){return new Complex(this.x,-this.y)},scale:function(u){return new Complex(this.x*u,this.y*u)},equals:function(u){return this.x==u.x&&this.y==u.y},$add:function(u){this.x+=u.x;this.y+=u.y;return this},$prod:function(w){var u=this.x,v=this.y;this.x=u*w.x-v*w.y;this.y=v*w.x+u*w.y;return this},$conjugate:function(){this.y=-this.y;return this},$scale:function(u){this.x*=u;this.y*=u;return this},$div:function(z){var u=this.x,w=this.y;var v=z.squaredNorm();this.x=u*z.x+w*z.y;this.y=w*z.x-u*z.y;return this.$scale(1/v)}};var q=function(v,u){return new Complex(v,u)};Complex.KER=q(0,0);this.Graph=new o({initialize:function(u){var v={complex:false,Node:{}};this.opt=r(v,u||{});this.nodes={}},getNode:function(u){if(this.hasNode(u)){return this.nodes[u]}return false},getAdjacence:function(w,u){var v=[];if(this.hasNode(w)&&this.hasNode(u)&&this.nodes[w].adjacentTo({id:u})&&this.nodes[u].adjacentTo({id:w})){v.push(this.nodes[w].getAdjacency(u));v.push(this.nodes[u].getAdjacency(w));return v}return false},addNode:function(u){if(!this.nodes[u.id]){this.nodes[u.id]=new Graph.Node(c({id:u.id,name:u.name,data:u.data},this.opt.Node),this.opt.complex)}return this.nodes[u.id]},addAdjacence:function(x,w,v){var y=[];if(!this.hasNode(x.id)){this.addNode(x)}if(!this.hasNode(w.id)){this.addNode(w)}x=this.nodes[x.id];w=this.nodes[w.id];for(var u in this.nodes){if(this.nodes[u].id==x.id){if(!this.nodes[u].adjacentTo(w)){y.push(this.nodes[u].addAdjacency(w,v))}}if(this.nodes[u].id==w.id){if(!this.nodes[u].adjacentTo(x)){y.push(this.nodes[u].addAdjacency(x,v))}}}return y},removeNode:function(w){if(this.hasNode(w)){var v=this.nodes[w];for(var u=0 in v.adjacencies){var adj=v.adjacencies[u];this.removeAdjacence(w,adj.nodeTo.id)}delete this.nodes[w]}},removeAdjacence:function(y,x){if(this.hasNode(y)){this.nodes[y].removeAdjacency(x)}if(this.hasNode(x)){this.nodes[x].removeAdjacency(y)}},hasNode:function(x){return x in this.nodes}});Graph.Node=new o({initialize:function(x,z){var y={id:"",name:"",data:{},adjacencies:{},selected:false,drawn:false,exist:false,angleSpan:{begin:0,end:0},alpha:1,startAlpha:1,endAlpha:1,pos:(z&&q(0,0))||l(0,0),startPos:(z&&q(0,0))||l(0,0),endPos:(z&&q(0,0))||l(0,0)};c(this,c(y,x))},adjacentTo:function(x){return x.id in this.adjacencies},getAdjacency:function(x){return this.adjacencies[x]},addAdjacency:function(y,z){var x=new Graph.Adjacence(this,y,z);return this.adjacencies[y.id]=x},removeAdjacency:function(x){delete this.adjacencies[x]}});Graph.Adjacence=function(x,z,y){this.nodeFrom=x;this.nodeTo=z;this.data=y||{};this.alpha=1;this.startAlpha=1;this.endAlpha=1};Graph.Util={filter:function(y){if(!y||!(h(y)=="string")){return function(){return true}}var x=y.split(" ");return function(A){for(var z=0;z<x.length;z++){if(A[x[z]]){return false}}return true}},getNode:function(x,y){return x.getNode(y)},eachNode:function(B,A,x){var z=this.filter(x);for(var y in B.nodes){if(z(B.nodes[y])){A(B.nodes[y])}}},eachAdjacency:function(A,B,x){var y=A.adjacencies,z=this.filter(x);for(var C in y){if(z(y[C])){B(y[C],C)}}},computeLevels:function(D,E,A,z){A=A||0;var B=this.filter(z);this.eachNode(D,function(F){F._flag=false;F._depth=-1},z);var y=D.getNode(E);y._depth=A;var x=[y];while(x.length!=0){var C=x.pop();C._flag=true;this.eachAdjacency(C,function(F){var G=F.nodeTo;if(G._flag==false&&B(G)){if(G._depth<0){G._depth=C._depth+1+A}x.unshift(G)}},z)}},eachBFS:function(C,D,B,y){var z=this.filter(y);this.clean(C);var x=[C.getNode(D)];while(x.length!=0){var A=x.pop();A._flag=true;B(A,A._depth);this.eachAdjacency(A,function(E){var F=E.nodeTo;if(F._flag==false&&z(F)){F._flag=true;x.unshift(F)}},y)}},eachLevel:function(B,F,y,C,A){var E=B._depth,x=this.filter(A),D=this;y=y===false?Number.MAX_VALUE-E:y;(function z(I,G,H){var J=I._depth;if(J>=G&&J<=H&&x(I)){C(I,J)}if(J<H){D.eachAdjacency(I,function(K){var L=K.nodeTo;if(L._depth>J){z(L,G,H)}})}})(B,F+E,y+E)},eachSubgraph:function(y,z,x){this.eachLevel(y,0,false,z,x)},eachSubnode:function(y,z,x){this.eachLevel(y,1,1,z,x)},anySubnode:function(A,z,y){var x=false;z=z||m(true);var B=h(z)=="string"?function(C){return C[z]}:z;this.eachSubnode(A,function(C){if(B(C)){x=true}},y);return x},getSubnodes:function(C,D,x){var z=[],B=this;D=D||0;var A,y;if(h(D)=="array"){A=D[0];y=D[1]}else{A=D;y=Number.MAX_VALUE-C._depth}this.eachLevel(C,A,y,function(E){z.push(E)},x);return z},getParents:function(y){var x=[];this.eachAdjacency(y,function(z){var A=z.nodeTo;if(A._depth<y._depth){x.push(A)}});return x},isDescendantOf:function(A,B){if(A.id==B){return true}var z=this.getParents(A),x=false;for(var y=0;!x&&y<z.length;y++){x=x||this.isDescendantOf(z[y],B)}return x},clean:function(x){this.eachNode(x,function(y){y._flag=false})}};Graph.Op={options:{type:"nothing",duration:2000,hideLabels:true,fps:30},removeNode:function(C,A){var x=this.viz;var y=r(this.options,x.controller,A);var E=j(C);var z,B,D;switch(y.type){case"nothing":for(z=0;z<E.length;z++){x.graph.removeNode(E[z])}break;case"replot":this.removeNode(E,{type:"nothing"});x.fx.clearLabels();x.refresh(true);break;case"fade:seq":case"fade":B=this;for(z=0;z<E.length;z++){D=x.graph.getNode(E[z]);D.endAlpha=0}x.fx.animate(r(y,{modes:["fade:nodes"],onComplete:function(){B.removeNode(E,{type:"nothing"});x.fx.clearLabels();x.reposition();x.fx.animate(r(y,{modes:["linear"]}))}}));break;case"fade:con":B=this;for(z=0;z<E.length;z++){D=x.graph.getNode(E[z]);D.endAlpha=0;D.ignore=true}x.reposition();x.fx.animate(r(y,{modes:["fade:nodes","linear"],onComplete:function(){B.removeNode(E,{type:"nothing"})}}));break;case"iter":B=this;x.fx.sequence({condition:function(){return E.length!=0},step:function(){B.removeNode(E.shift(),{type:"nothing"});x.fx.clearLabels()},onComplete:function(){y.onComplete()},duration:Math.ceil(y.duration/E.length)});break;default:this.doError()}},removeEdge:function(D,B){var x=this.viz;var z=r(this.options,x.controller,B);var y=(h(D[0])=="string")?[D]:D;var A,C,E;switch(z.type){case"nothing":for(A=0;A<y.length;A++){x.graph.removeAdjacence(y[A][0],y[A][1])}break;case"replot":this.removeEdge(y,{type:"nothing"});x.refresh(true);break;case"fade:seq":case"fade":C=this;for(A=0;A<y.length;A++){E=x.graph.getAdjacence(y[A][0],y[A][1]);if(E){E[0].endAlpha=0;E[1].endAlpha=0}}x.fx.animate(r(z,{modes:["fade:vertex"],onComplete:function(){C.removeEdge(y,{type:"nothing"});x.reposition();x.fx.animate(r(z,{modes:["linear"]}))}}));break;case"fade:con":C=this;for(A=0;A<y.length;A++){E=x.graph.getAdjacence(y[A][0],y[A][1]);if(E){E[0].endAlpha=0;E[0].ignore=true;E[1].endAlpha=0;E[1].ignore=true}}x.reposition();x.fx.animate(r(z,{modes:["fade:vertex","linear"],onComplete:function(){C.removeEdge(y,{type:"nothing"})}}));break;case"iter":C=this;x.fx.sequence({condition:function(){return y.length!=0},step:function(){C.removeEdge(y.shift(),{type:"nothing"});x.fx.clearLabels()},onComplete:function(){z.onComplete()},duration:Math.ceil(z.duration/y.length)});break;default:this.doError()}},sum:function(E,y){var C=this.viz;var F=r(this.options,C.controller,y),B=C.root;var A,D;C.root=y.id||C.root;switch(F.type){case"nothing":D=C.construct(E);A=Graph.Util;A.eachNode(D,function(G){A.eachAdjacency(G,function(H){C.graph.addAdjacence(H.nodeFrom,H.nodeTo,H.data)})});break;case"replot":C.refresh(true);this.sum(E,{type:"nothing"});C.refresh(true);break;case"fade:seq":case"fade":case"fade:con":A=Graph.Util;that=this;D=C.construct(E);var x=this.preprocessSum(D);var z=!x?["fade:nodes"]:["fade:nodes","fade:vertex"];C.reposition();if(F.type!="fade:con"){C.fx.animate(r(F,{modes:["linear"],onComplete:function(){C.fx.animate(r(F,{modes:z,onComplete:function(){F.onComplete()}}))}}))}else{A.eachNode(C.graph,function(G){if(G.id!=B&&G.pos.getp().equals(Polar.KER)){G.pos.set(G.endPos);G.startPos.set(G.endPos)}});C.fx.animate(r(F,{modes:["linear"].concat(z)}))}break;default:this.doError()}},morph:function(E,y){var C=this.viz;var F=r(this.options,C.controller,y),B=C.root;var A,D;C.root=y.id||C.root;switch(F.type){case"nothing":D=C.construct(E);A=Graph.Util;A.eachNode(D,function(G){A.eachAdjacency(G,function(H){C.graph.addAdjacence(H.nodeFrom,H.nodeTo,H.data)})});A.eachNode(C.graph,function(G){A.eachAdjacency(G,function(H){if(!D.getAdjacence(H.nodeFrom.id,H.nodeTo.id)){C.graph.removeAdjacence(H.nodeFrom.id,H.nodeTo.id)}});if(!D.hasNode(G.id)){C.graph.removeNode(G.id)}});break;case"replot":C.fx.clearLabels(true);this.morph(E,{type:"nothing"});C.refresh(true);C.refresh(true);break;case"fade:seq":case"fade":case"fade:con":A=Graph.Util;that=this;D=C.construct(E);var x=this.preprocessSum(D);A.eachNode(C.graph,function(G){if(!D.hasNode(G.id)){G.alpha=1;G.startAlpha=1;G.endAlpha=0;G.ignore=true}});A.eachNode(C.graph,function(G){if(G.ignore){return}A.eachAdjacency(G,function(H){if(H.nodeFrom.ignore||H.nodeTo.ignore){return}var I=D.getNode(H.nodeFrom.id);var J=D.getNode(H.nodeTo.id);if(!I.adjacentTo(J)){var K=C.graph.getAdjacence(I.id,J.id);x=true;K[0].alpha=1;K[0].startAlpha=1;K[0].endAlpha=0;K[0].ignore=true;K[1].alpha=1;K[1].startAlpha=1;K[1].endAlpha=0;K[1].ignore=true}})});var z=!x?["fade:nodes"]:["fade:nodes","fade:vertex"];C.reposition();A.eachNode(C.graph,function(G){if(G.id!=B&&G.pos.getp().equals(Polar.KER)){G.pos.set(G.endPos);G.startPos.set(G.endPos)}});C.fx.animate(r(F,{modes:["polar"].concat(z),onComplete:function(){A.eachNode(C.graph,function(G){if(G.ignore){C.graph.removeNode(G.id)}});A.eachNode(C.graph,function(G){A.eachAdjacency(G,function(H){if(H.ignore){C.graph.removeAdjacence(H.nodeFrom.id,H.nodeTo.id)}})});F.onComplete()}}));break;default:this.doError()}},preprocessSum:function(z){var x=this.viz;var y=Graph.Util;y.eachNode(z,function(B){if(!x.graph.hasNode(B.id)){x.graph.addNode(B);var C=x.graph.getNode(B.id);C.alpha=0;C.startAlpha=0;C.endAlpha=1}});var A=false;y.eachNode(z,function(B){y.eachAdjacency(B,function(C){var D=x.graph.getNode(C.nodeFrom.id);var E=x.graph.getNode(C.nodeTo.id);if(!D.adjacentTo(E)){var F=x.graph.addAdjacence(D,E,C.data);if(D.startAlpha==D.endAlpha&&E.startAlpha==E.endAlpha){A=true;F[0].alpha=0;F[0].startAlpha=0;F[0].endAlpha=1;F[1].alpha=0;F[1].startAlpha=0;F[1].endAlpha=1}}})});return A}};Graph.Plot={Interpolator:{moebius:function(C,E,A){if(E<=1||A.norm()<=1){var z=A.x,D=A.y;var B=C.startPos.getc().moebiusTransformation(A);C.pos.setc(B.x,B.y);A.x=z;A.y=D}},linear:function(x,A){var z=x.startPos.getc(true);var y=x.endPos.getc(true);x.pos.setc((y.x-z.x)*A+z.x,(y.y-z.y)*A+z.y)},"fade:nodes":function(x,A){if(A<=1&&(x.endAlpha!=x.alpha)){var z=x.startAlpha;var y=x.endAlpha;x.alpha=z+(y-z)*A}},"fade:vertex":function(x,A){var z=x.adjacencies;for(var y in z){this["fade:nodes"](z[y],A)}},polar:function(y,B){var A=y.startPos.getp(true);var z=y.endPos.getp();var x=z.interpolate(A,B);y.pos.setp(x.theta,x.rho)}},labelsHidden:false,labelContainer:false,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(x){return(x in this.labels&&this.labels[x]!=null)?this.labels[x]:this.labels[x]=document.getElementById(x)},hideLabels:function(y){var x=this.getLabelContainer();if(y){x.style.display="none"}else{x.style.display=""}this.labelsHidden=y},clearLabels:function(x){for(var y in this.labels){if(x||!this.viz.graph.hasNode(y)){this.disposeLabel(y);delete this.labels[y]}}},disposeLabel:function(y){var x=this.getLabel(y);if(x&&x.parentNode){x.parentNode.removeChild(x)}},hideLabel:function(B,x){B=j(B);var y=x?"":"none",z,A=this;g(B,function(D){var C=A.getLabel(D.id);if(C){C.style.display=y}})},sequence:function(y){var z=this;y=r({condition:m(false),step:b,onComplete:b,duration:200},y||{});var x=setInterval(function(){if(y.condition()){y.step()}else{clearInterval(x);y.onComplete()}z.viz.refresh(true)},y.duration)},animate:function(z,y){var B=this,x=this.viz,C=x.graph,A=Graph.Util;z=r(x.controller,z||{});if(z.hideLabels){this.hideLabels(true)}this.animation.setOptions(r(z,{$animating:false,compute:function(E){var D=y?y.scale(-E):null;A.eachNode(C,function(G){for(var F=0;F<z.modes.length;F++){B.Interpolator[z.modes[F]](G,E,D)}});B.plot(z,this.$animating);this.$animating=true},complete:function(){A.eachNode(C,function(D){D.startPos.set(D.pos);D.startAlpha=D.alpha});if(z.hideLabels){B.hideLabels(false)}B.plot(z);z.onComplete();z.onAfterCompute()}})).start()},plot:function(y,G){var E=this.viz,B=E.graph,z=E.canvas,x=E.root,C=this,F=z.getCtx(),D=Graph.Util;y=y||this.viz.controller;y.clearCanvas&&z.clear();var A=!!B.getNode(x).visited;D.eachNode(B,function(H){D.eachAdjacency(H,function(I){var J=I.nodeTo;if(!!J.visited===A&&H.drawn&&J.drawn){!G&&y.onBeforePlotLine(I);F.save();F.globalAlpha=Math.min(Math.min(H.alpha,J.alpha),I.alpha);C.plotLine(I,z,G);F.restore();!G&&y.onAfterPlotLine(I)}});F.save();if(H.drawn){F.globalAlpha=H.alpha;!G&&y.onBeforePlotNode(H);C.plotNode(H,z,G);!G&&y.onAfterPlotNode(H)}if(!C.labelsHidden&&y.withLabels){if(H.drawn&&F.globalAlpha>=0.95){C.plotLabel(z,H,y)}else{C.hideLabel(H,false)}}F.restore();H.visited=!A})},plotLabel:function(A,B,z){var C=B.id,x=this.getLabel(C);if(!x&&!(x=document.getElementById(C))){x=document.createElement("div");var y=this.getLabelContainer();y.appendChild(x);x.id=C;x.className="node";x.style.position="absolute";z.onCreateLabel(x,B);this.labels[B.id]=x}this.placeLabel(x,B,z)},plotNode:function(z,y,G){var E=this.node,B=z.data;var D=E.overridable&&B;var x=D&&B.$lineWidth||E.lineWidth;var A=D&&B.$color||E.color;var F=y.getCtx();F.lineWidth=x;F.fillStyle=A;F.strokeStyle=A;var C=z.data&&z.data.$type||E.type;this.nodeTypes[C].call(this,z,y,G)},plotLine:function(E,z,G){var x=this.edge,B=E.data;var D=x.overridable&&B;var y=D&&B.$lineWidth||x.lineWidth;var A=D&&B.$color||x.color;var F=z.getCtx();F.lineWidth=y;F.fillStyle=A;F.strokeStyle=A;var C=E.data&&E.data.$type||x.type;this.edgeTypes[C].call(this,E,z,G)},fitsInCanvas:function(z,x){var y=x.getSize();if(z.x>=y.width||z.x<0||z.y>=y.height||z.y<0){return false}return true}};var Loader={construct:function(y){var z=(h(y)=="array");var x=new Graph(this.graphOptions);if(!z){(function(A,C){A.addNode(C);for(var B=0,D=C.children;B<D.length;B++){A.addAdjacence(C,D[B]);arguments.callee(A,D[B])}})(x,y)}else{(function(B,E){var H=function(J){for(var I=0;I<E.length;I++){if(E[I].id==J){return E[I]}}return undefined};for(var D=0;D<E.length;D++){B.addNode(E[D]);for(var C=0,A=E[D].adjacencies;C<A.length;C++){var F=A[C],G;if(typeof A[C]!="string"){G=F.data;F=F.nodeTo}B.addAdjacence(E[D],H(F),G)}}})(x,y)}return x},loadJSON:function(y,x){this.json=y;this.graph=this.construct(y);if(h(y)!="array"){this.root=y.id}else{this.root=y[x?x:0].id}}};this.Trans={linear:function(x){return x}};(function(){var x=function(A,z){z=j(z);return c(A,{easeIn:function(B){return A(B,z)},easeOut:function(B){return 1-A(1-B,z)},easeInOut:function(B){return(B<=0.5)?A(2*B,z)/2:(2-A(2*(1-B),z))/2}})};var y={Pow:function(A,z){return Math.pow(A,z[0]||6)},Expo:function(z){return Math.pow(2,8*(z-1))},Circ:function(z){return 1-Math.sin(Math.acos(z))},Sine:function(z){return 1-Math.sin((1-z)*Math.PI/2)},Back:function(A,z){z=z[0]||1.618;return Math.pow(A,2)*((z+1)*A-z)},Bounce:function(C){var B;for(var A=0,z=1;1;A+=z,z/=2){if(C>=(7-4*A)/11){B=z*z-Math.pow((11-6*A-11*C)/4,2);break}}return B},Elastic:function(A,z){return Math.pow(2,10*--A)*Math.cos(20*A*Math.PI*(z[0]||1)/3)}};g(y,function(A,z){Trans[z]=x(A)});g(["Quad","Cubic","Quart","Quint"],function(A,z){Trans[A]=x(function(B){return Math.pow(B,[z+2])})})})();var Animation=new o({initalize:function(x){this.setOptions(x)},setOptions:function(x){var y={duration:2500,fps:40,transition:Trans.Quart.easeInOut,compute:b,complete:b};this.opt=r(y,x||{});return this},getTime:function(){return k()},step:function(){var y=this.getTime(),x=this.opt;if(y<this.time+x.duration){var z=x.transition((y-this.time)/x.duration);x.compute(z)}else{this.timer=clearInterval(this.timer);x.compute(1);x.complete()}},start:function(){this.time=0;this.startTimer();return this},startTimer:function(){var y=this,x=this.opt;if(this.timer){return false}this.time=this.getTime()-this.time;this.timer=setInterval((function(){y.step()}),Math.round(1000/x.fps));return true}});(function(){var G=Array.prototype.slice;function E(Q,K,I,O){var M=K.Node,N=Graph.Util;var J=K.multitree;if(M.overridable){var P=-1,L=-1;N.eachNode(Q,function(T){if(T._depth==I&&(!J||("$orn" in T.data)&&T.data.$orn==O)){var R=T.data.$width||M.width;var S=T.data.$height||M.height;P=(P<R)?R:P;L=(L<S)?S:L}});return{width:P<0?M.width:P,height:L<0?M.height:L}}else{return M}}function H(J,M,L,I){var K=(I=="left"||I=="right")?"y":"x";J[M][K]+=L}function C(J,K){var I=[];g(J,function(L){L=G.call(L);L[0]+=K;L[1]+=K;I.push(L)});return I}function F(L,I){if(L.length==0){return I}if(I.length==0){return L}var K=L.shift(),J=I.shift();return[[K[0],J[1]]].concat(F(L,I))}function A(I,J){J=J||[];if(I.length==0){return J}var K=I.pop();return A(I,F(K,J))}function D(L,J,M,I,K){if(L.length<=K||J.length<=K){return 0}var O=L[K][1],N=J[K][0];return Math.max(D(L,J,M,I,++K)+M,O-N+I)}function B(L,J,I){function K(O,Q,N){if(Q.length<=N){return[]}var P=Q[N],M=D(O,P,J,I,0);return[M].concat(K(F(O,C(P,M)),Q,++N))}return K([],L,0)}function y(M,L,K){function I(P,R,O){if(R.length<=O){return[]}var Q=R[O],N=-D(Q,P,L,K,0);return[N].concat(I(F(C(Q,N),P),R,++O))}M=G.call(M);var J=I([],M.reverse(),0);return J.reverse()}function x(O,M,J,P){var K=B(O,M,J),N=y(O,M,J);if(P=="left"){N=K}else{if(P=="right"){K=N}}for(var L=0,I=[];L<K.length;L++){I[L]=(K[L]+N[L])/2}return I}function z(J,T,K,aa,Y){var M=aa.multitree;var S=["x","y"],P=["width","height"];var L=+(Y=="left"||Y=="right");var Q=S[L],Z=S[1-L];var V=aa.Node;var O=P[L],X=P[1-L];var N=aa.siblingOffset;var W=aa.subtreeOffset;var U=aa.align;var I=Graph.Util;function R(ad,ah,al){var ac=(V.overridable&&ad.data["$"+O])||V[O];var ak=ah||((V.overridable&&ad.data["$"+X])||V[X]);var ao=[],am=[],ai=false;var ab=ak+aa.levelDistance;I.eachSubnode(ad,function(aq){if(aq.exist&&(!M||("$orn" in aq.data)&&aq.data.$orn==Y)){if(!ai){ai=E(J,aa,aq._depth,Y)}var ap=R(aq,ai[X],al+ab);ao.push(ap.tree);am.push(ap.extent)}});var ag=x(am,W,N,U);for(var af=0,ae=[],aj=[];af<ao.length;af++){H(ao[af],K,ag[af],Y);aj.push(C(am[af],ag[af]))}var an=[[-ac/2,ac/2]].concat(A(aj));ad[K][Q]=0;if(Y=="top"||Y=="left"){ad[K][Z]=al}else{ad[K][Z]=-al}return{tree:ad,extent:an}}R(T,false,0)}this.ST=(function(){var J=[];function K(P){P=P||this.clickedNode;var M=this.geom,T=Graph.Util;var U=this.graph;var N=this.canvas;var L=P._depth,Q=[];T.eachNode(U,function(V){if(V.exist&&!V.selected){if(T.isDescendantOf(V,P.id)){if(V._depth<=L){Q.push(V)}}else{Q.push(V)}}});var R=M.getRightLevelToShow(P,N);T.eachLevel(P,R,R,function(V){if(V.exist&&!V.selected){Q.push(V)}});for(var S=0;S<J.length;S++){var O=this.graph.getNode(J[S]);if(!T.isDescendantOf(O,P.id)){Q.push(O)}}return Q}function I(O){var N=[],M=Graph.Util,L=this.config;O=O||this.clickedNode;M.eachLevel(this.clickedNode,0,L.levelsToShow,function(P){if(L.multitree&&!("$orn" in P.data)&&M.anySubnode(P,function(Q){return Q.exist&&!Q.drawn})){N.push(P)}else{if(P.drawn&&!M.anySubnode(P,"drawn")){N.push(P)}}});return N}return new o({Implements:Loader,initialize:function(O,L){var M={onBeforeCompute:b,onAfterCompute:b,onCreateLabel:b,onPlaceLabel:b,onComplete:b,onBeforePlotNode:b,onAfterPlotNode:b,onBeforePlotLine:b,onAfterPlotLine:b,request:false};var N={orientation:"left",labelContainer:O.id+"-label",levelsToShow:2,subtreeOffset:8,siblingOffset:5,levelDistance:30,withLabels:true,clearCanvas:true,align:"center",indent:10,multitree:false,constrained:true,Node:{overridable:false,type:"rectangle",color:"#ccb",lineWidth:1,height:20,width:90,dim:15,align:"center"},Edge:{overridable:false,type:"line",color:"#ccc",dim:15,lineWidth:1},duration:700,fps:25,transition:Trans.Quart.easeInOut};this.controller=this.config=r(N,M,L);this.canvas=O;this.graphOptions={complex:true};this.graph=new Graph(this.graphOptions);this.fx=new ST.Plot(this);this.op=new ST.Op(this);this.group=new ST.Group(this);this.geom=new ST.Geom(this);this.clickedNode=null},plot:function(){this.fx.plot(this.controller)},switchPosition:function(Q,P,O){var L=this.geom,M=this.fx,N=this;if(!M.busy){M.busy=true;this.contract({onComplete:function(){L.switchOrientation(Q);N.compute("endPos",false);M.busy=false;if(P=="animate"){N.onClick(N.clickedNode.id,O)}else{if(P=="replot"){N.select(N.clickedNode.id,O)}}}},Q)}},switchAlignment:function(N,M,L){this.config.align=N;if(M=="animate"){this.select(this.clickedNode.id,L)}else{if(M=="replot"){this.onClick(this.clickedNode.id,L)}}},addNodeInPath:function(L){J.push(L);this.select((this.clickedNode&&this.clickedNode.id)||this.root)},clearNodesInPath:function(L){J.length=0;this.select((this.clickedNode&&this.clickedNode.id)||this.root)},refresh:function(){this.reposition();this.select((this.clickedNode&&this.clickedNode.id)||this.root)},reposition:function(){Graph.Util.computeLevels(this.graph,this.root,0,"ignore");this.geom.setRightLevelToShow(this.clickedNode,this.canvas);Graph.Util.eachNode(this.graph,function(L){if(L.exist){L.drawn=true}});this.compute("endPos")},compute:function(N,M){var O=N||"startPos";var L=this.graph.getNode(this.root);c(L,{drawn:true,exist:true,selected:true});if(!!M||!("_depth" in L)){Graph.Util.computeLevels(this.graph,this.root,0,"ignore")}this.computePositions(L,O)},computePositions:function(P,L){var N=this.config;var M=N.multitree;var S=N.align;var O=S!=="center"&&N.indent;var T=N.orientation;var R=M?["top","right","bottom","left"]:[T];var Q=this;g(R,function(U){z(Q.graph,P,L,Q.config,U);var V=["x","y"][+(U=="left"||U=="right")];(function W(X){Graph.Util.eachSubnode(X,function(Y){if(Y.exist&&(!M||("$orn" in Y.data)&&Y.data.$orn==U)){Y[L][V]+=X[L][V];if(O){Y[L][V]+=S=="left"?O:-O}W(Y)}})})(P)})},requestNodes:function(O,P){var M=r(this.controller,P),L=this.config.levelsToShow,N=Graph.Util;if(M.request){var R=[],Q=O._depth;N.eachLevel(O,0,L,function(S){if(S.drawn&&!N.anySubnode(S)){R.push(S);S._level=L-(S._depth-Q)}});this.group.requestNodes(R,M)}else{M.onComplete()}},contract:function(P,Q){var O=this.config.orientation;var L=this.geom,N=this.group;if(Q){L.switchOrientation(Q)}var M=K.call(this);if(Q){L.switchOrientation(O)}N.contract(M,r(this.controller,P))},move:function(M,N){this.compute("endPos",false);var L=N.Move,O={x:L.offsetX,y:L.offsetY};if(L.enable){this.geom.translate(M.endPos.add(O).$scale(-1),"endPos")}this.fx.animate(r(this.controller,{modes:["linear"]},N))},expand:function(M,N){var L=I.call(this,M);this.group.expand(L,r(this.controller,N))},selectPath:function(P){var O=Graph.Util,N=this;O.eachNode(this.graph,function(R){R.selected=false});function Q(S){if(S==null||S.selected){return}S.selected=true;g(N.group.getSiblings([S])[S.id],function(T){T.exist=true;T.drawn=true});var R=O.getParents(S);R=(R.length>0)?R[0]:null;Q(R)}for(var L=0,M=[P.id].concat(J);L<M.length;L++){Q(this.graph.getNode(M[L]))}},setRoot:function(S,R,Q){var P=this,N=this.canvas;var L=this.graph.getNode(this.root);var M=this.graph.getNode(S);function O(){if(this.config.multitree&&M.data.$orn){var U=M.data.$orn;var V={left:"right",right:"left",top:"bottom",bottom:"top"}[U];L.data.$orn=V;(function T(W){Graph.Util.eachSubnode(W,function(X){if(X.id!=S){X.data.$orn=V;T(X)}})})(L);delete M.data.$orn}this.root=S;this.clickedNode=M;Graph.Util.computeLevels(this.graph,this.root,0,"ignore")}delete L.data.$orns;if(R=="animate"){this.onClick(S,{onBeforeMove:function(){O.call(P);P.selectPath(M)}})}else{if(R=="replot"){O.call(this);this.select(this.root)}}},addSubtree:function(L,N,M){if(N=="replot"){this.op.sum(L,c({type:"replot"},M||{}))}else{if(N=="animate"){this.op.sum(L,c({type:"fade:seq"},M||{}))}}},removeSubtree:function(Q,M,P,O){var N=this.graph.getNode(Q),L=[];Graph.Util.eachLevel(N,+!M,false,function(R){L.push(R.id)});if(P=="replot"){this.op.removeNode(L,c({type:"replot"},O||{}))}else{if(P=="animate"){this.op.removeNode(L,c({type:"fade:seq"},O||{}))}}},select:function(L,O){var T=this.group,R=this.geom;var P=this.graph.getNode(L),N=this.canvas;var S=this.graph.getNode(this.root);var M=r(this.controller,O);var Q=this;M.onBeforeCompute(P);this.selectPath(P);this.clickedNode=P;this.requestNodes(P,{onComplete:function(){T.hide(T.prepare(K.call(Q)),M);R.setRightLevelToShow(P,N);Q.compute("pos");Graph.Util.eachNode(Q.graph,function(V){var U=V.pos.getc(true);V.startPos.setc(U.x,U.y);V.endPos.setc(U.x,U.y);V.visited=false});Q.geom.translate(P.endPos.scale(-1),["pos","startPos","endPos"]);T.show(I.call(Q));Q.plot();M.onAfterCompute(Q.clickedNode);M.onComplete()}})},onClick:function(N,U){var O=this.canvas,S=this,R=this.fx,T=Graph.Util,L=this.geom;var Q={Move:{enable:true,offsetX:0,offsetY:0},onBeforeRequest:b,onBeforeContract:b,onBeforeMove:b,onBeforeExpand:b};var M=r(this.controller,Q,U);if(!this.busy){this.busy=true;var P=this.graph.getNode(N);this.selectPath(P,this.clickedNode);this.clickedNode=P;M.onBeforeCompute(P);M.onBeforeRequest(P);this.requestNodes(P,{onComplete:function(){M.onBeforeContract(P);S.contract({onComplete:function(){L.setRightLevelToShow(P,O);M.onBeforeMove(P);S.move(P,{Move:M.Move,onComplete:function(){M.onBeforeExpand(P);S.expand(P,{onComplete:function(){S.busy=false;M.onAfterCompute(N);M.onComplete()}})}})}})}})}}})})();ST.Op=new o({Implements:Graph.Op,initialize:function(I){this.viz=I}});ST.Group=new o({initialize:function(I){this.viz=I;this.canvas=I.canvas;this.config=I.config;this.animation=new Animation;this.nodes=null},requestNodes:function(N,M){var L=0,J=N.length,P={};var K=function(){M.onComplete()};var I=this.viz;if(J==0){K()}for(var O=0;O<J;O++){P[N[O].id]=N[O];M.request(N[O].id,N[O]._level,{onComplete:function(R,Q){if(Q&&Q.children){Q.id=R;I.op.sum(Q,{type:"nothing"})}if(++L==J){Graph.Util.computeLevels(I.graph,I.root,0);K()}}})}},contract:function(K,J){var M=Graph.Util;var I=this.viz;var L=this;K=this.prepare(K);this.animation.setOptions(r(J,{$animating:false,compute:function(N){if(N==1){N=0.99}L.plotStep(1-N,J,this.$animating);this.$animating="contract"},complete:function(){L.hide(K,J)}})).start()},hide:function(K,J){var N=Graph.Util,I=this.viz;for(var L=0;L<K.length;L++){if(true||!J||!J.request){N.eachLevel(K[L],1,false,function(O){if(O.exist){c(O,{drawn:false,exist:false})}})}else{var M=[];N.eachLevel(K[L],1,false,function(O){M.push(O.id)});I.op.removeNode(M,{type:"nothing"});I.fx.clearLabels()}}J.onComplete()},expand:function(J,I){var L=this,K=Graph.Util;this.show(J);this.animation.setOptions(r(I,{$animating:false,compute:function(M){L.plotStep(M,I,this.$animating);this.$animating="expand"},complete:function(){L.plotStep(undefined,I,false);I.onComplete()}})).start()},show:function(I){var K=Graph.Util,J=this.config;this.prepare(I);g(I,function(M){if(J.multitree&&!("$orn" in M.data)){delete M.data.$orns;var L=" ";K.eachSubnode(M,function(N){if(("$orn" in N.data)&&L.indexOf(N.data.$orn)<0&&N.exist&&!N.drawn){L+=N.data.$orn+" "}});M.data.$orns=L}K.eachLevel(M,0,J.levelsToShow,function(N){if(N.exist){N.drawn=true}})})},prepare:function(I){this.nodes=this.getNodesWithChildren(I);return this.nodes},getNodesWithChildren:function(K){var J=[],O=Graph.Util,M=this.config,I=this.viz.root;K.sort(function(R,Q){return(R._depth<=Q._depth)-(R._depth>=Q._depth)});for(var N=0;N<K.length;N++){if(O.anySubnode(K[N],"exist")){for(var L=N+1,P=false;!P&&L<K.length;L++){if(!M.multitree||"$orn" in K[L].data){P=P||O.isDescendantOf(K[N],K[L].id)}}if(!P){J.push(K[N])}}}return J},plotStep:function(T,O,V){var S=this.viz,L=this.config,K=S.canvas,U=K.getCtx(),I=this.nodes,Q=Graph.Util;var N,M;var J={};for(N=0;N<I.length;N++){M=I[N];J[M.id]=[];var R=L.multitree&&!("$orn" in M.data);var P=R&&M.data.$orns;Q.eachSubgraph(M,function(W){if(R&&P&&P.indexOf(W.data.$orn)>0&&W.drawn){W.drawn=false;J[M.id].push(W)}else{if((!R||!P)&&W.drawn){W.drawn=false;J[M.id].push(W)}}});M.drawn=true}if(I.length>0){S.fx.plot()}for(N in J){g(J[N],function(W){W.drawn=true})}for(N=0;N<I.length;N++){M=I[N];U.save();S.fx.plotSubtree(M,O,T,V);U.restore()}},getSiblings:function(I){var K={},J=Graph.Util;g(I,function(N){var M=J.getParents(N);if(M.length==0){K[N.id]=[N]}else{var L=[];J.eachSubnode(M[0],function(O){L.push(O)});K[N.id]=L}});return K}});ST.Geom=new o({initialize:function(I){this.viz=I;this.config=I.config;this.node=I.config.Node;this.edge=I.config.Edge},translate:function(J,I){I=j(I);Graph.Util.eachNode(this.viz.graph,function(K){g(I,function(L){K[L].$add(J)})})},switchOrientation:function(I){this.config.orientation=I},dispatch:function(){var J=Array.prototype.slice.call(arguments);var K=J.shift(),I=J.length;var L=function(M){return typeof M=="function"?M():M};if(I==2){return(K=="top"||K=="bottom")?L(J[0]):L(J[1])}else{if(I==4){switch(K){case"top":return L(J[0]);case"right":return L(J[1]);case"bottom":return L(J[2]);case"left":return L(J[3])}}}return undefined},getSize:function(J,I){var L=this.node,M=J.data,K=this.config;var O=L.overridable,P=K.siblingOffset;var R=(this.config.multitree&&("$orn" in J.data)&&J.data.$orn)||this.config.orientation;var Q=(O&&M.$width||L.width)+P;var N=(O&&M.$height||L.height)+P;if(!I){return this.dispatch(R,N,Q)}else{return this.dispatch(R,Q,N)}},getTreeBaseSize:function(M,N,J){var K=this.getSize(M,true),I=0,L=this;if(J(N,M)){return K}if(N===0){return 0}Graph.Util.eachSubnode(M,function(O){I+=L.getTreeBaseSize(O,N-1,J)});return(K>I?K:I)+this.config.subtreeOffset},getEdge:function(I,N,Q){var M=function(S,R){return function(){return I.pos.add(new Complex(S,R))}};var L=this.node;var O=this.node.overridable,J=I.data;var P=O&&J.$width||L.width;var K=O&&J.$height||L.height;if(N=="begin"){if(L.align=="center"){return this.dispatch(Q,M(0,K/2),M(-P/2,0),M(0,-K/2),M(P/2,0))}else{if(L.align=="left"){return this.dispatch(Q,M(0,K),M(0,0),M(0,0),M(P,0))}else{if(L.align=="right"){return this.dispatch(Q,M(0,0),M(-P,0),M(0,-K),M(0,0))}else{throw"align: not implemented"}}}}else{if(N=="end"){if(L.align=="center"){return this.dispatch(Q,M(0,-K/2),M(P/2,0),M(0,K/2),M(-P/2,0))}else{if(L.align=="left"){return this.dispatch(Q,M(0,0),M(P,0),M(0,K),M(0,0))}else{if(L.align=="right"){return this.dispatch(Q,M(0,-K),M(0,0),M(0,0),M(-P,0))}else{throw"align: not implemented"}}}}}},getScaledTreePosition:function(I,J){var L=this.node;var O=this.node.overridable,K=I.data;var P=(O&&K.$width||L.width);var M=(O&&K.$height||L.height);var Q=(this.config.multitree&&("$orn" in I.data)&&I.data.$orn)||this.config.orientation;var N=function(S,R){return function(){return I.pos.add(new Complex(S,R)).$scale(1-J)}};if(L.align=="left"){return this.dispatch(Q,N(0,M),N(0,0),N(0,0),N(P,0))}else{if(L.align=="center"){return this.dispatch(Q,N(0,M/2),N(-P/2,0),N(0,-M/2),N(P/2,0))}else{if(L.align=="right"){return this.dispatch(Q,N(0,0),N(-P,0),N(0,-M),N(0,0))}else{throw"align: not implemented"}}}},treeFitsInCanvas:function(N,I,O){var K=I.getSize(N);var L=(this.config.multitree&&("$orn" in N.data)&&N.data.$orn)||this.config.orientation;var J=this.dispatch(L,K.width,K.height);var M=this.getTreeBaseSize(N,O,function(Q,P){return Q===0||!Graph.Util.anySubnode(P)});return(M<J)},setRightLevelToShow:function(K,I){var L=this.getRightLevelToShow(K,I),J=this.viz.fx;Graph.Util.eachLevel(K,0,this.config.levelsToShow,function(N){var M=N._depth-K._depth;if(M>L){N.drawn=false;N.exist=false;J.hideLabel(N,false)}else{N.exist=true}});K.drawn=true},getRightLevelToShow:function(L,J){var I=this.config;var M=I.levelsToShow;var K=I.constrained;if(!K){return M}while(!this.treeFitsInCanvas(L,J,M)&&M>1){M--}return M}});ST.Plot=new o({Implements:Graph.Plot,initialize:function(I){this.viz=I;this.config=I.config;this.node=this.config.Node;this.edge=this.config.Edge;this.animation=new Animation;this.nodeTypes=new ST.Plot.NodeTypes;this.edgeTypes=new ST.Plot.EdgeTypes},plotSubtree:function(N,M,P,K){var I=this.viz,L=I.canvas;P=Math.min(Math.max(0.001,P),1);if(P>=0){N.drawn=false;var J=L.getCtx();var O=I.geom.getScaledTreePosition(N,P);J.translate(O.x,O.y);J.scale(P,P)}this.plotTree(N,!P,M,K);if(P>=0){N.drawn=true}},plotTree:function(L,M,I,S){var O=this,Q=this.viz,J=Q.canvas,K=this.config,R=J.getCtx();var P=K.multitree&&!("$orn" in L.data);var N=P&&L.data.$orns;Graph.Util.eachSubnode(L,function(U){if((!P||N.indexOf(U.data.$orn)>0)&&U.exist&&U.drawn){var T=L.getAdjacency(U.id);!S&&I.onBeforePlotLine(T);R.globalAlpha=Math.min(L.alpha,U.alpha);O.plotLine(T,J,S);!S&&I.onAfterPlotLine(T);O.plotTree(U,M,I,S)}});if(L.drawn){R.globalAlpha=L.alpha;!S&&I.onBeforePlotNode(L);this.plotNode(L,J,S);!S&&I.onAfterPlotNode(L);if(M&&R.globalAlpha>=0.95){this.plotLabel(J,L,I)}else{this.hideLabel(L,false)}}else{this.hideLabel(L,true)}},placeLabel:function(T,L,O){var R=L.pos.getc(true),M=this.node,J=this.viz.canvas;var S=M.overridable&&L.data.$width||M.width;var N=M.overridable&&L.data.$height||M.height;var P=J.getSize();var K,Q;if(M.align=="center"){K={x:Math.round(R.x-S/2+P.width/2),y:Math.round(R.y-N/2+P.height/2)}}else{if(M.align=="left"){Q=this.config.orientation;if(Q=="bottom"||Q=="top"){K={x:Math.round(R.x-S/2+P.width/2),y:Math.round(R.y+P.height/2)}}else{K={x:Math.round(R.x+P.width/2),y:Math.round(R.y-N/2+P.height/2)}}}else{if(M.align=="right"){Q=this.config.orientation;if(Q=="bottom"||Q=="top"){K={x:Math.round(R.x-S/2+P.width/2),y:Math.round(R.y-N+P.height/2)}}else{K={x:Math.round(R.x-S+P.width/2),y:Math.round(R.y-N/2+P.height/2)}}}else{throw"align: not implemented"}}}var I=T.style;I.left=K.x+"px";I.top=K.y+"px";I.display=this.fitsInCanvas(K,J)?"":"none";O.onPlaceLabel(T,L)},getAlignedPos:function(N,L,I){var K=this.node;var M,J;if(K.align=="center"){M={x:N.x-L/2,y:N.y-I/2}}else{if(K.align=="left"){J=this.config.orientation;if(J=="bottom"||J=="top"){M={x:N.x-L/2,y:N.y}}else{M={x:N.x,y:N.y-I/2}}}else{if(K.align=="right"){J=this.config.orientation;if(J=="bottom"||J=="top"){M={x:N.x-L/2,y:N.y-I}}else{M={x:N.x-L,y:N.y-I/2}}}else{throw"align: not implemented"}}}return M},getOrientation:function(I){var K=this.config;var J=K.orientation;if(K.multitree){var L=I.nodeFrom;var M=I.nodeTo;J=(("$orn" in L.data)&&L.data.$orn)||(("$orn" in M.data)&&M.data.$orn)}return J}});ST.Plot.NodeTypes=new o({none:function(){},circle:function(M,J){var P=M.pos.getc(true),L=this.node,N=M.data;var K=L.overridable&&N;var O=K&&N.$dim||L.dim;var I=this.getAlignedPos(P,O*2,O*2);J.path("fill",function(Q){Q.arc(I.x+O,I.y+O,O,0,Math.PI*2,true)})},square:function(M,J){var P=M.pos.getc(true),L=this.node,N=M.data;var K=L.overridable&&N;var O=K&&N.$dim||L.dim;var I=this.getAlignedPos(P,O,O);J.getCtx().fillRect(I.x,I.y,O,O)},ellipse:function(K,J){var N=K.pos.getc(true),O=this.node,L=K.data;var M=O.overridable&&L;var I=(M&&L.$width||O.width)/2;var Q=(M&&L.$height||O.height)/2;var P=this.getAlignedPos(N,I*2,Q*2);var R=J.getCtx();R.save();R.scale(I/Q,Q/I);J.path("fill",function(S){S.arc((P.x+I)*(Q/I),(P.y+Q)*(I/Q),Q,0,Math.PI*2,true)});R.restore()},rectangle:function(K,J){var N=K.pos.getc(true),O=this.node,L=K.data;var M=O.overridable&&L;var I=M&&L.$width||O.width;var Q=M&&L.$height||O.height;var P=this.getAlignedPos(N,I,Q);J.getCtx().fillRect(P.x,P.y,I,Q)}});ST.Plot.EdgeTypes=new o({none:function(){},line:function(J,L){var K=this.getOrientation(J);var N=J.nodeFrom,O=J.nodeTo;var M=this.viz.geom.getEdge(N._depth<O._depth?N:O,"begin",K);var I=this.viz.geom.getEdge(N._depth<O._depth?O:N,"end",K);L.path("stroke",function(P){P.moveTo(M.x,M.y);P.lineTo(I.x,I.y)})},"quadratic:begin":function(R,J){var Q=this.getOrientation(R);var M=R.data,I=this.edge;var O=R.nodeFrom,S=R.nodeTo;var K=this.viz.geom.getEdge(O._depth<S._depth?O:S,"begin",Q);var L=this.viz.geom.getEdge(O._depth<S._depth?S:O,"end",Q);var P=I.overridable&&M;var N=P&&M.$dim||I.dim;switch(Q){case"left":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(K.x+N,K.y,L.x,L.y)});break;case"right":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(K.x-N,K.y,L.x,L.y)});break;case"top":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(K.x,K.y+N,L.x,L.y)});break;case"bottom":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(K.x,K.y-N,L.x,L.y)});break}},"quadratic:end":function(R,J){var Q=this.getOrientation(R);var M=R.data,I=this.edge;var O=R.nodeFrom,S=R.nodeTo;var K=this.viz.geom.getEdge(O._depth<S._depth?O:S,"begin",Q);var L=this.viz.geom.getEdge(O._depth<S._depth?S:O,"end",Q);var P=I.overridable&&M;var N=P&&M.$dim||I.dim;switch(Q){case"left":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(L.x-N,L.y,L.x,L.y)});break;case"right":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(L.x+N,L.y,L.x,L.y)});break;case"top":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(L.x,L.y-N,L.x,L.y)});break;case"bottom":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.quadraticCurveTo(L.x,L.y+N,L.x,L.y)});break}},bezier:function(R,J){var M=R.data,I=this.edge;var Q=this.getOrientation(R);var O=R.nodeFrom,S=R.nodeTo;var K=this.viz.geom.getEdge(O._depth<S._depth?O:S,"begin",Q);var L=this.viz.geom.getEdge(O._depth<S._depth?S:O,"end",Q);var P=I.overridable&&M;var N=P&&M.$dim||I.dim;switch(Q){case"left":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.bezierCurveTo(K.x+N,K.y,L.x-N,L.y,L.x,L.y)});break;case"right":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.bezierCurveTo(K.x-N,K.y,L.x+N,L.y,L.x,L.y)});break;case"top":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.bezierCurveTo(K.x,K.y+N,L.x,L.y-N,L.x,L.y)});break;case"bottom":J.path("stroke",function(T){T.moveTo(K.x,K.y);T.bezierCurveTo(K.x,K.y-N,L.x,L.y+N,L.x,L.y)});break}},arrow:function(Q,L){var W=this.getOrientation(Q);var U=Q.nodeFrom,M=Q.nodeTo;var Z=Q.data,P=this.edge;var R=P.overridable&&Z;var O=R&&Z.$dim||P.dim;if(R&&Z.$direction&&Z.$direction.length>1){var K={};K[U.id]=U;K[M.id]=M;var V=Z.$direction;U=K[V[0]];M=K[V[1]]}var N=this.viz.geom.getEdge(U,"begin",W);var S=this.viz.geom.getEdge(M,"end",W);var T=new Complex(S.x-N.x,S.y-N.y);T.$scale(O/T.norm());var X=new Complex(S.x-T.x,S.y-T.y);var Y=new Complex(-T.y/2,T.x/2);var J=X.add(Y),I=X.$add(Y.$scale(-1));L.path("stroke",function(aa){aa.moveTo(N.x,N.y);aa.lineTo(S.x,S.y)});L.path("fill",function(aa){aa.moveTo(J.x,J.y);aa.lineTo(I.x,I.y);aa.lineTo(S.x,S.y)})}})})();var AngularWidth={setAngularWidthForNodes:function(){var x=this.config.Node;var z=x.overridable;var y=x.dim;Graph.Util.eachBFS(this.graph,this.root,function(C,A){var B=(z&&C.data&&C.data.$aw)||y;C._angularWidth=B/A},"ignore")},setSubtreesAngularWidth:function(){var x=this;Graph.Util.eachNode(this.graph,function(y){x.setSubtreeAngularWidth(y)},"ignore")},setSubtreeAngularWidth:function(A){var z=this,y=A._angularWidth,x=0;Graph.Util.eachSubnode(A,function(B){z.setSubtreeAngularWidth(B);x+=B._treeAngularWidth},"ignore");A._treeAngularWidth=Math.max(y,x)},computeAngularWidths:function(){this.setAngularWidthForNodes();this.setSubtreesAngularWidth()}};this.RGraph=new o({Implements:[Loader,AngularWidth],initialize:function(A,x){var z={labelContainer:A.id+"-label",interpolation:"linear",levelDistance:100,withLabels:true,Node:{overridable:false,type:"circle",dim:3,color:"#ccb",width:5,height:5,lineWidth:1},Edge:{overridable:false,type:"line",color:"#ccb",lineWidth:1},fps:40,duration:2500,transition:Trans.Quart.easeInOut,clearCanvas:true};var y={onBeforeCompute:b,onAfterCompute:b,onCreateLabel:b,onPlaceLabel:b,onComplete:b,onBeforePlotLine:b,onAfterPlotLine:b,onBeforePlotNode:b,onAfterPlotNode:b};this.controller=this.config=r(z,y,x);this.graphOptions={complex:false,Node:{selected:false,exist:true,drawn:true}};this.graph=new Graph(this.graphOptions);this.fx=new RGraph.Plot(this);this.op=new RGraph.Op(this);this.json=null;this.canvas=A;this.root=null;this.busy=false;this.parent=false},refresh:function(){this.compute();this.plot()},reposition:function(){this.compute("endPos")},plot:function(){this.fx.plot()},compute:function(y){var z=y||["pos","startPos","endPos"];var x=this.graph.getNode(this.root);x._depth=0;Graph.Util.computeLevels(this.graph,this.root,0,"ignore");this.computeAngularWidths();this.computePositions(z)},computePositions:function(E){var y=j(E);var D=this.graph;var C=Graph.Util;var x=this.graph.getNode(this.root);var B=this.parent;var z=this.config;for(var A=0;A<y.length;A++){x[y[A]]=l(0,0)}x.angleSpan={begin:0,end:2*Math.PI};x._rel=1;C.eachBFS(this.graph,this.root,function(I){var L=I.angleSpan.end-I.angleSpan.begin;var O=(I._depth+1)*z.levelDistance;var M=I.angleSpan.begin;var N=0,F=[];C.eachSubnode(I,function(Q){N+=Q._treeAngularWidth;F.push(Q)},"ignore");if(B&&B.id==I.id&&F.length>0&&F[0].dist){F.sort(function(R,Q){return(R.dist>=Q.dist)-(R.dist<=Q.dist)})}for(var J=0;J<F.length;J++){var H=F[J];if(!H._flag){H._rel=H._treeAngularWidth/N;var P=H._rel*L;var G=M+P/2;for(var K=0;K<y.length;K++){H[y[K]]=l(G,O)}H.angleSpan={begin:M,end:M+P};M+=P}}},"ignore")},getNodeAndParentAngle:function(E){var z=false;var D=this.graph.getNode(E);var B=Graph.Util.getParents(D);var A=(B.length>0)?B[0]:false;if(A){var x=A.pos.getc(),C=D.pos.getc();var y=x.add(C.scale(-1));z=Math.atan2(y.y,y.x);if(z<0){z+=2*Math.PI}}return{parent:A,theta:z}},tagChildren:function(B,D){if(B.angleSpan){var C=[];Graph.Util.eachAdjacency(B,function(E){C.push(E.nodeTo)},"ignore");var x=C.length;for(var A=0;A<x&&D!=C[A].id;A++){}for(var z=(A+1)%x,y=0;D!=C[z].id;z=(z+1)%x){C[z].dist=y++}}},onClick:function(B,y){if(this.root!=B&&!this.busy){this.busy=true;this.root=B;that=this;this.controller.onBeforeCompute(this.graph.getNode(B));var z=this.getNodeAndParentAngle(B);this.tagChildren(z.parent,B);this.parent=z.parent;this.compute("endPos");var x=z.theta-z.parent.endPos.theta;Graph.Util.eachNode(this.graph,function(C){C.endPos.set(C.endPos.getp().add(l(x,0)))});var A=this.config.interpolation;y=r({onComplete:b},y||{});this.fx.animate(r({hideLabels:true,modes:[A]},y,{onComplete:function(){that.busy=false;y.onComplete()}}))}}});RGraph.Op=new o({Implements:Graph.Op,initialize:function(x){this.viz=x}});RGraph.Plot=new o({Implements:Graph.Plot,initialize:function(x){this.viz=x;this.config=x.config;this.node=x.config.Node;this.edge=x.config.Edge;this.animation=new Animation;this.nodeTypes=new RGraph.Plot.NodeTypes;this.edgeTypes=new RGraph.Plot.EdgeTypes},placeLabel:function(y,C,z){var E=C.pos.getc(true),A=this.viz.canvas;var x=A.getSize();var D={x:Math.round(E.x+x.width/2),y:Math.round(E.y+x.height/2)};var B=y.style;B.left=D.x+"px";B.top=D.y+"px";B.display=this.fitsInCanvas(D,A)?"":"none";z.onPlaceLabel(y,C)}});RGraph.Plot.NodeTypes=new o({none:function(){},circle:function(z,x){var C=z.pos.getc(true),y=this.node,B=z.data;var A=y.overridable&&B&&B.$dim||y.dim;x.path("fill",function(D){D.arc(C.x,C.y,A,0,Math.PI*2,true)})},square:function(A,x){var D=A.pos.getc(true),z=this.node,C=A.data;var B=z.overridable&&C&&C.$dim||z.dim;var y=2*B;x.getCtx().fillRect(D.x-B,D.y-B,y,y)},rectangle:function(B,y){var D=B.pos.getc(true),A=this.node,C=B.data;var z=A.overridable&&C&&C.$width||A.width;var x=A.overridable&&C&&C.$height||A.height;y.getCtx().fillRect(D.x-z/2,D.y-x/2,z,x)},triangle:function(B,y){var F=B.pos.getc(true),G=this.node,C=B.data;var x=G.overridable&&C&&C.$dim||G.dim;var A=F.x,z=F.y-x,I=A-x,H=F.y+x,E=A+x,D=H;y.path("fill",function(J){J.moveTo(A,z);J.lineTo(I,H);J.lineTo(E,D)})},star:function(z,y){var D=z.pos.getc(true),E=this.node,B=z.data;var x=E.overridable&&B&&B.$dim||E.dim;var F=y.getCtx(),C=Math.PI/5;F.save();F.translate(D.x,D.y);F.beginPath();F.moveTo(x,0);for(var A=0;A<9;A++){F.rotate(C);if(A%2==0){F.lineTo((x/0.525731)*0.200811,0)}else{F.lineTo(x,0)}}F.closePath();F.fill();F.restore()}});RGraph.Plot.EdgeTypes=new o({none:function(){},line:function(x,y){var A=x.nodeFrom.pos.getc(true);var z=x.nodeTo.pos.getc(true);y.path("stroke",function(B){B.moveTo(A.x,A.y);B.lineTo(z.x,z.y)})},arrow:function(J,B){var D=J.nodeFrom,A=J.nodeTo;var E=J.data,x=this.edge;var I=x.overridable&&E;var L=I&&E.$dim||14;if(I&&E.$direction&&E.$direction.length>1){var y={};y[D.id]=D;y[A.id]=A;var z=E.$direction;D=y[z[0]];A=y[z[1]]}var N=D.pos.getc(true),C=A.pos.getc(true);var H=new Complex(C.x-N.x,C.y-N.y);H.$scale(L/H.norm());var F=new Complex(C.x-H.x,C.y-H.y);var G=new Complex(-H.y/2,H.x/2);var M=F.add(G),K=F.$add(G.$scale(-1));B.path("stroke",function(O){O.moveTo(N.x,N.y);O.lineTo(C.x,C.y)});B.path("fill",function(O){O.moveTo(M.x,M.y);O.lineTo(K.x,K.y);O.lineTo(C.x,C.y)})}});Complex.prototype.moebiusTransformation=function(z){var x=this.add(z);var y=z.$conjugate().$prod(this);y.x++;return x.$div(y)};Graph.Util.getClosestNodeToOrigin=function(y,z,x){return this.getClosestNodeToPos(y,Polar.KER,z,x)};Graph.Util.getClosestNodeToPos=function(z,C,B,x){var y=null;B=B||"pos";C=C&&C.getc(true)||Complex.KER;var A=function(E,D){var G=E.x-D.x,F=E.y-D.y;return G*G+F*F};this.eachNode(z,function(D){y=(y==null||A(D[B].getc(true),C)<A(y[B].getc(true),C))?D:y},x);return y};Graph.Util.moebiusTransformation=function(z,B,A,y,x){this.eachNode(z,function(D){for(var C=0;C<A.length;C++){var F=B[C].scale(-1),E=y?y:A[C];D[A[C]].set(D[E].getc().moebiusTransformation(F))}},x)};this.Hypertree=new o({Implements:[Loader,AngularWidth],initialize:function(A,x){var z={labelContainer:A.id+"-label",withLabels:true,Node:{overridable:false,type:"circle",dim:7,color:"#ccb",width:5,height:5,lineWidth:1,transform:true},Edge:{overridable:false,type:"hyperline",color:"#ccb",lineWidth:1},clearCanvas:true,fps:40,duration:1500,transition:Trans.Quart.easeInOut};var y={onBeforeCompute:b,onAfterCompute:b,onCreateLabel:b,onPlaceLabel:b,onComplete:b,onBeforePlotLine:b,onAfterPlotLine:b,onBeforePlotNode:b,onAfterPlotNode:b};this.controller=this.config=r(z,y,x);this.graphOptions={complex:false,Node:{selected:false,exist:true,drawn:true}};this.graph=new Graph(this.graphOptions);this.fx=new Hypertree.Plot(this);this.op=new Hypertree.Op(this);this.json=null;this.canvas=A;this.root=null;this.busy=false},refresh:function(x){if(x){this.reposition();Graph.Util.eachNode(this.graph,function(y){y.startPos.rho=y.pos.rho=y.endPos.rho;y.startPos.theta=y.pos.theta=y.endPos.theta})}else{this.compute()}this.plot()},reposition:function(){this.compute("endPos");var x=this.graph.getNode(this.root).pos.getc().scale(-1);Graph.Util.moebiusTransformation(this.graph,[x],["endPos"],"endPos","ignore");Graph.Util.eachNode(this.graph,function(y){if(y.ignore){y.endPos.rho=y.pos.rho;y.endPos.theta=y.pos.theta}})},plot:function(){this.fx.plot()},compute:function(y){var z=y||["pos","startPos"];var x=this.graph.getNode(this.root);x._depth=0;Graph.Util.computeLevels(this.graph,this.root,0,"ignore");this.computeAngularWidths();this.computePositions(z)},computePositions:function(F){var G=j(F);var B=this.graph,D=Graph.Util;var E=this.graph.getNode(this.root),C=this,x=this.config;var H=this.canvas.getSize();var z=Math.min(H.width,H.height)/2;for(var A=0;A<G.length;A++){E[G[A]]=l(0,0)}E.angleSpan={begin:0,end:2*Math.PI};E._rel=1;var y=(function(){var K=0;D.eachNode(B,function(L){K=(L._depth>K)?L._depth:K;L._scale=z},"ignore");for(var J=0.51;J<=1;J+=0.01){var I=(function(L,M){return(1-Math.pow(L,M))/(1-L)})(J,K+1);if(I>=2){return J-0.01}}return 0.5})();D.eachBFS(this.graph,this.root,function(N){var J=N.angleSpan.end-N.angleSpan.begin;var O=N.angleSpan.begin;var M=(function(Q){var R=0;D.eachSubnode(Q,function(S){R+=S._treeAngularWidth},"ignore");return R})(N);for(var L=1,I=0,K=y,P=N._depth;L<=P+1;L++){I+=K;K*=y}D.eachSubnode(N,function(T){if(!T._flag){T._rel=T._treeAngularWidth/M;var S=T._rel*J;var R=O+S/2;for(var Q=0;Q<G.length;Q++){T[G[Q]]=l(R,I)}T.angleSpan={begin:O,end:O+S};O+=S}},"ignore")},"ignore")},onClick:function(z,x){var y=this.graph.getNode(z).pos.getc(true);this.move(y,x)},move:function(C,z){var y=q(C.x,C.y);if(this.busy===false&&y.norm()<1){var B=Graph.Util;this.busy=true;var x=B.getClosestNodeToPos(this.graph,y),A=this;B.computeLevels(this.graph,x.id,0);this.controller.onBeforeCompute(x);if(y.norm()<1){z=r({onComplete:b},z||{});this.fx.animate(r({modes:["moebius"],hideLabels:true},z,{onComplete:function(){A.busy=false;z.onComplete()}}),y)}}}});Hypertree.Op=new o({Implements:Graph.Op,initialize:function(x){this.viz=x}});Hypertree.Plot=new o({Implements:Graph.Plot,initialize:function(x){this.viz=x;this.config=x.config;this.node=this.config.Node;this.edge=this.config.Edge;this.animation=new Animation;this.nodeTypes=new Hypertree.Plot.NodeTypes;this.edgeTypes=new Hypertree.Plot.EdgeTypes},hyperline:function(I,A){var B=I.nodeFrom,z=I.nodeTo,F=I.data;var J=B.pos.getc(),E=z.pos.getc();var D=this.computeArcThroughTwoPoints(J,E);var K=A.getSize();var C=Math.min(K.width,K.height)/2;if(D.a>1000||D.b>1000||D.ratio>1000){A.path("stroke",function(L){L.moveTo(J.x*C,J.y*C);L.lineTo(E.x*C,E.y*C)})}else{var H=Math.atan2(E.y-D.y,E.x-D.x);var G=Math.atan2(J.y-D.y,J.x-D.x);var y=this.sense(H,G);var x=A.getCtx();A.path("stroke",function(L){L.arc(D.x*C,D.y*C,D.ratio*C,H,G,y)})}},computeArcThroughTwoPoints:function(L,K){var D=(L.x*K.y-L.y*K.x),z=D;var C=L.squaredNorm(),B=K.squaredNorm();if(D==0){return{x:0,y:0,ratio:1001}}var J=(L.y*B-K.y*C+L.y-K.y)/D;var H=(K.x*C-L.x*B+K.x-L.x)/z;var I=-J/2;var G=-H/2;var F=(J*J+H*H)/4-1;if(F<0){return{x:0,y:0,ratio:1001}}var E=Math.sqrt(F);var A={x:I,y:G,ratio:E,a:J,b:H};return A},sense:function(x,y){return(x<y)?((x+Math.PI>y)?false:true):((y+Math.PI>x)?true:false)},placeLabel:function(F,A,C){var E=A.pos.getc(true),y=this.viz.canvas;var D=y.getSize();var B=A._scale;var z={x:Math.round(E.x*B+D.width/2),y:Math.round(E.y*B+D.height/2)};var x=F.style;x.left=z.x+"px";x.top=z.y+"px";x.display="";C.onPlaceLabel(F,A)}});Hypertree.Plot.NodeTypes=new o({none:function(){},circle:function(A,y){var z=this.node,C=A.data;var B=z.overridable&&C&&C.$dim||z.dim;var D=A.pos.getc(),E=D.scale(A._scale);var x=z.transform?B*(1-D.squaredNorm()):B;if(x>=B/4){y.path("fill",function(F){F.arc(E.x,E.y,x,0,Math.PI*2,true)})}},square:function(A,z){var F=this.node,C=A.data;var x=F.overridable&&C&&C.$dim||F.dim;var y=A.pos.getc(),E=y.scale(A._scale);var D=F.transform?x*(1-y.squaredNorm()):x;var B=2*D;if(D>=x/4){z.getCtx().fillRect(E.x-D,E.y-D,B,B)}},rectangle:function(A,z){var E=this.node,B=A.data;var y=E.overridable&&B&&B.$width||E.width;var F=E.overridable&&B&&B.$height||E.height;var x=A.pos.getc(),D=x.scale(A._scale);var C=1-x.squaredNorm();y=E.transform?y*C:y;F=E.transform?F*C:F;if(C>=0.25){z.getCtx().fillRect(D.x-y/2,D.y-F/2,y,F)}},triangle:function(C,z){var I=this.node,D=C.data;var x=I.overridable&&D&&D.$dim||I.dim;var y=C.pos.getc(),H=y.scale(C._scale);var G=I.transform?x*(1-y.squaredNorm()):x;if(G>=x/4){var B=H.x,A=H.y-G,K=B-G,J=H.y+G,F=B+G,E=J;z.path("fill",function(L){L.moveTo(B,A);L.lineTo(K,J);L.lineTo(F,E)})}},star:function(A,z){var G=this.node,C=A.data;var x=G.overridable&&C&&C.$dim||G.dim;var y=A.pos.getc(),F=y.scale(A._scale);var E=G.transform?x*(1-y.squaredNorm()):x;if(E>=x/4){var H=z.getCtx(),D=Math.PI/5;H.save();H.translate(F.x,F.y);H.beginPath();H.moveTo(x,0);for(var B=0;B<9;B++){H.rotate(D);if(B%2==0){H.lineTo((E/0.525731)*0.200811,0)}else{H.lineTo(E,0)}}H.closePath();H.fill();H.restore()}}});Hypertree.Plot.EdgeTypes=new o({none:function(){},line:function(x,y){var z=x.nodeFrom._scale;var B=x.nodeFrom.pos.getc(true);var A=x.nodeTo.pos.getc(true);y.path("stroke",function(C){C.moveTo(B.x*z,B.y*z);C.lineTo(A.x*z,A.y*z)})},hyperline:function(x,y){this.hyperline(x,y)}});this.TM={layout:{orientation:"h",vertical:function(){return this.orientation=="v"},horizontal:function(){return this.orientation=="h"},change:function(){this.orientation=this.vertical()?"h":"v"}},innerController:{onBeforeCompute:b,onAfterCompute:b,onComplete:b,onCreateElement:b,onDestroyElement:b,request:false},config:{orientation:"h",titleHeight:13,rootId:"infovis",offset:4,levelsToShow:3,addLeftClickHandler:false,addRightClickHandler:false,selectPathOnHover:false,Color:{allow:false,minValue:-100,maxValue:100,minColorValue:[255,0,50],maxColorValue:[0,255,50]},Tips:{allow:false,offsetX:20,offsetY:20,onShow:b}},initialize:function(x){this.tree=null;this.shownTree=null;this.controller=this.config=r(this.config,this.innerController,x);this.rootId=this.config.rootId;this.layout.orientation=this.config.orientation;if(this.config.Tips.allow&&document.body){var B=document.getElementById("_tooltip")||document.createElement("div");B.id="_tooltip";B.className="tip";var z=B.style;z.position="absolute";z.display="none";z.zIndex=13000;document.body.appendChild(B);this.tip=B}var A=this;var y=function(){A.empty();if(window.CollectGarbage){window.CollectGarbage()}delete y};if(window.addEventListener){window.addEventListener("unload",y,false)}else{window.attachEvent("onunload",y)}},each:function(x){(function y(D){if(!D){return}var C=D.childNodes,z=C.length;if(z>0){x.apply(this,[D,z===1,C[0],C[1]])}if(z>1){for(var A=C[1].childNodes,B=0;B<A.length;B++){y(A[B])}}})(e(this.rootId).firstChild)},toStyle:function(z){var x="";for(var y in z){x+=y+":"+z[y]+";"}return x},leaf:function(x){return x.children==0},createBox:function(y,A,x){var z;if(!this.leaf(y)){z=this.headBox(y,A)+this.bodyBox(x,A)}else{z=this.leafBox(y,A)}return this.contentBox(y,A,z)},plot:function(B){var D=B.coord,A="";if(this.leaf(B)){return this.createBox(B,D,null)}for(var z=0,C=B.children;z<C.length;z++){var y=C[z],x=y.coord;if(x.width*x.height>1){A+=this.plot(y)}}return this.createBox(B,D,A)},headBox:function(y,B){var x=this.config,A=x.offset;var z={height:x.titleHeight+"px",width:(B.width-A)+"px",left:A/2+"px"};return'<div class="head" style="'+this.toStyle(z)+'">'+y.name+"</div>"},bodyBox:function(y,C){var x=this.config,z=x.titleHeight,B=x.offset;var A={width:(C.width-B)+"px",height:(C.height-B-z)+"px",top:(z+B/2)+"px",left:(B/2)+"px"};return'<div class="body" style="'+this.toStyle(A)+'">'+y+"</div>"},contentBox:function(z,B,y){var A={};for(var x in B){A[x]=B[x]+"px"}return'<div class="content" style="'+this.toStyle(A)+'" id="'+z.id+'">'+y+"</div>"},leafBox:function(A,E){var z=this.config;var y=z.Color.allow&&this.setColor(A),D=z.offset,B=E.width-D,x=E.height-D;var C={top:(D/2)+"px",height:x+"px",width:B+"px",left:(D/2)+"px"};if(y){C["background-color"]=y}return'<div class="leaf" style="'+this.toStyle(C)+'">'+A.name+"</div>"},setColor:function(F){var A=this.config.Color,B=A.maxColorValue,y=A.minColorValue,C=A.maxValue,G=A.minValue,E=C-G,D=(F.data.$color-0);var z=function(I,H){return Math.round((((B[I]-y[I])/E)*(H-G)+y[I]))};return d([z(0,D),z(1,D),z(2,D)])},enter:function(x){this.view(x.parentNode.id)},onLeftClick:function(x){this.enter(x)},out:function(){var x=TreeUtil.getParent(this.tree,this.shownTree.id);if(x){if(this.controller.request){TreeUtil.prune(x,this.config.levelsToShow)}this.view(x.id)}},onRightClick:function(){this.out()},view:function(B){var x=this.config,z=this;var y={onComplete:function(){z.loadTree(B);e(x.rootId).focus()}};if(this.controller.request){var A=TreeUtil;A.loadSubtrees(A.getSubtree(this.tree,B),r(this.controller,y))}else{y.onComplete()}},resetPath:function(x){var y=this.rootId,B=this.resetPath.previous;this.resetPath.previous=x||false;function z(D){var C=D.parentNode;return C&&(C.id!=y)&&C}function A(F,C){if(F){var D=e(F.id);if(D){var E=z(D);while(E){F=E.childNodes[0];if(s(F,"in-path")){if(C==undefined||!!C){a(F,"in-path")}}else{if(!C){p(F,"in-path")}}E=z(E)}}}}A(B,true);A(x,false)},initializeElements:function(){var x=this.controller,z=this;var y=m(false),A=x.Tips.allow;this.each(function(F,E,D,C){var B=TreeUtil.getSubtree(z.tree,F.id);x.onCreateElement(F,B,E,D,C);if(x.addRightClickHandler){D.oncontextmenu=y}if(x.addLeftClickHandler||x.addRightClickHandler){t(D,"mouseup",function(G){var H=(G.which==3||G.button==2);if(H){if(x.addRightClickHandler){z.onRightClick()}}else{if(x.addLeftClickHandler){z.onLeftClick(D)}}if(G.preventDefault){G.preventDefault()}else{G.returnValue=false}})}if(x.selectPathOnHover||A){t(D,"mouseover",function(G){if(x.selectPathOnHover){if(E){p(D,"over-leaf")}else{p(D,"over-head");p(F,"over-content")}if(F.id){z.resetPath(B)}}if(A){x.Tips.onShow(z.tip,B,E,D)}});t(D,"mouseout",function(G){if(x.selectPathOnHover){if(E){a(D,"over-leaf")}else{a(D,"over-head");a(F,"over-content")}z.resetPath()}if(A){z.tip.style.display="none"}});if(A){t(D,"mousemove",function(J,I){var O=z.tip;I=I||window;J=J||I.event;var N=I.document;N=N.html||N.body;var K={x:J.pageX||J.clientX+N.scrollLeft,y:J.pageY||J.clientY+N.scrollTop};O.style.display="";I={height:document.body.clientHeight,width:document.body.clientWidth};var H={width:O.offsetWidth,height:O.offsetHeight};var G=O.style,M=x.Tips.offsetX,L=x.Tips.offsetY;G.top=((K.y+L+H.height>I.height)?(K.y-H.height-L):K.y+L)+"px";G.left=((K.x+H.width+M>I.width)?(K.x-H.width-M):K.x+M)+"px"})}}})},destroyElements:function(){if(this.controller.onDestroyElement!=b){var x=this.controller,y=this;this.each(function(C,B,A,z){x.onDestroyElement(C,TreeUtil.getSubtree(y.tree,C.id),B,A,z)})}},empty:function(){this.destroyElements();f(e(this.rootId))},loadTree:function(x){this.empty();this.loadJSON(TreeUtil.getSubtree(this.tree,x))}};TM.SliceAndDice=new o({Implements:TM,loadJSON:function(A){this.controller.onBeforeCompute(A);var y=e(this.rootId),z=this.config,B=y.offsetWidth,x=y.offsetHeight;var C={coord:{top:0,left:0,width:B,height:x+z.titleHeight+z.offset}};if(this.tree==null){this.tree=A}this.shownTree=A;this.compute(C,A,this.layout.orientation);y.innerHTML=this.plot(A);this.initializeElements();this.controller.onAfterCompute(A)},compute:function(D,M,B){var O=this.config,I=D.coord,L=O.offset,H=I.width-L,F=I.height-L-O.titleHeight,y=D.data,x=(y&&("$area" in y))?M.data.$area/y.$area:1;var G,E,K,C,A;var N=(B=="h");if(N){B="v";G=F;E=Math.round(H*x);K="height";C="top";A="left"}else{B="h";G=Math.round(F*x);E=H;K="width";C="left";A="top"}M.coord={width:E,height:G,top:0,left:0};var J=0,z=this;g(M.children,function(P){z.compute(M,P,B);P.coord[C]=J;P.coord[A]=0;J+=Math.floor(P.coord[K])})}});TM.Area=new o({loadJSON:function(z){this.controller.onBeforeCompute(z);var y=e(this.rootId),A=y.offsetWidth,x=y.offsetHeight,E=this.config.offset,C=A-E,B=x-E-this.config.titleHeight;z.coord={height:x,width:A,top:0,left:0};var D=r(z.coord,{width:C,height:B});this.compute(z,D);y.innerHTML=this.plot(z);if(this.tree==null){this.tree=z}this.shownTree=z;this.initializeElements();this.controller.onAfterCompute(z)},computeDim:function(A,E,y,D,z){if(A.length+E.length==1){var x=(A.length==1)?A:E;this.layoutLast(x,y,D);return}if(A.length>=2&&E.length==0){E=[A[0]];A=A.slice(1)}if(A.length==0){if(E.length>0){this.layoutRow(E,y,D)}return}var C=A[0];if(z(E,y)>=z([C].concat(E),y)){this.computeDim(A.slice(1),E.concat([C]),y,D,z)}else{var B=this.layoutRow(E,y,D);this.computeDim(A,[],B.dim,B,z)}},worstAspectRatio:function(x,E){if(!x||x.length==0){return Number.MAX_VALUE}var y=0,F=0,B=Number.MAX_VALUE;for(var C=0;C<x.length;C++){var z=x[C]._area;y+=z;B=(B<z)?B:z;F=(F>z)?F:z}var D=E*E,A=y*y;return Math.max(D*F/A,A/(D*B))},avgAspectRatio:function(A,x){if(!A||A.length==0){return Number.MAX_VALUE}var C=0;for(var y=0;y<A.length;y++){var B=A[y]._area;var z=B/x;C+=(x>z)?x/z:z/x}return C/A.length},layoutLast:function(y,x,z){y[0].coord=z}});TM.Squarified=new o({Implements:[TM,TM.Area],compute:function(F,C){if(!(C.width>=C.height&&this.layout.horizontal())){this.layout.change()}var x=F.children,z=this.config;if(x.length>0){this.processChildrenLayout(F,x,C);for(var B=0;B<x.length;B++){var A=x[B].coord,D=z.offset,E=A.height-(z.titleHeight+D),y=A.width-D;C={width:y,height:E,top:0,left:0};this.compute(x[B],C)}}},processChildrenLayout:function(F,x,B){var y=B.width*B.height;var A,C=0,G=[];for(A=0;A<x.length;A++){G[A]=parseFloat(x[A].data.$area);C+=G[A]}for(A=0;A<G.length;A++){x[A]._area=y*G[A]/C}var z=(this.layout.horizontal())?B.height:B.width;x.sort(function(I,H){return(I._area<=H._area)-(I._area>=H._area)});var E=[x[0]];var D=x.slice(1);this.squarify(D,E,z,B)},squarify:function(y,A,x,z){this.computeDim(y,A,x,z,this.worstAspectRatio)},layoutRow:function(y,x,z){if(this.layout.horizontal()){return this.layoutV(y,x,z)}else{return this.layoutH(y,x,z)}},layoutV:function(x,F,C){var G=0,z=Math.round;g(x,function(H){G+=H._area});var y=z(G/F),D=0;for(var A=0;A<x.length;A++){var B=z(x[A]._area/y);x[A].coord={height:B,width:y,top:C.top+D,left:C.left};D+=B}var E={height:C.height,width:C.width-y,top:C.top,left:C.left+y};E.dim=Math.min(E.width,E.height);if(E.dim!=E.height){this.layout.change()}return E},layoutH:function(x,E,B){var G=0,y=Math.round;g(x,function(H){G+=H._area});var F=y(G/E),C=B.top,z=0;for(var A=0;A<x.length;A++){x[A].coord={height:F,width:y(x[A]._area/F),top:C,left:B.left+z};z+=x[A].coord.width}var D={height:B.height-F,width:B.width,top:B.top+F,left:B.left};D.dim=Math.min(D.width,D.height);if(D.dim!=D.width){this.layout.change()}return D}});TM.Strip=new o({Implements:[TM,TM.Area],compute:function(F,C){var x=F.children,z=this.config;if(x.length>0){this.processChildrenLayout(F,x,C);for(var B=0;B<x.length;B++){var A=x[B].coord,D=z.offset,E=A.height-(z.titleHeight+D),y=A.width-D;C={width:y,height:E,top:0,left:0};this.compute(x[B],C)}}},processChildrenLayout:function(A,z,E){var B=E.width*E.height;var C=parseFloat(A.data.$area);g(z,function(F){F._area=B*parseFloat(F.data.$area)/C});var y=(this.layout.horizontal())?E.width:E.height;var D=[z[0]];var x=z.slice(1);this.stripify(x,D,y,E)},stripify:function(y,A,x,z){this.computeDim(y,A,x,z,this.avgAspectRatio)},layoutRow:function(y,x,z){if(this.layout.horizontal()){return this.layoutH(y,x,z)}else{return this.layoutV(y,x,z)}},layoutV:function(x,F,C){var G=0,z=function(H){return H};g(x,function(H){G+=H._area});var y=z(G/F),D=0;for(var A=0;A<x.length;A++){var B=z(x[A]._area/y);x[A].coord={height:B,width:y,top:C.top+(F-B-D),left:C.left};D+=B}var E={height:C.height,width:C.width-y,top:C.top,left:C.left+y,dim:F};return E},layoutH:function(x,E,B){var G=0,y=function(H){return H};g(x,function(H){G+=H._area});var F=y(G/E),C=B.height-F,z=0;for(var A=0;A<x.length;A++){x[A].coord={height:F,width:y(x[A]._area/F),top:C,left:B.left+z};z+=x[A].coord.width}var D={height:B.height-F,width:B.width,top:B.top,left:B.left,dim:E};return D}})})();/* 741 Copyright (c) 2009, Yahoo! Inc. All rights reserved. 742 Code licensed under the BSD License: 743 http://developer.yahoo.net/yui/license.txt 744 version: 2.8.0r4 745 */ 746 if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var D=function(H){var I=0;return parseFloat(H.replace(/\./g,function(){return(I++==1)?"":".";}));},G=navigator,F={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:G.cajaVersion,secure:false,os:null},C=navigator&&navigator.userAgent,E=window&&window.location,B=E&&E.href,A;F.secure=B&&(B.toLowerCase().indexOf("https")===0);if(C){if((/windows|win32/i).test(C)){F.os="windows";}else{if((/macintosh/i).test(C)){F.os="macintosh";}}if((/KHTML/).test(C)){F.webkit=1;}A=C.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){F.webkit=D(A[1]);if(/ Mobile\//.test(C)){F.mobile="Apple";}else{A=C.match(/NokiaN[^\/]*/);if(A){F.mobile=A[0];}}A=C.match(/AdobeAIR\/([^\s]*)/);if(A){F.air=A[0];}}if(!F.webkit){A=C.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){F.opera=D(A[1]);A=C.match(/Opera Mini[^;]*/);if(A){F.mobile=A[0];}}else{A=C.match(/MSIE\s([^;]*)/);if(A&&A[1]){F.ie=D(A[1]);}else{A=C.match(/Gecko\/([^\s]*)/);if(A){F.gecko=1;A=C.match(/rv:([^\s\)]*)/);if(A&&A[1]){F.gecko=D(A[1]);}}}}}}return F;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C++){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,A=Object.prototype,H="[object Array]",C="[object Function]",G="[object Object]",E=[],F=["toString","valueOf"],D={isArray:function(I){return A.toString.apply(I)===H;},isBoolean:function(I){return typeof I==="boolean";},isFunction:function(I){return(typeof I==="function")||A.toString.apply(I)===C;},isNull:function(I){return I===null;},isNumber:function(I){return typeof I==="number"&&isFinite(I);},isObject:function(I){return(I&&(typeof I==="object"||B.isFunction(I)))||false;},isString:function(I){return typeof I==="string";},isUndefined:function(I){return typeof I==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(K,J){var I,M,L;for(I=0;I<F.length;I=I+1){M=F[I];L=J[M];if(B.isFunction(L)&&L!=A[M]){K[M]=L;}}}:function(){},extend:function(L,M,K){if(!M||!L){throw new Error("extend failed, please check that "+"all dependencies are included.");}var J=function(){},I;J.prototype=M.prototype;L.prototype=new J();L.prototype.constructor=L;L.superclass=M.prototype;if(M.prototype.constructor==A.constructor){M.prototype.constructor=M;}if(K){for(I in K){if(B.hasOwnProperty(K,I)){L.prototype[I]=K[I];}}B._IEEnumFix(L.prototype,K);}},augmentObject:function(M,L){if(!L||!M){throw new Error("Absorb failed, verify dependencies.");}var I=arguments,K,N,J=I[2];if(J&&J!==true){for(K=2;K<I.length;K=K+1){M[I[K]]=L[I[K]];}}else{for(N in L){if(J||!(N in M)){M[N]=L[N];}}B._IEEnumFix(M,L);}},augmentProto:function(L,K){if(!K||!L){throw new Error("Augment failed, verify dependencies.");}var I=[L.prototype,K.prototype],J;for(J=2;J<arguments.length;J=J+1){I.push(arguments[J]);}B.augmentObject.apply(this,I);},dump:function(I,N){var K,M,P=[],Q="{...}",J="f(){...}",O=", ",L=" => ";if(!B.isObject(I)){return I+"";}else{if(I instanceof Date||("nodeType" in I&&"tagName" in I)){return I;}else{if(B.isFunction(I)){return J;}}}N=(B.isNumber(N))?N:3;if(B.isArray(I)){P.push("[");for(K=0,M=I.length;K<M;K=K+1){if(B.isObject(I[K])){P.push((N>0)?B.dump(I[K],N-1):Q);}else{P.push(I[K]);}P.push(O);}if(P.length>1){P.pop();}P.push("]");}else{P.push("{");for(K in I){if(B.hasOwnProperty(I,K)){P.push(K+L);if(B.isObject(I[K])){P.push((N>0)?B.dump(I[K],N-1):Q);}else{P.push(I[K]);}P.push(O);}}if(P.length>1){P.pop();}P.push("}");}return P.join("");},substitute:function(Y,J,R){var N,M,L,U,V,X,T=[],K,O="dump",S=" ",I="{",W="}",Q,P;for(;;){N=Y.lastIndexOf(I);if(N<0){break;}M=Y.indexOf(W,N);if(N+1>=M){break;}K=Y.substring(N+1,M);U=K;X=null;L=U.indexOf(S);if(L>-1){X=U.substring(L+1);U=U.substring(0,L);}V=J[U];if(R){V=R(U,V,X);}if(B.isObject(V)){if(B.isArray(V)){V=B.dump(V,parseInt(X,10));}else{X=X||"";Q=X.indexOf(O);if(Q>-1){X=X.substring(4);}P=V.toString();if(P===G||Q>-1){V=B.dump(V,parseInt(X,10));}else{V=P;}}}else{if(!B.isString(V)&&!B.isNumber(V)){V="~-"+T.length+"-~";T[T.length]=K;}}Y=Y.substring(0,N)+V+Y.substring(M+1);}for(N=T.length-1;N>=0;N=N-1){Y=Y.replace(new RegExp("~-"+N+"-~"),"{"+T[N]+"}","g");}return Y;},trim:function(I){try{return I.replace(/^\s+|\s+$/g,"");}catch(J){return I;}},merge:function(){var L={},J=arguments,I=J.length,K;for(K=0;K<I;K=K+1){B.augmentObject(L,J[K],true);}return L;},later:function(P,J,Q,L,M){P=P||0;J=J||{};var K=Q,O=L,N,I;if(B.isString(Q)){K=J[Q];}if(!K){throw new TypeError("method undefined");}if(O&&!B.isArray(O)){O=[L];}N=function(){K.apply(J,O||E);};I=(M)?setInterval(N,P):setTimeout(N,P);return{interval:M,cancel:function(){if(this.interval){clearInterval(I);}else{clearTimeout(I);}}};},isValue:function(I){return(B.isObject(I)||B.isString(I)||B.isNumber(I)||B.isBoolean(I));}};B.hasOwnProperty=(A.hasOwnProperty)?function(I,J){return I&&I.hasOwnProperty(J);}:function(I,J){return !B.isUndefined(I[J])&&I.constructor.prototype[J]!==I[J];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.8.0r4",build:"2449"}); 747 (function(){YAHOO.env._id_counter=YAHOO.env._id_counter||0;var E=YAHOO.util,L=YAHOO.lang,m=YAHOO.env.ua,A=YAHOO.lang.trim,d={},h={},N=/^t(?:able|d|h)$/i,X=/color$/i,K=window.document,W=K.documentElement,e="ownerDocument",n="defaultView",v="documentElement",t="compatMode",b="offsetLeft",P="offsetTop",u="offsetParent",Z="parentNode",l="nodeType",C="tagName",O="scrollLeft",i="scrollTop",Q="getBoundingClientRect",w="getComputedStyle",a="currentStyle",M="CSS1Compat",c="BackCompat",g="class",F="className",J="",B=" ",s="(?:^|\\s)",k="(?= |$)",U="g",p="position",f="fixed",V="relative",j="left",o="top",r="medium",q="borderLeftWidth",R="borderTopWidth",D=m.opera,I=m.webkit,H=m.gecko,T=m.ie;E.Dom={CUSTOM_ATTRIBUTES:(!W.hasAttribute)?{"for":"htmlFor","class":F}:{"htmlFor":"for","className":g},DOT_ATTRIBUTES:{},get:function(z){var AB,x,AA,y,Y,G;if(z){if(z[l]||z.item){return z;}if(typeof z==="string"){AB=z;z=K.getElementById(z);G=(z)?z.attributes:null;if(z&&G&&G.id&&G.id.value===AB){return z;}else{if(z&&K.all){z=null;x=K.all[AB];for(y=0,Y=x.length;y<Y;++y){if(x[y].id===AB){return x[y];}}}}return z;}if(YAHOO.util.Element&&z instanceof YAHOO.util.Element){z=z.get("element");}if("length" in z){AA=[];for(y=0,Y=z.length;y<Y;++y){AA[AA.length]=E.Dom.get(z[y]);}return AA;}return z;}return null;},getComputedStyle:function(G,Y){if(window[w]){return G[e][n][w](G,null)[Y];}else{if(G[a]){return E.Dom.IE_ComputedStyle.get(G,Y);}}},getStyle:function(G,Y){return E.Dom.batch(G,E.Dom._getStyle,Y);},_getStyle:function(){if(window[w]){return function(G,y){y=(y==="float")?y="cssFloat":E.Dom._toCamel(y);var x=G.style[y],Y;if(!x){Y=G[e][n][w](G,null);if(Y){x=Y[y];}}return x;};}else{if(W[a]){return function(G,y){var x;switch(y){case"opacity":x=100;try{x=G.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(z){try{x=G.filters("alpha").opacity;}catch(Y){}}return x/100;case"float":y="styleFloat";default:y=E.Dom._toCamel(y);x=G[a]?G[a][y]:null;return(G.style[y]||x);}};}}}(),setStyle:function(G,Y,x){E.Dom.batch(G,E.Dom._setStyle,{prop:Y,val:x});},_setStyle:function(){if(T){return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){switch(x){case"opacity":if(L.isString(Y.style.filter)){Y.style.filter="alpha(opacity="+y*100+")";if(!Y[a]||!Y[a].hasLayout){Y.style.zoom=1;}}break;case"float":x="styleFloat";default:Y.style[x]=y;}}else{}};}else{return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){if(x=="float"){x="cssFloat";}Y.style[x]=y;}else{}};}}(),getXY:function(G){return E.Dom.batch(G,E.Dom._getXY);},_canPosition:function(G){return(E.Dom._getStyle(G,"display")!=="none"&&E.Dom._inDoc(G));},_getXY:function(){if(K[v][Q]){return function(y){var z,Y,AA,AF,AE,AD,AC,G,x,AB=Math.floor,AG=false;if(E.Dom._canPosition(y)){AA=y[Q]();AF=y[e];z=E.Dom.getDocumentScrollLeft(AF);Y=E.Dom.getDocumentScrollTop(AF);AG=[AB(AA[j]),AB(AA[o])];if(T&&m.ie<8){AE=2;AD=2;AC=AF[t];if(m.ie===6){if(AC!==c){AE=0;AD=0;}}if((AC===c)){G=S(AF[v],q);x=S(AF[v],R);if(G!==r){AE=parseInt(G,10);}if(x!==r){AD=parseInt(x,10);}}AG[0]-=AE;AG[1]-=AD;}if((Y||z)){AG[0]+=z;AG[1]+=Y;}AG[0]=AB(AG[0]);AG[1]=AB(AG[1]);}else{}return AG;};}else{return function(y){var x,Y,AA,AB,AC,z=false,G=y;if(E.Dom._canPosition(y)){z=[y[b],y[P]];x=E.Dom.getDocumentScrollLeft(y[e]);Y=E.Dom.getDocumentScrollTop(y[e]);AC=((H||m.webkit>519)?true:false);while((G=G[u])){z[0]+=G[b];z[1]+=G[P];if(AC){z=E.Dom._calcBorders(G,z);}}if(E.Dom._getStyle(y,p)!==f){G=y;while((G=G[Z])&&G[C]){AA=G[i];AB=G[O];if(H&&(E.Dom._getStyle(G,"overflow")!=="visible")){z=E.Dom._calcBorders(G,z);}if(AA||AB){z[0]-=AB;z[1]-=AA;}}z[0]+=x;z[1]+=Y;}else{if(D){z[0]-=x;z[1]-=Y;}else{if(I||H){z[0]+=x;z[1]+=Y;}}}z[0]=Math.floor(z[0]);z[1]=Math.floor(z[1]);}else{}return z;};}}(),getX:function(G){var Y=function(x){return E.Dom.getXY(x)[0];};return E.Dom.batch(G,Y,E.Dom,true);},getY:function(G){var Y=function(x){return E.Dom.getXY(x)[1];};return E.Dom.batch(G,Y,E.Dom,true);},setXY:function(G,x,Y){E.Dom.batch(G,E.Dom._setXY,{pos:x,noRetry:Y});},_setXY:function(G,z){var AA=E.Dom._getStyle(G,p),y=E.Dom.setStyle,AD=z.pos,Y=z.noRetry,AB=[parseInt(E.Dom.getComputedStyle(G,j),10),parseInt(E.Dom.getComputedStyle(G,o),10)],AC,x;if(AA=="static"){AA=V;y(G,p,AA);}AC=E.Dom._getXY(G);if(!AD||AC===false){return false;}if(isNaN(AB[0])){AB[0]=(AA==V)?0:G[b];}if(isNaN(AB[1])){AB[1]=(AA==V)?0:G[P];}if(AD[0]!==null){y(G,j,AD[0]-AC[0]+AB[0]+"px");}if(AD[1]!==null){y(G,o,AD[1]-AC[1]+AB[1]+"px");}if(!Y){x=E.Dom._getXY(G);if((AD[0]!==null&&x[0]!=AD[0])||(AD[1]!==null&&x[1]!=AD[1])){E.Dom._setXY(G,{pos:AD,noRetry:true});}}},setX:function(Y,G){E.Dom.setXY(Y,[G,null]);},setY:function(G,Y){E.Dom.setXY(G,[null,Y]);},getRegion:function(G){var Y=function(x){var y=false;if(E.Dom._canPosition(x)){y=E.Region.getRegion(x);}else{}return y;};return E.Dom.batch(G,Y,E.Dom,true);},getClientWidth:function(){return E.Dom.getViewportWidth();},getClientHeight:function(){return E.Dom.getViewportHeight();},getElementsByClassName:function(AB,AF,AC,AE,x,AD){AF=AF||"*";AC=(AC)?E.Dom.get(AC):null||K;if(!AC){return[];}var Y=[],G=AC.getElementsByTagName(AF),z=E.Dom.hasClass;for(var y=0,AA=G.length;y<AA;++y){if(z(G[y],AB)){Y[Y.length]=G[y];}}if(AE){E.Dom.batch(Y,AE,x,AD);}return Y;},hasClass:function(Y,G){return E.Dom.batch(Y,E.Dom._hasClass,G);},_hasClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom._getAttribute(x,F)||J;if(Y.exec){G=Y.test(y);}else{G=Y&&(B+y+B).indexOf(B+Y+B)>-1;}}else{}return G;},addClass:function(Y,G){return E.Dom.batch(Y,E.Dom._addClass,G);},_addClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom._getAttribute(x,F)||J;if(!E.Dom._hasClass(x,Y)){E.Dom.setAttribute(x,F,A(y+B+Y));G=true;}}else{}return G;},removeClass:function(Y,G){return E.Dom.batch(Y,E.Dom._removeClass,G);},_removeClass:function(y,x){var Y=false,AA,z,G;if(y&&x){AA=E.Dom._getAttribute(y,F)||J;E.Dom.setAttribute(y,F,AA.replace(E.Dom._getClassRegex(x),J));z=E.Dom._getAttribute(y,F);if(AA!==z){E.Dom.setAttribute(y,F,A(z));Y=true;if(E.Dom._getAttribute(y,F)===""){G=(y.hasAttribute&&y.hasAttribute(g))?g:F; 748 y.removeAttribute(G);}}}else{}return Y;},replaceClass:function(x,Y,G){return E.Dom.batch(x,E.Dom._replaceClass,{from:Y,to:G});},_replaceClass:function(y,x){var Y,AB,AA,G=false,z;if(y&&x){AB=x.from;AA=x.to;if(!AA){G=false;}else{if(!AB){G=E.Dom._addClass(y,x.to);}else{if(AB!==AA){z=E.Dom._getAttribute(y,F)||J;Y=(B+z.replace(E.Dom._getClassRegex(AB),B+AA)).split(E.Dom._getClassRegex(AA));Y.splice(1,0,B+AA);E.Dom.setAttribute(y,F,A(Y.join(J)));G=true;}}}}else{}return G;},generateId:function(G,x){x=x||"yui-gen";var Y=function(y){if(y&&y.id){return y.id;}var z=x+YAHOO.env._id_counter++;if(y){if(y[e]&&y[e].getElementById(z)){return E.Dom.generateId(y,z+x);}y.id=z;}return z;};return E.Dom.batch(G,Y,E.Dom,true)||Y.apply(E.Dom,arguments);},isAncestor:function(Y,x){Y=E.Dom.get(Y);x=E.Dom.get(x);var G=false;if((Y&&x)&&(Y[l]&&x[l])){if(Y.contains&&Y!==x){G=Y.contains(x);}else{if(Y.compareDocumentPosition){G=!!(Y.compareDocumentPosition(x)&16);}}}else{}return G;},inDocument:function(G,Y){return E.Dom._inDoc(E.Dom.get(G),Y);},_inDoc:function(Y,x){var G=false;if(Y&&Y[C]){x=x||Y[e];G=E.Dom.isAncestor(x[v],Y);}else{}return G;},getElementsBy:function(Y,AF,AB,AD,y,AC,AE){AF=AF||"*";AB=(AB)?E.Dom.get(AB):null||K;if(!AB){return[];}var x=[],G=AB.getElementsByTagName(AF);for(var z=0,AA=G.length;z<AA;++z){if(Y(G[z])){if(AE){x=G[z];break;}else{x[x.length]=G[z];}}}if(AD){E.Dom.batch(x,AD,y,AC);}return x;},getElementBy:function(x,G,Y){return E.Dom.getElementsBy(x,G,Y,null,null,null,true);},batch:function(x,AB,AA,z){var y=[],Y=(z)?AA:window;x=(x&&(x[C]||x.item))?x:E.Dom.get(x);if(x&&AB){if(x[C]||x.length===undefined){return AB.call(Y,x,AA);}for(var G=0;G<x.length;++G){y[y.length]=AB.call(Y,x[G],AA);}}else{return false;}return y;},getDocumentHeight:function(){var Y=(K[t]!=M||I)?K.body.scrollHeight:W.scrollHeight,G=Math.max(Y,E.Dom.getViewportHeight());return G;},getDocumentWidth:function(){var Y=(K[t]!=M||I)?K.body.scrollWidth:W.scrollWidth,G=Math.max(Y,E.Dom.getViewportWidth());return G;},getViewportHeight:function(){var G=self.innerHeight,Y=K[t];if((Y||T)&&!D){G=(Y==M)?W.clientHeight:K.body.clientHeight;}return G;},getViewportWidth:function(){var G=self.innerWidth,Y=K[t];if(Y||T){G=(Y==M)?W.clientWidth:K.body.clientWidth;}return G;},getAncestorBy:function(G,Y){while((G=G[Z])){if(E.Dom._testElement(G,Y)){return G;}}return null;},getAncestorByClassName:function(Y,G){Y=E.Dom.get(Y);if(!Y){return null;}var x=function(y){return E.Dom.hasClass(y,G);};return E.Dom.getAncestorBy(Y,x);},getAncestorByTagName:function(Y,G){Y=E.Dom.get(Y);if(!Y){return null;}var x=function(y){return y[C]&&y[C].toUpperCase()==G.toUpperCase();};return E.Dom.getAncestorBy(Y,x);},getPreviousSiblingBy:function(G,Y){while(G){G=G.previousSibling;if(E.Dom._testElement(G,Y)){return G;}}return null;},getPreviousSibling:function(G){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getPreviousSiblingBy(G);},getNextSiblingBy:function(G,Y){while(G){G=G.nextSibling;if(E.Dom._testElement(G,Y)){return G;}}return null;},getNextSibling:function(G){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getNextSiblingBy(G);},getFirstChildBy:function(G,x){var Y=(E.Dom._testElement(G.firstChild,x))?G.firstChild:null;return Y||E.Dom.getNextSiblingBy(G.firstChild,x);},getFirstChild:function(G,Y){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getFirstChildBy(G);},getLastChildBy:function(G,x){if(!G){return null;}var Y=(E.Dom._testElement(G.lastChild,x))?G.lastChild:null;return Y||E.Dom.getPreviousSiblingBy(G.lastChild,x);},getLastChild:function(G){G=E.Dom.get(G);return E.Dom.getLastChildBy(G);},getChildrenBy:function(Y,y){var x=E.Dom.getFirstChildBy(Y,y),G=x?[x]:[];E.Dom.getNextSiblingBy(x,function(z){if(!y||y(z)){G[G.length]=z;}return false;});return G;},getChildren:function(G){G=E.Dom.get(G);if(!G){}return E.Dom.getChildrenBy(G);},getDocumentScrollLeft:function(G){G=G||K;return Math.max(G[v].scrollLeft,G.body.scrollLeft);},getDocumentScrollTop:function(G){G=G||K;return Math.max(G[v].scrollTop,G.body.scrollTop);},insertBefore:function(Y,G){Y=E.Dom.get(Y);G=E.Dom.get(G);if(!Y||!G||!G[Z]){return null;}return G[Z].insertBefore(Y,G);},insertAfter:function(Y,G){Y=E.Dom.get(Y);G=E.Dom.get(G);if(!Y||!G||!G[Z]){return null;}if(G.nextSibling){return G[Z].insertBefore(Y,G.nextSibling);}else{return G[Z].appendChild(Y);}},getClientRegion:function(){var x=E.Dom.getDocumentScrollTop(),Y=E.Dom.getDocumentScrollLeft(),y=E.Dom.getViewportWidth()+Y,G=E.Dom.getViewportHeight()+x;return new E.Region(x,y,G,Y);},setAttribute:function(Y,G,x){E.Dom.batch(Y,E.Dom._setAttribute,{attr:G,val:x});},_setAttribute:function(x,Y){var G=E.Dom._toCamel(Y.attr),y=Y.val;if(x&&x.setAttribute){if(E.Dom.DOT_ATTRIBUTES[G]){x[G]=y;}else{G=E.Dom.CUSTOM_ATTRIBUTES[G]||G;x.setAttribute(G,y);}}else{}},getAttribute:function(Y,G){return E.Dom.batch(Y,E.Dom._getAttribute,G);},_getAttribute:function(Y,G){var x;G=E.Dom.CUSTOM_ATTRIBUTES[G]||G;if(Y&&Y.getAttribute){x=Y.getAttribute(G,2);}else{}return x;},_toCamel:function(Y){var x=d;function G(y,z){return z.toUpperCase();}return x[Y]||(x[Y]=Y.indexOf("-")===-1?Y:Y.replace(/-([a-z])/gi,G));},_getClassRegex:function(Y){var G;if(Y!==undefined){if(Y.exec){G=Y;}else{G=h[Y];if(!G){Y=Y.replace(E.Dom._patterns.CLASS_RE_TOKENS,"\\$1");G=h[Y]=new RegExp(s+Y+k,U);}}}return G;},_patterns:{ROOT_TAG:/^body|html$/i,CLASS_RE_TOKENS:/([\.\(\)\^\$\*\+\?\|\[\]\{\}\\])/g},_testElement:function(G,Y){return G&&G[l]==1&&(!Y||Y(G));},_calcBorders:function(x,y){var Y=parseInt(E.Dom[w](x,R),10)||0,G=parseInt(E.Dom[w](x,q),10)||0;if(H){if(N.test(x[C])){Y=0;G=0;}}y[0]+=G;y[1]+=Y;return y;}};var S=E.Dom[w];if(m.opera){E.Dom[w]=function(Y,G){var x=S(Y,G);if(X.test(G)){x=E.Dom.Color.toRGB(x);}return x;};}if(m.webkit){E.Dom[w]=function(Y,G){var x=S(Y,G);if(x==="rgba(0, 0, 0, 0)"){x="transparent";}return x;};}if(m.ie&&m.ie>=8&&K.documentElement.hasAttribute){E.Dom.DOT_ATTRIBUTES.type=true;}})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this.y=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this.x=B;this[0]=B; 749 this.width=this.right-this.left;this.height=this.bottom-this.top;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top),D=Math.min(this.right,E.right),A=Math.min(this.bottom,E.bottom),B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top),D=Math.max(this.right,E.right),A=Math.max(this.bottom,E.bottom),B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+", height: "+this.height+", width: "+this.width+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D),C=F[1],E=F[0]+D.offsetWidth,A=F[1]+D.offsetHeight,B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}YAHOO.util.Point.superclass.constructor.call(this,B,A,B,A);};YAHOO.extend(YAHOO.util.Point,YAHOO.util.Region);(function(){var B=YAHOO.util,A="clientTop",F="clientLeft",J="parentNode",K="right",W="hasLayout",I="px",U="opacity",L="auto",D="borderLeftWidth",G="borderTopWidth",P="borderRightWidth",V="borderBottomWidth",S="visible",Q="transparent",N="height",E="width",H="style",T="currentStyle",R=/^width|height$/,O=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,M={get:function(X,Z){var Y="",a=X[T][Z];if(Z===U){Y=B.Dom.getStyle(X,U);}else{if(!a||(a.indexOf&&a.indexOf(I)>-1)){Y=a;}else{if(B.Dom.IE_COMPUTED[Z]){Y=B.Dom.IE_COMPUTED[Z](X,Z);}else{if(O.test(a)){Y=B.Dom.IE.ComputedStyle.getPixel(X,Z);}else{Y=a;}}}}return Y;},getOffset:function(Z,e){var b=Z[T][e],X=e.charAt(0).toUpperCase()+e.substr(1),c="offset"+X,Y="pixel"+X,a="",d;if(b==L){d=Z[c];if(d===undefined){a=0;}a=d;if(R.test(e)){Z[H][e]=d;if(Z[c]>d){a=d-(Z[c]-d);}Z[H][e]=L;}}else{if(!Z[H][Y]&&!Z[H][e]){Z[H][e]=b;}a=Z[H][Y];}return a+I;},getBorderWidth:function(X,Z){var Y=null;if(!X[T][W]){X[H].zoom=1;}switch(Z){case G:Y=X[A];break;case V:Y=X.offsetHeight-X.clientHeight-X[A];break;case D:Y=X[F];break;case P:Y=X.offsetWidth-X.clientWidth-X[F];break;}return Y+I;},getPixel:function(Y,X){var a=null,b=Y[T][K],Z=Y[T][X];Y[H][K]=Z;a=Y[H].pixelRight;Y[H][K]=b;return a+I;},getMargin:function(Y,X){var Z;if(Y[T][X]==L){Z=0+I;}else{Z=B.Dom.IE.ComputedStyle.getPixel(Y,X);}return Z;},getVisibility:function(Y,X){var Z;while((Z=Y[T])&&Z[X]=="inherit"){Y=Y[J];}return(Z)?Z[X]:S;},getColor:function(Y,X){return B.Dom.Color.toRGB(Y[T][X])||Q;},getBorderColor:function(Y,X){var Z=Y[T],a=Z[X]||Z.color;return B.Dom.Color.toRGB(B.Dom.Color.toHex(a));}},C={};C.top=C.right=C.bottom=C.left=C[E]=C[N]=M.getOffset;C.color=M.getColor;C[G]=C[P]=C[V]=C[D]=M.getBorderWidth;C.marginTop=C.marginRight=C.marginBottom=C.marginLeft=M.getMargin;C.visibility=M.getVisibility;C.borderColor=C.borderTopColor=C.borderRightColor=C.borderBottomColor=C.borderLeftColor=M.getBorderColor;B.Dom.IE_COMPUTED=C;B.Dom.IE_ComputedStyle=M;})();(function(){var C="toString",A=parseInt,B=RegExp,D=YAHOO.util;D.Dom.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(E){if(!D.Dom.Color.re_RGB.test(E)){E=D.Dom.Color.toHex(E);}if(D.Dom.Color.re_hex.exec(E)){E="rgb("+[A(B.$1,16),A(B.$2,16),A(B.$3,16)].join(", ")+")";}return E;},toHex:function(H){H=D.Dom.Color.KEYWORDS[H]||H;if(D.Dom.Color.re_RGB.exec(H)){var G=(B.$1.length===1)?"0"+B.$1:Number(B.$1),F=(B.$2.length===1)?"0"+B.$2:Number(B.$2),E=(B.$3.length===1)?"0"+B.$3:Number(B.$3);H=[G[C](16),F[C](16),E[C](16)].join("");}if(H.length<6){H=H.replace(D.Dom.Color.re_hex3,"$1$1");}if(H!=="transparent"&&H.indexOf("#")<0){H="#"+H;}return H.toLowerCase();}};}());YAHOO.register("dom",YAHOO.util.Dom,{version:"2.8.0r4",build:"2449"});YAHOO.util.CustomEvent=function(D,C,B,A,E){this.type=D;this.scope=C||window;this.silent=B;this.fireOnce=E;this.fired=false;this.firedWith=null;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var F="_YUICEOnSubscribe";if(D!==F){this.subscribeEvent=new YAHOO.util.CustomEvent(F,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,D){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,D);}var A=new YAHOO.util.Subscriber(B,C,D);if(this.fireOnce&&this.fired){this.notify(A,this.firedWith);}else{this.subscribers.push(A);}},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var H=[],A=this.subscribers.length;var D=[].slice.call(arguments,0),C=true,F,B=false;if(this.fireOnce){if(this.fired){return true;}else{this.firedWith=D;}}this.fired=true;if(!A&&this.silent){return true;}if(!this.silent){}var E=this.subscribers.slice();for(F=0;F<A;++F){var G=E[F];if(!G){B=true;}else{C=this.notify(G,D);if(false===C){if(!this.silent){}break;}}}return(C!==false);},notify:function(F,C){var B,H=null,E=F.getScope(this.scope),A=YAHOO.util.Event.throwErrors;if(!this.silent){}if(this.signature==YAHOO.util.CustomEvent.FLAT){if(C.length>0){H=C[0];}try{B=F.fn.call(E,H,F.obj);}catch(G){this.lastError=G;if(A){throw G;}}}else{try{B=F.fn.call(E,this.type,C,F.obj);}catch(D){this.lastError=D;if(A){throw D;}}}return B;},unsubscribeAll:function(){var A=this.subscribers.length,B;for(B=A-1;B>-1;B--){this._delete(B);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"context: "+this.scope;}};YAHOO.util.Subscriber=function(A,B,C){this.fn=A;this.obj=YAHOO.lang.isUndefined(B)?null:B;this.overrideContext=C;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.overrideContext){if(this.overrideContext===true){return this.obj;}else{return this.overrideContext;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var G=false,H=[],J=[],A=0,E=[],B=0,C={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},D=YAHOO.env.ua.ie,F="focusin",I="focusout";return{POLL_RETRYS:500,POLL_INTERVAL:40,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:D,_interval:null,_dri:null,_specialTypes:{focusin:(D?"focusin":"focus"),focusout:(D?"focusout":"blur")},DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){this._interval=YAHOO.lang.later(this.POLL_INTERVAL,this,this._tryPreloadAttach,null,true);}},onAvailable:function(Q,M,O,P,N){var K=(YAHOO.lang.isString(Q))?[Q]:Q;for(var L=0;L<K.length;L=L+1){E.push({id:K[L],fn:M,obj:O,overrideContext:P,checkReady:N});}A=this.POLL_RETRYS;this.startInterval();},onContentReady:function(N,K,L,M){this.onAvailable(N,K,L,M,true);},onDOMReady:function(){this.DOMReadyEvent.subscribe.apply(this.DOMReadyEvent,arguments);},_addListener:function(M,K,V,P,T,Y){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var Q=0,S=M.length;Q<S;++Q){W=this.on(M[Q],K,V,P,T)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var O=this.getEl(M);if(O){M=O;}else{this.onAvailable(M,function(){YAHOO.util.Event._addListener(M,K,V,P,T,Y);});return true;}}}if(!M){return false;}if("unload"==K&&P!==this){J[J.length]=[M,K,V,P,T];return true;}var L=M;if(T){if(T===true){L=P;}else{L=T;}}var N=function(Z){return V.call(L,YAHOO.util.Event.getEvent(Z,M),P);};var X=[M,K,V,N,L,P,T,Y];var R=H.length;H[R]=X;try{this._simpleAdd(M,K,N,Y);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}return true;},_getType:function(K){return this._specialTypes[K]||K;},addListener:function(M,P,L,N,O){var K=((P==F||P==I)&&!YAHOO.env.ua.ie)?true:false;return this._addListener(M,this._getType(P),L,N,O,K);},addFocusListener:function(L,K,M,N){return this.on(L,F,K,M,N);},removeFocusListener:function(L,K){return this.removeListener(L,F,K);},addBlurListener:function(L,K,M,N){return this.on(L,I,K,M,N);},removeBlurListener:function(L,K){return this.removeListener(L,I,K);},removeListener:function(L,K,R){var M,P,U;K=this._getType(K);if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var S=true;for(M=L.length-1;M>-1;M--){S=(this.removeListener(L[M],K,R)&&S);}return S;}}if(!R||!R.call){return this.purgeElement(L,false,K);}if("unload"==K){for(M=J.length-1;M>-1;M--){U=J[M];if(U&&U[0]==L&&U[1]==K&&U[2]==R){J.splice(M,1);return true;}}return false;}var N=null;var O=arguments[3];if("undefined"===typeof O){O=this._getCacheIndex(H,L,K,R);}if(O>=0){N=H[O];}if(!L||!N){return false;}var T=N[this.CAPTURE]===true?true:false;try{this._simpleRemove(L,K,N[this.WFN],T);}catch(Q){this.lastError=Q;return false;}delete H[O][this.WFN];delete H[O][this.FN];H.splice(O,1);return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];},getRelatedTarget:function(L){var K=L.relatedTarget;if(!K){if(L.type=="mouseout"){K=L.toElement; 750 }else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break;}N=N.caller;}}return L;},getCharCode:function(L){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in C)){K=C[K];}return K;},_getCacheIndex:function(M,P,Q,O){for(var N=0,L=M.length;N<L;N=N+1){var K=M[N];if(K&&K[this.FN]==O&&K[this.EL]==P&&K[this.TYPE]==Q){return N;}}return -1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+B;++B;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",YAHOO,0,0,1),_load:function(L){if(!G){G=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(E.length===0){A=0;if(this._interval){this._interval.cancel();this._interval=null;}return;}if(this.locked){return;}if(this.isIE){if(!this.DOMReady){this.startInterval();return;}}this.locked=true;var Q=!G;if(!Q){Q=(A>0&&E.length>0);}var P=[];var R=function(T,U){var S=T;if(U.overrideContext){if(U.overrideContext===true){S=U.obj;}else{S=U.overrideContext;}}U.fn.call(S,U.obj);};var L,K,O,N,M=[];for(L=0,K=E.length;L<K;L=L+1){O=E[L];if(O){N=this.getEl(O.id);if(N){if(O.checkReady){if(G||N.nextSibling||!Q){M.push(O);E[L]=null;}}else{R(N,O);E[L]=null;}}else{P.push(O);}}}for(L=0,K=M.length;L<K;L=L+1){O=M[L];R(this.getEl(O.id),O);}A--;if(Q){for(L=E.length-1;L>-1;L--){O=E[L];if(!O||!O.id){E.splice(L,1);}}this.startInterval();}else{if(this._interval){this._interval.cancel();this._interval=null;}}this.locked=false;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=Q.length-1;N>-1;N--){var L=Q[N];this.removeListener(M,L.type,L.fn);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[H,J];}else{if(K==="unload"){L=[J];}else{K=this._getType(K);L=[H];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(R){var L=YAHOO.util.Event,O,N,M,Q,P,S=J.slice(),K;for(O=0,Q=J.length;O<Q;++O){M=S[O];if(M){K=window;if(M[L.ADJ_SCOPE]){if(M[L.ADJ_SCOPE]===true){K=M[L.UNLOAD_OBJ];}else{K=M[L.ADJ_SCOPE];}}M[L.FN].call(K,L.getEvent(R,M[L.EL]),M[L.UNLOAD_OBJ]);S[O]=null;}}M=null;K=null;J=null;if(H){for(N=H.length-1;N>-1;N--){M=H[N];if(M){L.removeListener(M[L.EL],M[L.TYPE],M[L.FN],N);}}M=null;}L._simpleRemove(window,"unload",L._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener; 751 /* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */ 752 if(EU.isIE){if(self!==self.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;EU._ready();}};}else{YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,overrideContext:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A); 753 },createEvent:function(B,G){this.__yui_events=this.__yui_events||{};var E=G||{},D=this.__yui_events,F;if(D[B]){}else{F=new YAHOO.util.CustomEvent(B,E.scope||this,E.silent,YAHOO.util.CustomEvent.FLAT,E.fireOnce);D[B]=F;if(E.onSubscribeCallback){F.subscribeEvent.subscribe(E.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var A=this.__yui_subscribers[B];if(A){for(var C=0;C<A.length;++C){F.subscribe(A[C].fn,A[C].obj,A[C].overrideContext);}}}return D[B];},fireEvent:function(B){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[B];if(!D){return null;}var A=[];for(var C=1;C<arguments.length;++C){A.push(arguments[C]);}return D.fire.apply(D,A);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};(function(){var A=YAHOO.util.Event,C=YAHOO.lang;YAHOO.util.KeyListener=function(D,I,E,F){if(!D){}else{if(!I){}else{if(!E){}}}if(!F){F=YAHOO.util.KeyListener.KEYDOWN;}var G=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(C.isString(D)){D=document.getElementById(D);}if(C.isFunction(E)){G.subscribe(E);}else{G.subscribe(E.fn,E.scope,E.correctScope);}function H(O,N){if(!I.shift){I.shift=false;}if(!I.alt){I.alt=false;}if(!I.ctrl){I.ctrl=false;}if(O.shiftKey==I.shift&&O.altKey==I.alt&&O.ctrlKey==I.ctrl){var J,M=I.keys,L;if(YAHOO.lang.isArray(M)){for(var K=0;K<M.length;K++){J=M[K];L=A.getCharCode(O);if(J==L){G.fire(L,O);break;}}}else{L=A.getCharCode(O);if(M==L){G.fire(L,O);}}}}this.enable=function(){if(!this.enabled){A.on(D,F,H);this.enabledEvent.fire(I);}this.enabled=true;};this.disable=function(){if(this.enabled){A.removeListener(D,F,H);this.disabledEvent.fire(I);}this.enabled=false;};this.toString=function(){return"KeyListener ["+I.keys+"] "+D.tagName+(D.id?"["+D.id+"]":"");};};var B=YAHOO.util.KeyListener;B.KEYDOWN="keydown";B.KEYUP="keyup";B.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};})();YAHOO.register("event",YAHOO.util.Event,{version:"2.8.0r4",build:"2449"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.8.0r4", build: "2449"}); 754 /* 755 Copyright (c) 2009, Yahoo! Inc. All rights reserved. 756 Code licensed under the BSD License: 757 http://developer.yahoo.net/yui/license.txt 758 version: 2.8.0r4 759 */ 760 (function(){var B=YAHOO.util;var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);};A.NAME="Anim";A.prototype={toString:function(){var C=this.getEl()||{};var D=C.id||C.tagName;return(this.constructor.NAME+": "+D);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},setAttribute:function(C,F,E){var D=this.getEl();if(this.patterns.noNegatives.test(C)){F=(F>0)?F:0;}if(C in D&&!("style" in D&&C in D.style)){D[C]=F;}else{B.Dom.setStyle(D,C,F+E);}},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if("style" in E){if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}}else{if(C in E){G=E[C];}}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G<C;++G){E[G]=I[G]+F[D]["by"][G]*1;}}else{E=I+F[D]["by"]*1;}}}this.runtimeAttributes[D].start=I;this.runtimeAttributes[D].end=E;this.runtimeAttributes[D].unit=(H(F[D].unit))?F[D]["unit"]:this.getDefaultUnit(D);return true;},init:function(E,J,I,C){var D=false;var F=null;var H=0;E=B.Dom.get(E);this.attributes=J||{};this.duration=!YAHOO.lang.isUndefined(I)?I:1;this.method=C||B.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=B.AnimMgr.fps;this.setEl=function(M){E=B.Dom.get(M);};this.getEl=function(){return E;};this.isAnimated=function(){return D;};this.getStartTime=function(){return F;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(B.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}B.AnimMgr.registerElement(this);return true;};this.stop=function(M){if(!this.isAnimated()){return false;}if(M){this.currentFrame=this.totalFrames;this._onTween.fire();}B.AnimMgr.stop(this);};var L=function(){this.onStart.fire();this.runtimeAttributes={};for(var M in this.attributes){this.setRuntimeAttribute(M);}D=true;H=0;F=new Date();};var K=function(){var O={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};O.toString=function(){return("duration: "+O.duration+", currentFrame: "+O.currentFrame);};this.onTween.fire(O);var N=this.runtimeAttributes;for(var M in N){this.setAttribute(M,this.doMethod(M,N[M].start,N[M].end),N[M].unit);}H+=1;};var G=function(){var M=(new Date()-F)/1000;var N={duration:M,frames:H,fps:H/M};N.toString=function(){return("duration: "+N.duration+", frames: "+N.frames+", fps: "+N.fps);};D=false;H=0;this.onComplete.fire(N);};this._onStart=new B.CustomEvent("_start",this,true);this.onStart=new B.CustomEvent("start",this);this.onTween=new B.CustomEvent("tween",this);this._onTween=new B.CustomEvent("_tween",this,true);this.onComplete=new B.CustomEvent("complete",this);this._onComplete=new B.CustomEvent("_complete",this,true);this._onStart.subscribe(L);this._onTween.subscribe(K);this._onComplete.subscribe(G);}};B.Anim=A;})();YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){F=F||E(G);if(!G.isAnimated()||F===-1){return false;}G._onComplete.fire();B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]===H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};this._queue=B;this._getIndex=E;};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){var A=function(F,E,G,H){A.superclass.constructor.call(this,F,E,G,H);};A.NAME="ColorAnim";A.DEFAULT_BGCOLOR="#fff";var C=YAHOO.util;YAHOO.extend(A,C.Anim);var D=A.superclass;var B=A.prototype;B.patterns.color=/color$/i;B.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;B.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;B.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;B.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;B.parseColor=function(E){if(E.length==3){return E;}var F=this.patterns.hex.exec(E);if(F&&F.length==4){return[parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16)];}F=this.patterns.rgb.exec(E);if(F&&F.length==4){return[parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10)];}F=this.patterns.hex3.exec(E);if(F&&F.length==4){return[parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16)]; 761 }return null;};B.getAttribute=function(E){var G=this.getEl();if(this.patterns.color.test(E)){var I=YAHOO.util.Dom.getStyle(G,E);var H=this;if(this.patterns.transparent.test(I)){var F=YAHOO.util.Dom.getAncestorBy(G,function(J){return !H.patterns.transparent.test(I);});if(F){I=C.Dom.getStyle(F,E);}else{I=A.DEFAULT_BGCOLOR;}}}else{I=D.getAttribute.call(this,E);}return I;};B.doMethod=function(F,J,G){var I;if(this.patterns.color.test(F)){I=[];for(var H=0,E=J.length;H<E;++H){I[H]=D.doMethod.call(this,F,J[H],G[H]);}I="rgb("+Math.floor(I[0])+","+Math.floor(I[1])+","+Math.floor(I[2])+")";}else{I=D.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(F){D.setRuntimeAttribute.call(this,F);if(this.patterns.color.test(F)){var H=this.attributes;var J=this.parseColor(this.runtimeAttributes[F].start);var G=this.parseColor(this.runtimeAttributes[F].end);if(typeof H[F]["to"]==="undefined"&&typeof H[F]["by"]!=="undefined"){G=this.parseColor(H[F].by);for(var I=0,E=J.length;I<E;++I){G[I]=J[I]+G[I];}}this.runtimeAttributes[F].start=J;this.runtimeAttributes[F].end=G;}};C.ColorAnim=A;})(); 762 /* 763 TERMS OF USE - EASING EQUATIONS 764 Open source under the BSD License. 765 Copyright 2001 Robert Penner All rights reserved. 766 767 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 768 769 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 770 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 771 * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. 772 773 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 774 */ 775 YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){var A=function(H,G,I,J){if(H){A.superclass.constructor.call(this,H,G,I,J);}};A.NAME="Motion";var E=YAHOO.util;YAHOO.extend(A,E.ColorAnim);var F=A.superclass;var C=A.prototype;C.patterns.points=/^points$/i;C.setAttribute=function(G,I,H){if(this.patterns.points.test(G)){H=H||"px";F.setAttribute.call(this,"left",I[0],H);F.setAttribute.call(this,"top",I[1],H);}else{F.setAttribute.call(this,G,I,H);}};C.getAttribute=function(G){if(this.patterns.points.test(G)){var H=[F.getAttribute.call(this,"left"),F.getAttribute.call(this,"top")];}else{H=F.getAttribute.call(this,G);}return H;};C.doMethod=function(G,K,H){var J=null;if(this.patterns.points.test(G)){var I=this.method(this.currentFrame,0,100,this.totalFrames)/100;J=E.Bezier.getPosition(this.runtimeAttributes[G],I);}else{J=F.doMethod.call(this,G,K,H);}return J;};C.setRuntimeAttribute=function(P){if(this.patterns.points.test(P)){var H=this.getEl();var J=this.attributes;var G;var L=J["points"]["control"]||[];var I;var M,O;if(L.length>0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M<O;++M){K[M]=L[M];}L=K;}if(E.Dom.getStyle(H,"position")=="static"){E.Dom.setStyle(H,"position","relative");}if(D(J["points"]["from"])){E.Dom.setXY(H,J["points"]["from"]); 776 }else{E.Dom.setXY(H,E.Dom.getXY(H));}G=this.getAttribute("points");if(D(J["points"]["to"])){I=B.call(this,J["points"]["to"],G);var N=E.Dom.getXY(this.getEl());for(M=0,O=L.length;M<O;++M){L[M]=B.call(this,L[M],G);}}else{if(D(J["points"]["by"])){I=[G[0]+J["points"]["by"][0],G[1]+J["points"]["by"][1]];for(M=0,O=L.length;M<O;++M){L[M]=[G[0]+L[M][0],G[1]+L[M][1]];}}}this.runtimeAttributes[P]=[G];if(L.length>0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.8.0r4",build:"2449"});/* 777 Copyright (c) 2009, Yahoo! Inc. All rights reserved. 778 Code licensed under the BSD License: 779 http://developer.yahoo.net/yui/license.txt 780 version: 2.8.0r4 781 */ 782 (function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){if(B.hasOwnProperty(this.config,D)){this.refireEvent(D);}}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.eventQueue[E]=null;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(D,E,G,H){var F=this.config[D.toLowerCase()];if(F&&F.event){if(!A.alreadySubscribed(F.event,E,G)){F.event.subscribe(E,G,H);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,WEEK_ONE_JAN_DATE:1,add:function(A,D,C){var F=new Date(A.getTime());switch(D){case this.MONTH:var E=A.getMonth()+C;var B=0;if(E<0){while(E<0){E+=12;B-=1;}}else{if(E>11){while(E>11){E-=12;B+=1;}}}F.setMonth(E);F.setFullYear(A.getFullYear()+B);break;case this.DAY:this._addDays(F,C);break;case this.YEAR:F.setFullYear(A.getFullYear()+C);break;case this.WEEK:this._addDays(F,(C*7));break;}return F;},_addDays:function(D,C){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){if(C<0){for(var B=-128;C<B;C-=B){D.setDate(D.getDate()+B);}}else{for(var A=96;C>A;C-=A){D.setDate(D.getDate()+A);}}}D.setDate(D.getDate()+C);},subtract:function(A,C,B){return this.add(A,C,(B*-1));},before:function(C,B){var A=B.getTime();if(C.getTime()<A){return true;}else{return false;}},after:function(C,B){var A=B.getTime();if(C.getTime()>A){return true;}else{return false;}},between:function(B,A,C){if(this.after(B,A)&&this.before(B,C)){return true;}else{return false;}},getJan1:function(A){return this.getDate(A,0,1);},getDayOffset:function(B,D){var C=this.getJan1(D);var A=Math.ceil((B.getTime()-C.getTime())/this.ONE_DAY_MS);return A;},getWeekNumber:function(D,B,G){B=B||0;G=G||this.WEEK_ONE_JAN_DATE;var H=this.clearTime(D),L,M;if(H.getDay()===B){L=H;}else{L=this.getFirstDayOfWeek(H,B);}var I=L.getFullYear();M=new Date(L.getTime()+6*this.ONE_DAY_MS);var F;if(I!==M.getFullYear()&&M.getDate()>=G){F=1;}else{var E=this.clearTime(this.getDate(I,0,G)),A=this.getFirstDayOfWeek(E,B);var J=Math.round((H.getTime()-A.getTime())/this.ONE_DAY_MS);var K=J%7;var C=(J-K)/7; 783 F=C+1;}return F;},getFirstDayOfWeek:function(D,A){A=A||0;var B=D.getDay(),C=(B-A+7)%7;return this.subtract(D,this.DAY,C);},isYearOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getFullYear()!=A.getFullYear()){C=true;}return C;},isMonthOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getMonth()!=A.getMonth()){C=true;}return C;},findMonthStart:function(A){var B=this.getDate(A.getFullYear(),A.getMonth(),1);return B;},findMonthEnd:function(B){var D=this.findMonthStart(B);var C=this.add(D,this.MONTH,1);var A=this.subtract(C,this.DAY,1);return A;},clearTime:function(A){A.setHours(12,0,0,0);return A;},getDate:function(D,A,C){var B=null;if(YAHOO.lang.isUndefined(C)){C=1;}if(D>=100){B=new Date(D,A,C);}else{B=new Date();B.setFullYear(D);B.setMonth(A);B.setDate(C);B.setHours(0,0,0,0);}return B;}};(function(){var C=YAHOO.util.Dom,A=YAHOO.util.Event,E=YAHOO.lang,D=YAHOO.widget.DateMath;function F(I,G,H){this.init.apply(this,arguments);}F.IMG_ROOT=null;F.DATE="D";F.MONTH_DAY="MD";F.WEEKDAY="WD";F.RANGE="R";F.MONTH="M";F.DISPLAY_DAYS=42;F.STOP_RENDER="S";F.SHORT="short";F.LONG="long";F.MEDIUM="medium";F.ONE_CHAR="1char";F.DEFAULT_CONFIG={YEAR_OFFSET:{key:"year_offset",value:0,supercedes:["pagedate","selected","mindate","maxdate"]},TODAY:{key:"today",value:new Date(),supercedes:["pagedate"]},PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:[]},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};F._DEFAULT_CONFIG=F.DEFAULT_CONFIG;var B=F.DEFAULT_CONFIG;F._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};F.STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4",CSS_WITH_TITLE:"withtitle",CSS_FIXED_SIZE:"fixedsize",CSS_LINK_CLOSE:"link-close"};F._STYLES=F.STYLES;F.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(H){var G={id:null,container:null,config:null};if(H&&H.length&&H.length>0){switch(H.length){case 1:G.id=null;G.container=H[0];G.config=null;break;case 2:if(E.isObject(H[1])&&!H[1].tagName&&!(H[1] instanceof String)){G.id=null;G.container=H[0];G.config=H[1];}else{G.id=H[0];G.container=H[1];G.config=null;}break;default:G.id=H[0];G.container=H[1];G.config=H[2];break;}}else{}return G;},init:function(J,H,I){var G=this._parseArgs(arguments);J=G.id;H=G.container;I=G.config;this.oDomContainer=C.get(H);if(!this.oDomContainer.id){this.oDomContainer.id=C.generateId(); 784 }if(!J){J=this.oDomContainer.id+"_t";}this.id=J;this.containerId=this.oDomContainer.id;this.initEvents();this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();C.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);C.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();this.today=this.cfg.getProperty("today");},configIframe:function(I,H,J){var G=H[0];if(!this.parent){if(C.inDocument(this.oDomContainer)){if(G){var K=C.getStyle(this.oDomContainer,"position");if(K=="absolute"||K=="relative"){if(!C.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";C.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){C.addClass(this.iframe,this.Style.CSS_FIXED_SIZE);}this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;}}}}},configTitle:function(H,G,I){var K=G[0];if(K){this.createTitleBar(K);}else{var J=this.cfg.getProperty(B.CLOSE.key);if(!J){this.removeTitleBar();}else{this.createTitleBar(" ");}}},configClose:function(H,G,I){var K=G[0],J=this.cfg.getProperty(B.TITLE.key);if(K){if(!J){this.createTitleBar(" ");}this.createCloseButton();}else{this.removeCloseButton();if(!J){this.removeTitleBar();}}},initEvents:function(){var G=F._EVENT_TYPES,I=YAHOO.util.CustomEvent,H=this;H.beforeSelectEvent=new I(G.BEFORE_SELECT);H.selectEvent=new I(G.SELECT);H.beforeDeselectEvent=new I(G.BEFORE_DESELECT);H.deselectEvent=new I(G.DESELECT);H.changePageEvent=new I(G.CHANGE_PAGE);H.beforeRenderEvent=new I(G.BEFORE_RENDER);H.renderEvent=new I(G.RENDER);H.beforeDestroyEvent=new I(G.BEFORE_DESTROY);H.destroyEvent=new I(G.DESTROY);H.resetEvent=new I(G.RESET);H.clearEvent=new I(G.CLEAR);H.beforeShowEvent=new I(G.BEFORE_SHOW);H.showEvent=new I(G.SHOW);H.beforeHideEvent=new I(G.BEFORE_HIDE);H.hideEvent=new I(G.HIDE);H.beforeShowNavEvent=new I(G.BEFORE_SHOW_NAV);H.showNavEvent=new I(G.SHOW_NAV);H.beforeHideNavEvent=new I(G.BEFORE_HIDE_NAV);H.hideNavEvent=new I(G.HIDE_NAV);H.beforeRenderNavEvent=new I(G.BEFORE_RENDER_NAV);H.renderNavEvent=new I(G.RENDER_NAV);H.beforeSelectEvent.subscribe(H.onBeforeSelect,this,true);H.selectEvent.subscribe(H.onSelect,this,true);H.beforeDeselectEvent.subscribe(H.onBeforeDeselect,this,true);H.deselectEvent.subscribe(H.onDeselect,this,true);H.changePageEvent.subscribe(H.onChangePage,this,true);H.renderEvent.subscribe(H.onRender,this,true);H.resetEvent.subscribe(H.onReset,this,true);H.clearEvent.subscribe(H.onClear,this,true);},doPreviousMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.previousMonth();var J=C.getElementsByClassName(G.Style.CSS_NAV_LEFT,"a",G.oDomContainer);if(J&&J[0]){try{J[0].focus();}catch(I){}}},0);},doNextMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.nextMonth();var J=C.getElementsByClassName(G.Style.CSS_NAV_RIGHT,"a",G.oDomContainer);if(J&&J[0]){try{J[0].focus();}catch(I){}}},0);},doSelectCell:function(M,G){var R,O,I,L;var N=A.getTarget(M),H=N.tagName.toLowerCase(),K=false;while(H!="td"&&!C.hasClass(N,G.Style.CSS_CELL_SELECTABLE)){if(!K&&H=="a"&&C.hasClass(N,G.Style.CSS_CELL_SELECTOR)){K=true;}N=N.parentNode;H=N.tagName.toLowerCase();if(N==this.oDomContainer||H=="html"){return;}}if(K){A.preventDefault(M);}R=N;if(C.hasClass(R,G.Style.CSS_CELL_SELECTABLE)){L=G.getIndexFromId(R.id);if(L>-1){O=G.cellDates[L];if(O){I=D.getDate(O[0],O[1]-1,O[2]);var Q;if(G.Options.MULTI_SELECT){Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}var J=G.cellDates[L];var P=G._indexOfSelectedFieldArray(J);if(P>-1){G.deselectCell(L);}else{G.selectCell(L);}}else{Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}G.selectCell(L);}}}}},doCellMouseOver:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.addClass(G,H.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.removeClass(G,H.Style.CSS_CELL_HOVER);}},setupConfig:function(){var G=this.cfg;G.addProperty(B.TODAY.key,{value:new Date(B.TODAY.value.getTime()),supercedes:B.TODAY.supercedes,handler:this.configToday,suppressEvent:true});G.addProperty(B.PAGEDATE.key,{value:B.PAGEDATE.value||new Date(B.TODAY.value.getTime()),handler:this.configPageDate});G.addProperty(B.SELECTED.key,{value:B.SELECTED.value.concat(),handler:this.configSelected});G.addProperty(B.TITLE.key,{value:B.TITLE.value,handler:this.configTitle});G.addProperty(B.CLOSE.key,{value:B.CLOSE.value,handler:this.configClose});G.addProperty(B.IFRAME.key,{value:B.IFRAME.value,handler:this.configIframe,validator:G.checkBoolean});G.addProperty(B.MINDATE.key,{value:B.MINDATE.value,handler:this.configMinDate});G.addProperty(B.MAXDATE.key,{value:B.MAXDATE.value,handler:this.configMaxDate});G.addProperty(B.MULTI_SELECT.key,{value:B.MULTI_SELECT.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.START_WEEKDAY.key,{value:B.START_WEEKDAY.value,handler:this.configOptions,validator:G.checkNumber});G.addProperty(B.SHOW_WEEKDAYS.key,{value:B.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_HEADER.key,{value:B.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_FOOTER.key,{value:B.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.HIDE_BLANK_WEEKS.key,{value:B.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.NAV_ARROW_LEFT.key,{value:B.NAV_ARROW_LEFT.value,handler:this.configOptions}); 785 G.addProperty(B.NAV_ARROW_RIGHT.key,{value:B.NAV_ARROW_RIGHT.value,handler:this.configOptions});G.addProperty(B.MONTHS_SHORT.key,{value:B.MONTHS_SHORT.value,handler:this.configLocale});G.addProperty(B.MONTHS_LONG.key,{value:B.MONTHS_LONG.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_1CHAR.key,{value:B.WEEKDAYS_1CHAR.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_SHORT.key,{value:B.WEEKDAYS_SHORT.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_MEDIUM.key,{value:B.WEEKDAYS_MEDIUM.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_LONG.key,{value:B.WEEKDAYS_LONG.value,handler:this.configLocale});var H=function(){G.refireEvent(B.LOCALE_MONTHS.key);G.refireEvent(B.LOCALE_WEEKDAYS.key);};G.subscribeToConfigEvent(B.START_WEEKDAY.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_LONG.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_1CHAR.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_MEDIUM.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_LONG.key,H,this,true);G.addProperty(B.LOCALE_MONTHS.key,{value:B.LOCALE_MONTHS.value,handler:this.configLocaleValues});G.addProperty(B.LOCALE_WEEKDAYS.key,{value:B.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});G.addProperty(B.YEAR_OFFSET.key,{value:B.YEAR_OFFSET.value,supercedes:B.YEAR_OFFSET.supercedes,handler:this.configLocale});G.addProperty(B.DATE_DELIMITER.key,{value:B.DATE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_FIELD_DELIMITER.key,{value:B.DATE_FIELD_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_RANGE_DELIMITER.key,{value:B.DATE_RANGE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.MY_MONTH_POSITION.key,{value:B.MY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_YEAR_POSITION.key,{value:B.MY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_MONTH_POSITION.key,{value:B.MD_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_DAY_POSITION.key,{value:B.MD_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_MONTH_POSITION.key,{value:B.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_DAY_POSITION.key,{value:B.MDY_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_YEAR_POSITION.key,{value:B.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_POSITION.key,{value:B.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_YEAR_POSITION.key,{value:B.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_SUFFIX.key,{value:B.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});G.addProperty(B.MY_LABEL_YEAR_SUFFIX.key,{value:B.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});G.addProperty(B.NAV.key,{value:B.NAV.value,handler:this.configNavigator});G.addProperty(B.STRINGS.key,{value:B.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:B.STRINGS.supercedes});},configStrings:function(H,G,I){var J=E.merge(B.STRINGS.value,G[0]);this.cfg.setProperty(B.STRINGS.key,J,true);},configPageDate:function(H,G,I){this.cfg.setProperty(B.PAGEDATE.key,this._parsePageDate(G[0]),true);},configMinDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MINDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configMaxDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MAXDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configToday:function(I,H,J){var K=H[0];if(E.isString(K)){K=this._parseDate(K);}var G=D.clearTime(K);if(!this.cfg.initialConfig[B.PAGEDATE.key]){this.cfg.setProperty(B.PAGEDATE.key,G);}this.today=G;this.cfg.setProperty(B.TODAY.key,G,true);},configSelected:function(I,G,K){var H=G[0],J=B.SELECTED.key;if(H){if(E.isString(H)){this.cfg.setProperty(J,this._parseDates(H),true);}}if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(J);}},configOptions:function(H,G,I){this.Options[H.toUpperCase()]=G[0];},configLocale:function(H,G,I){this.Locale[H.toUpperCase()]=G[0];this.cfg.refireEvent(B.LOCALE_MONTHS.key);this.cfg.refireEvent(B.LOCALE_WEEKDAYS.key);},configLocaleValues:function(J,I,K){J=J.toLowerCase();var M=I[0],H=this.cfg,N=this.Locale;switch(J){case B.LOCALE_MONTHS.key:switch(M){case F.SHORT:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_SHORT.key).concat();break;case F.LONG:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_LONG.key).concat();break;}break;case B.LOCALE_WEEKDAYS.key:switch(M){case F.ONE_CHAR:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_1CHAR.key).concat();break;case F.SHORT:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_SHORT.key).concat();break;case F.MEDIUM:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_MEDIUM.key).concat();break;case F.LONG:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_LONG.key).concat();break;}var L=H.getProperty(B.START_WEEKDAY.key);if(L>0){for(var G=0;G<L;++G){N.LOCALE_WEEKDAYS.push(N.LOCALE_WEEKDAYS.shift());}}break;}},configNavigator:function(H,G,I){var J=G[0];if(YAHOO.widget.CalendarNavigator&&(J===true||E.isObject(J))){if(!this.oNavigator){this.oNavigator=new YAHOO.widget.CalendarNavigator(this);this.beforeRenderEvent.subscribe(function(){if(!this.pages){this.oNavigator.erase();}},this,true);}}else{if(this.oNavigator){this.oNavigator.destroy();this.oNavigator=null;}}},initStyles:function(){var G=F.STYLES;this.Style={CSS_ROW_HEADER:G.CSS_ROW_HEADER,CSS_ROW_FOOTER:G.CSS_ROW_FOOTER,CSS_CELL:G.CSS_CELL,CSS_CELL_SELECTOR:G.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:G.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:G.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:G.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:G.CSS_CELL_TODAY,CSS_CELL_OOM:G.CSS_CELL_OOM,CSS_CELL_OOB:G.CSS_CELL_OOB,CSS_HEADER:G.CSS_HEADER,CSS_HEADER_TEXT:G.CSS_HEADER_TEXT,CSS_BODY:G.CSS_BODY,CSS_WEEKDAY_CELL:G.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:G.CSS_WEEKDAY_ROW,CSS_FOOTER:G.CSS_FOOTER,CSS_CALENDAR:G.CSS_CALENDAR,CSS_SINGLE:G.CSS_SINGLE,CSS_CONTAINER:G.CSS_CONTAINER,CSS_NAV_LEFT:G.CSS_NAV_LEFT,CSS_NAV_RIGHT:G.CSS_NAV_RIGHT,CSS_NAV:G.CSS_NAV,CSS_CLOSE:G.CSS_CLOSE,CSS_CELL_TOP:G.CSS_CELL_TOP,CSS_CELL_LEFT:G.CSS_CELL_LEFT,CSS_CELL_RIGHT:G.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:G.CSS_CELL_BOTTOM,CSS_CELL_HOVER:G.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:G.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:G.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:G.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:G.CSS_CELL_HIGHLIGHT4,CSS_WITH_TITLE:G.CSS_WITH_TITLE,CSS_FIXED_SIZE:G.CSS_FIXED_SIZE,CSS_LINK_CLOSE:G.CSS_LINK_CLOSE}; 786 },buildMonthLabel:function(){return this._buildMonthLabel(this.cfg.getProperty(B.PAGEDATE.key));},_buildMonthLabel:function(G){var I=this.Locale.LOCALE_MONTHS[G.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX,H=(G.getFullYear()+this.Locale.YEAR_OFFSET)+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return H+I;}else{return I+H;}},buildDayLabel:function(G){return G.getDate();},createTitleBar:function(G){var H=C.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");H.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;H.innerHTML=G;this.oDomContainer.insertBefore(H,this.oDomContainer.firstChild);C.addClass(this.oDomContainer,this.Style.CSS_WITH_TITLE);return H;},removeTitleBar:function(){var G=C.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(G){A.purgeElement(G);this.oDomContainer.removeChild(G);}C.removeClass(this.oDomContainer,this.Style.CSS_WITH_TITLE);},createCloseButton:function(){var K=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,J=this.Style.CSS_LINK_CLOSE,M="us/my/bn/x_d.gif",L=C.getElementsByClassName(J,"a",this.oDomContainer)[0],G=this.cfg.getProperty(B.STRINGS.key),H=(G&&G.close)?G.close:"";if(!L){L=document.createElement("a");A.addListener(L,"click",function(O,N){N.hide();A.preventDefault(O);},this);}L.href="#";L.className=J;if(F.IMG_ROOT!==null){var I=C.getElementsByClassName(K,"img",L)[0]||document.createElement("img");I.src=F.IMG_ROOT+M;I.className=K;L.appendChild(I);}else{L.innerHTML='<span class="'+K+" "+this.Style.CSS_CLOSE+'">'+H+"</span>";}this.oDomContainer.appendChild(L);return L;},removeCloseButton:function(){var G=C.getElementsByClassName(this.Style.CSS_LINK_CLOSE,"a",this.oDomContainer)[0]||null;if(G){A.purgeElement(G);this.oDomContainer.removeChild(G);}},renderHeader:function(Q){var P=7,O="us/tr/callt.gif",G="us/tr/calrt.gif",N=this.cfg,K=N.getProperty(B.PAGEDATE.key),L=N.getProperty(B.STRINGS.key),V=(L&&L.previousMonth)?L.previousMonth:"",H=(L&&L.nextMonth)?L.nextMonth:"",M;if(N.getProperty(B.SHOW_WEEK_HEADER.key)){P+=1;}if(N.getProperty(B.SHOW_WEEK_FOOTER.key)){P+=1;}Q[Q.length]="<thead>";Q[Q.length]="<tr>";Q[Q.length]='<th colspan="'+P+'" class="'+this.Style.CSS_HEADER_TEXT+'">';Q[Q.length]='<div class="'+this.Style.CSS_HEADER+'">';var X,U=false;if(this.parent){if(this.index===0){X=true;}if(this.index==(this.parent.cfg.getProperty("pages")-1)){U=true;}}else{X=true;U=true;}if(X){M=this._buildMonthLabel(D.subtract(K,D.MONTH,1));var R=N.getProperty(B.NAV_ARROW_LEFT.key);if(R===null&&F.IMG_ROOT!==null){R=F.IMG_ROOT+O;}var I=(R===null)?"":' style="background-image:url('+R+')"';Q[Q.length]='<a class="'+this.Style.CSS_NAV_LEFT+'"'+I+' href="#">'+V+" ("+M+")"+"</a>";}var W=this.buildMonthLabel();var S=this.parent||this;if(S.cfg.getProperty("navigator")){W='<a class="'+this.Style.CSS_NAV+'" href="#">'+W+"</a>";}Q[Q.length]=W;if(U){M=this._buildMonthLabel(D.add(K,D.MONTH,1));var T=N.getProperty(B.NAV_ARROW_RIGHT.key);if(T===null&&F.IMG_ROOT!==null){T=F.IMG_ROOT+G;}var J=(T===null)?"":' style="background-image:url('+T+')"';Q[Q.length]='<a class="'+this.Style.CSS_NAV_RIGHT+'"'+J+' href="#">'+H+" ("+M+")"+"</a>";}Q[Q.length]="</div>\n</th>\n</tr>";if(N.getProperty(B.SHOW_WEEKDAYS.key)){Q=this.buildWeekdays(Q);}Q[Q.length]="</thead>";return Q;},buildWeekdays:function(H){H[H.length]='<tr class="'+this.Style.CSS_WEEKDAY_ROW+'">';if(this.cfg.getProperty(B.SHOW_WEEK_HEADER.key)){H[H.length]="<th> </th>";}for(var G=0;G<this.Locale.LOCALE_WEEKDAYS.length;++G){H[H.length]='<th class="'+this.Style.CSS_WEEKDAY_CELL+'">'+this.Locale.LOCALE_WEEKDAYS[G]+"</th>";}if(this.cfg.getProperty(B.SHOW_WEEK_FOOTER.key)){H[H.length]="<th> </th>";}H[H.length]="</tr>";return H;},renderBody:function(m,k){var AK=this.cfg.getProperty(B.START_WEEKDAY.key);this.preMonthDays=m.getDay();if(AK>0){this.preMonthDays-=AK;}if(this.preMonthDays<0){this.preMonthDays+=7;}this.monthDays=D.findMonthEnd(m).getDate();this.postMonthDays=F.DISPLAY_DAYS-this.preMonthDays-this.monthDays;m=D.subtract(m,D.DAY,this.preMonthDays);var Y,N,M="w",f="_cell",c="wd",w="d",P,u,AC=this.today,O=this.cfg,W=AC.getFullYear(),v=AC.getMonth(),J=AC.getDate(),AB=O.getProperty(B.PAGEDATE.key),I=O.getProperty(B.HIDE_BLANK_WEEKS.key),j=O.getProperty(B.SHOW_WEEK_FOOTER.key),b=O.getProperty(B.SHOW_WEEK_HEADER.key),U=O.getProperty(B.MINDATE.key),a=O.getProperty(B.MAXDATE.key),T=this.Locale.YEAR_OFFSET;if(U){U=D.clearTime(U);}if(a){a=D.clearTime(a);}k[k.length]='<tbody class="m'+(AB.getMonth()+1)+" "+this.Style.CSS_BODY+'">';var AI=0,Q=document.createElement("div"),l=document.createElement("td");Q.appendChild(l);var AA=this.parent||this;for(var AE=0;AE<6;AE++){Y=D.getWeekNumber(m,AK);N=M+Y;if(AE!==0&&I===true&&m.getMonth()!=AB.getMonth()){break;}else{k[k.length]='<tr class="'+N+'">';if(b){k=this.renderRowHeader(Y,k);}for(var AJ=0;AJ<7;AJ++){P=[];this.clearElement(l);l.className=this.Style.CSS_CELL;l.id=this.id+f+AI;if(m.getDate()==J&&m.getMonth()==v&&m.getFullYear()==W){P[P.length]=AA.renderCellStyleToday;}var Z=[m.getFullYear(),m.getMonth()+1,m.getDate()];this.cellDates[this.cellDates.length]=Z;if(m.getMonth()!=AB.getMonth()){P[P.length]=AA.renderCellNotThisMonth;}else{C.addClass(l,c+m.getDay());C.addClass(l,w+m.getDate());for(var AD=0;AD<this.renderStack.length;++AD){u=null;var y=this.renderStack[AD],AL=y[0],H,e,L;switch(AL){case F.DATE:H=y[1][1];e=y[1][2];L=y[1][0];if(m.getMonth()+1==H&&m.getDate()==e&&m.getFullYear()==L){u=y[2];this.renderStack.splice(AD,1);}break;case F.MONTH_DAY:H=y[1][0];e=y[1][1];if(m.getMonth()+1==H&&m.getDate()==e){u=y[2];this.renderStack.splice(AD,1);}break;case F.RANGE:var h=y[1][0],g=y[1][1],n=h[1],S=h[2],X=h[0],AH=D.getDate(X,n-1,S),K=g[1],q=g[2],G=g[0],AG=D.getDate(G,K-1,q);if(m.getTime()>=AH.getTime()&&m.getTime()<=AG.getTime()){u=y[2];if(m.getTime()==AG.getTime()){this.renderStack.splice(AD,1);}}break;case F.WEEKDAY:var R=y[1][0]; 787 if(m.getDay()+1==R){u=y[2];}break;case F.MONTH:H=y[1][0];if(m.getMonth()+1==H){u=y[2];}break;}if(u){P[P.length]=u;}}}if(this._indexOfSelectedFieldArray(Z)>-1){P[P.length]=AA.renderCellStyleSelected;}if((U&&(m.getTime()<U.getTime()))||(a&&(m.getTime()>a.getTime()))){P[P.length]=AA.renderOutOfBoundsDate;}else{P[P.length]=AA.styleCellDefault;P[P.length]=AA.renderCellDefault;}for(var z=0;z<P.length;++z){if(P[z].call(AA,m,l)==F.STOP_RENDER){break;}}m.setTime(m.getTime()+D.ONE_DAY_MS);m=D.clearTime(m);if(AI>=0&&AI<=6){C.addClass(l,this.Style.CSS_CELL_TOP);}if((AI%7)===0){C.addClass(l,this.Style.CSS_CELL_LEFT);}if(((AI+1)%7)===0){C.addClass(l,this.Style.CSS_CELL_RIGHT);}var o=this.postMonthDays;if(I&&o>=7){var V=Math.floor(o/7);for(var AF=0;AF<V;++AF){o-=7;}}if(AI>=((this.preMonthDays+o+this.monthDays)-7)){C.addClass(l,this.Style.CSS_CELL_BOTTOM);}k[k.length]=Q.innerHTML;AI++;}if(j){k=this.renderRowFooter(Y,k);}k[k.length]="</tr>";}}k[k.length]="</tbody>";return k;},renderFooter:function(G){return G;},render:function(){this.beforeRenderEvent.fire();var H=D.findMonthStart(this.cfg.getProperty(B.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;A.purgeElement(this.oDomContainer,true);var G=[];G[G.length]='<table cellSpacing="0" class="'+this.Style.CSS_CALENDAR+" y"+(H.getFullYear()+this.Locale.YEAR_OFFSET)+'" id="'+this.id+'">';G=this.renderHeader(G);G=this.renderBody(H,G);G=this.renderFooter(G);G[G.length]="</table>";this.oDomContainer.innerHTML=G.join("\n");this.applyListeners();this.cells=C.getElementsByClassName(this.Style.CSS_CELL,"td",this.id);this.cfg.refireEvent(B.TITLE.key);this.cfg.refireEvent(B.CLOSE.key);this.cfg.refireEvent(B.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var P=this.oDomContainer,H=this.parent||this,L="a",S="click";var M=C.getElementsByClassName(this.Style.CSS_NAV_LEFT,L,P),I=C.getElementsByClassName(this.Style.CSS_NAV_RIGHT,L,P);if(M&&M.length>0){this.linkLeft=M[0];A.addListener(this.linkLeft,S,this.doPreviousMonthNav,H,true);}if(I&&I.length>0){this.linkRight=I[0];A.addListener(this.linkRight,S,this.doNextMonthNav,H,true);}if(H.cfg.getProperty("navigator")!==null){this.applyNavListeners();}if(this.domEventMap){var J,G;for(var R in this.domEventMap){if(E.hasOwnProperty(this.domEventMap,R)){var N=this.domEventMap[R];if(!(N instanceof Array)){N=[N];}for(var K=0;K<N.length;K++){var Q=N[K];G=C.getElementsByClassName(R,Q.tag,this.oDomContainer);for(var O=0;O<G.length;O++){J=G[O];A.addListener(J,Q.event,Q.handler,Q.scope,Q.correct);}}}}}A.addListener(this.oDomContainer,"click",this.doSelectCell,this);A.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);A.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);},applyNavListeners:function(){var H=this.parent||this,I=this,G=C.getElementsByClassName(this.Style.CSS_NAV,"a",this.oDomContainer);if(G.length>0){A.addListener(G,"click",function(N,M){var L=A.getTarget(N);if(this===L||C.isAncestor(this,L)){A.preventDefault(N);}var J=H.oNavigator;if(J){var K=I.cfg.getProperty("pagedate");J.setYear(K.getFullYear()+I.Locale.YEAR_OFFSET);J.setMonth(K.getMonth());J.show();}});}},getDateByCellId:function(H){var G=this.getDateFieldsByCellId(H);return(G)?D.getDate(G[0],G[1]-1,G[2]):null;},getDateFieldsByCellId:function(G){G=this.getIndexFromId(G);return(G>-1)?this.cellDates[G]:null;},getCellIndex:function(I){var H=-1;if(I){var G=I.getMonth(),N=I.getFullYear(),M=I.getDate(),K=this.cellDates;for(var J=0;J<K.length;++J){var L=K[J];if(L[0]===N&&L[1]===G+1&&L[2]===M){H=J;break;}}}return H;},getIndexFromId:function(I){var H=-1,G=I.lastIndexOf("_cell");if(G>-1){H=parseInt(I.substring(G+5),10);}return H;},renderOutOfBoundsDate:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOB);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderRowHeader:function(H,G){G[G.length]='<th class="'+this.Style.CSS_ROW_HEADER+'">'+H+"</th>";return G;},renderRowFooter:function(H,G){G[G.length]='<th class="'+this.Style.CSS_ROW_FOOTER+'">'+H+"</th>";return G;},renderCellDefault:function(H,G){G.innerHTML='<a href="#" class="'+this.Style.CSS_CELL_SELECTOR+'">'+this.buildDayLabel(H)+"</a>";},styleCellDefault:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(H,G){C.addClass(G,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOM);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderBodyCellRestricted:function(H,G){C.addClass(G,this.Style.CSS_CELL);C.addClass(G,this.Style.CSS_CELL_RESTRICTED);G.innerHTML=H.getDate();return F.STOP_RENDER;},addMonths:function(I){var H=B.PAGEDATE.key,J=this.cfg.getProperty(H),G=D.add(J,D.MONTH,I);this.cfg.setProperty(H,G);this.resetRenderers();this.changePageEvent.fire(J,G);},subtractMonths:function(G){this.addMonths(-1*G);},addYears:function(I){var H=B.PAGEDATE.key,J=this.cfg.getProperty(H),G=D.add(J,D.YEAR,I);this.cfg.setProperty(H,G);this.resetRenderers();this.changePageEvent.fire(J,G);},subtractYears:function(G){this.addYears(-1*G);},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.addMonths(-1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.addYears(-1);},reset:function(){this.cfg.resetProperty(B.SELECTED.key);this.cfg.resetProperty(B.PAGEDATE.key);this.resetEvent.fire();},clear:function(){this.cfg.setProperty(B.SELECTED.key,[]);this.cfg.setProperty(B.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(I){var L=this._toFieldArray(I),H=[],K=[],M=B.SELECTED.key;for(var G=0;G<L.length;++G){var J=L[G]; 788 if(!this.isDateOOB(this._toDate(J))){if(H.length===0){this.beforeSelectEvent.fire();K=this.cfg.getProperty(M);}H.push(J);if(this._indexOfSelectedFieldArray(J)==-1){K[K.length]=J;}}}if(H.length>0){if(this.parent){this.parent.cfg.setProperty(M,K);}else{this.cfg.setProperty(M,K);}this.selectEvent.fire(H);}return this.getSelectedDates();},selectCell:function(J){var H=this.cells[J],N=this.cellDates[J],M=this._toDate(N),I=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(I){this.beforeSelectEvent.fire();var L=B.SELECTED.key;var K=this.cfg.getProperty(L);var G=N.concat();if(this._indexOfSelectedFieldArray(G)==-1){K[K.length]=G;}if(this.parent){this.parent.cfg.setProperty(L,K);}else{this.cfg.setProperty(L,K);}this.renderCellStyleSelected(M,H);this.selectEvent.fire([G]);this.doCellMouseOut.call(H,null,this);}return this.getSelectedDates();},deselect:function(K){var G=this._toFieldArray(K),J=[],M=[],N=B.SELECTED.key;for(var H=0;H<G.length;++H){var L=G[H];if(!this.isDateOOB(this._toDate(L))){if(J.length===0){this.beforeDeselectEvent.fire();M=this.cfg.getProperty(N);}J.push(L);var I=this._indexOfSelectedFieldArray(L);if(I!=-1){M.splice(I,1);}}}if(J.length>0){if(this.parent){this.parent.cfg.setProperty(N,M);}else{this.cfg.setProperty(N,M);}this.deselectEvent.fire(J);}return this.getSelectedDates();},deselectCell:function(K){var H=this.cells[K],N=this.cellDates[K],I=this._indexOfSelectedFieldArray(N);var J=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(J){this.beforeDeselectEvent.fire();var L=this.cfg.getProperty(B.SELECTED.key),M=this._toDate(N),G=N.concat();if(I>-1){if(this.cfg.getProperty(B.PAGEDATE.key).getMonth()==M.getMonth()&&this.cfg.getProperty(B.PAGEDATE.key).getFullYear()==M.getFullYear()){C.removeClass(H,this.Style.CSS_CELL_SELECTED);}L.splice(I,1);}if(this.parent){this.parent.cfg.setProperty(B.SELECTED.key,L);}else{this.cfg.setProperty(B.SELECTED.key,L);}this.deselectEvent.fire([G]);}return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var J=B.SELECTED.key,G=this.cfg.getProperty(J),H=G.length,I=G.concat();if(this.parent){this.parent.cfg.setProperty(J,[]);}else{this.cfg.setProperty(J,[]);}if(H>0){this.deselectEvent.fire(I);}return this.getSelectedDates();},_toFieldArray:function(H){var G=[];if(H instanceof Date){G=[[H.getFullYear(),H.getMonth()+1,H.getDate()]];}else{if(E.isString(H)){G=this._parseDates(H);}else{if(E.isArray(H)){for(var I=0;I<H.length;++I){var J=H[I];G[G.length]=[J.getFullYear(),J.getMonth()+1,J.getDate()];}}}}return G;},toDate:function(G){return this._toDate(G);},_toDate:function(G){if(G instanceof Date){return G;}else{return D.getDate(G[0],G[1]-1,G[2]);}},_fieldArraysAreEqual:function(I,H){var G=false;if(I[0]==H[0]&&I[1]==H[1]&&I[2]==H[2]){G=true;}return G;},_indexOfSelectedFieldArray:function(K){var J=-1,G=this.cfg.getProperty(B.SELECTED.key);for(var I=0;I<G.length;++I){var H=G[I];if(K[0]==H[0]&&K[1]==H[1]&&K[2]==H[2]){J=I;break;}}return J;},isDateOOM:function(G){return(G.getMonth()!=this.cfg.getProperty(B.PAGEDATE.key).getMonth());},isDateOOB:function(I){var J=this.cfg.getProperty(B.MINDATE.key),K=this.cfg.getProperty(B.MAXDATE.key),H=D;if(J){J=H.clearTime(J);}if(K){K=H.clearTime(K);}var G=new Date(I.getTime());G=H.clearTime(G);return((J&&G.getTime()<J.getTime())||(K&&G.getTime()>K.getTime()));},_parsePageDate:function(G){var J;if(G){if(G instanceof Date){J=D.findMonthStart(G);}else{var K,I,H;H=G.split(this.cfg.getProperty(B.DATE_FIELD_DELIMITER.key));K=parseInt(H[this.cfg.getProperty(B.MY_MONTH_POSITION.key)-1],10)-1;I=parseInt(H[this.cfg.getProperty(B.MY_YEAR_POSITION.key)-1],10)-this.Locale.YEAR_OFFSET;J=D.getDate(I,K,1);}}else{J=D.getDate(this.today.getFullYear(),this.today.getMonth(),1);}return J;},onBeforeSelect:function(){if(this.cfg.getProperty(B.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}}},onSelect:function(G){},onBeforeDeselect:function(){},onDeselect:function(G){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(I){var J=I.split(this.Locale.DATE_FIELD_DELIMITER),G;if(J.length==2){G=[J[this.Locale.MD_MONTH_POSITION-1],J[this.Locale.MD_DAY_POSITION-1]];G.type=F.MONTH_DAY;}else{G=[J[this.Locale.MDY_YEAR_POSITION-1]-this.Locale.YEAR_OFFSET,J[this.Locale.MDY_MONTH_POSITION-1],J[this.Locale.MDY_DAY_POSITION-1]];G.type=F.DATE;}for(var H=0;H<G.length;H++){G[H]=parseInt(G[H],10);}return G;},_parseDates:function(H){var O=[],N=H.split(this.Locale.DATE_DELIMITER);for(var M=0;M<N.length;++M){var L=N[M];if(L.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var G=L.split(this.Locale.DATE_RANGE_DELIMITER),K=this._parseDate(G[0]),P=this._parseDate(G[1]),J=this._parseRange(K,P);O=O.concat(J);}else{var I=this._parseDate(L);O.push(I);}}return O;},_parseRange:function(G,K){var H=D.add(D.getDate(G[0],G[1]-1,G[2]),D.DAY,1),J=D.getDate(K[0],K[1]-1,K[2]),I=[];I.push(G);while(H.getTime()<=J.getTime()){I.push([H.getFullYear(),H.getMonth()+1,H.getDate()]);H=D.add(H,D.DAY,1);}return I;},resetRenderers:function(){this.renderStack=this._renderStack.concat();},removeRenderers:function(){this._renderStack=[];this.renderStack=[];},clearElement:function(G){G.innerHTML=" ";G.className="";},addRenderer:function(G,H){var J=this._parseDates(G);for(var I=0;I<J.length;++I){var K=J[I];if(K.length==2){if(K[0] instanceof Array){this._addRenderer(F.RANGE,K,H);}else{this._addRenderer(F.MONTH_DAY,K,H);}}else{if(K.length==3){this._addRenderer(F.DATE,K,H);}}}},_addRenderer:function(H,I,G){var J=[H,I,G];this.renderStack.unshift(J);this._renderStack=this.renderStack.concat();},addMonthRenderer:function(H,G){this._addRenderer(F.MONTH,[H],G);},addWeekdayRenderer:function(H,G){this._addRenderer(F.WEEKDAY,[H],G);},clearAllBodyCellStyles:function(G){for(var H=0; 789 H<this.cells.length;++H){C.removeClass(this.cells[H],G);}},setMonth:function(I){var G=B.PAGEDATE.key,H=this.cfg.getProperty(G);H.setMonth(parseInt(I,10));this.cfg.setProperty(G,H);},setYear:function(H){var G=B.PAGEDATE.key,I=this.cfg.getProperty(G);I.setFullYear(parseInt(H,10)-this.Locale.YEAR_OFFSET);this.cfg.setProperty(G,I);},getSelectedDates:function(){var I=[],H=this.cfg.getProperty(B.SELECTED.key);for(var K=0;K<H.length;++K){var J=H[K];var G=D.getDate(J[0],J[1]-1,J[2]);I.push(G);}I.sort(function(M,L){return M-L;});return I;},hide:function(){if(this.beforeHideEvent.fire()){this.oDomContainer.style.display="none";this.hideEvent.fire();}},show:function(){if(this.beforeShowEvent.fire()){this.oDomContainer.style.display="block";this.showEvent.fire();}},browser:(function(){var G=navigator.userAgent.toLowerCase();if(G.indexOf("opera")!=-1){return"opera";}else{if(G.indexOf("msie 7")!=-1){return"ie7";}else{if(G.indexOf("msie")!=-1){return"ie";}else{if(G.indexOf("safari")!=-1){return"safari";}else{if(G.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}})(),toString:function(){return"Calendar "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var G=this;if(G.navigator){G.navigator.destroy();}if(G.cfg){G.cfg.destroy();}A.purgeElement(G.oDomContainer,true);C.removeClass(G.oDomContainer,G.Style.CSS_WITH_TITLE);C.removeClass(G.oDomContainer,G.Style.CSS_CONTAINER);C.removeClass(G.oDomContainer,G.Style.CSS_SINGLE);G.oDomContainer.innerHTML="";G.oDomContainer=null;G.cells=null;this.destroyEvent.fire();}}};YAHOO.widget.Calendar=F;YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;})();(function(){var D=YAHOO.util.Dom,F=YAHOO.widget.DateMath,A=YAHOO.util.Event,E=YAHOO.lang,G=YAHOO.widget.Calendar;function B(J,H,I){if(arguments.length>0){this.init.apply(this,arguments);}}B.DEFAULT_CONFIG=B._DEFAULT_CONFIG=G.DEFAULT_CONFIG;B.DEFAULT_CONFIG.PAGES={key:"pages",value:2};var C=B.DEFAULT_CONFIG;B.prototype={init:function(K,I,J){var H=this._parseArgs(arguments);K=H.id;I=H.container;J=H.config;this.oDomContainer=D.get(I);if(!this.oDomContainer.id){this.oDomContainer.id=D.generateId();}if(!K){K=this.oDomContainer.id+"_t";}this.id=K;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];D.addClass(this.oDomContainer,B.CSS_CONTAINER);D.addClass(this.oDomContainer,B.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(J){this.cfg.applyConfig(J,true);}this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var H=this.cfg;H.addProperty(C.PAGES.key,{value:C.PAGES.value,validator:H.checkNumber,handler:this.configPages});H.addProperty(C.YEAR_OFFSET.key,{value:C.YEAR_OFFSET.value,handler:this.delegateConfig,supercedes:C.YEAR_OFFSET.supercedes,suppressEvent:true});H.addProperty(C.TODAY.key,{value:new Date(C.TODAY.value.getTime()),supercedes:C.TODAY.supercedes,handler:this.configToday,suppressEvent:false});H.addProperty(C.PAGEDATE.key,{value:C.PAGEDATE.value||new Date(C.TODAY.value.getTime()),handler:this.configPageDate});H.addProperty(C.SELECTED.key,{value:[],handler:this.configSelected});H.addProperty(C.TITLE.key,{value:C.TITLE.value,handler:this.configTitle});H.addProperty(C.CLOSE.key,{value:C.CLOSE.value,handler:this.configClose});H.addProperty(C.IFRAME.key,{value:C.IFRAME.value,handler:this.configIframe,validator:H.checkBoolean});H.addProperty(C.MINDATE.key,{value:C.MINDATE.value,handler:this.delegateConfig});H.addProperty(C.MAXDATE.key,{value:C.MAXDATE.value,handler:this.delegateConfig});H.addProperty(C.MULTI_SELECT.key,{value:C.MULTI_SELECT.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.START_WEEKDAY.key,{value:C.START_WEEKDAY.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.SHOW_WEEKDAYS.key,{value:C.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_HEADER.key,{value:C.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_FOOTER.key,{value:C.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.HIDE_BLANK_WEEKS.key,{value:C.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.NAV_ARROW_LEFT.key,{value:C.NAV_ARROW_LEFT.value,handler:this.delegateConfig});H.addProperty(C.NAV_ARROW_RIGHT.key,{value:C.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_SHORT.key,{value:C.MONTHS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_LONG.key,{value:C.MONTHS_LONG.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_1CHAR.key,{value:C.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_SHORT.key,{value:C.WEEKDAYS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_MEDIUM.key,{value:C.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_LONG.key,{value:C.WEEKDAYS_LONG.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_MONTHS.key,{value:C.LOCALE_MONTHS.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_WEEKDAYS.key,{value:C.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});H.addProperty(C.DATE_DELIMITER.key,{value:C.DATE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_FIELD_DELIMITER.key,{value:C.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_RANGE_DELIMITER.key,{value:C.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.MY_MONTH_POSITION.key,{value:C.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_YEAR_POSITION.key,{value:C.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MD_MONTH_POSITION.key,{value:C.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber}); 790 H.addProperty(C.MD_DAY_POSITION.key,{value:C.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_MONTH_POSITION.key,{value:C.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_DAY_POSITION.key,{value:C.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_YEAR_POSITION.key,{value:C.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_MONTH_POSITION.key,{value:C.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_YEAR_POSITION.key,{value:C.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_MONTH_SUFFIX.key,{value:C.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.MY_LABEL_YEAR_SUFFIX.key,{value:C.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.NAV.key,{value:C.NAV.value,handler:this.configNavigator});H.addProperty(C.STRINGS.key,{value:C.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:C.STRINGS.supercedes});},initEvents:function(){var J=this,L="Event",M=YAHOO.util.CustomEvent;var I=function(O,R,N){for(var Q=0;Q<J.pages.length;++Q){var P=J.pages[Q];P[this.type+L].subscribe(O,R,N);}};var H=function(N,Q){for(var P=0;P<J.pages.length;++P){var O=J.pages[P];O[this.type+L].unsubscribe(N,Q);}};var K=G._EVENT_TYPES;J.beforeSelectEvent=new M(K.BEFORE_SELECT);J.beforeSelectEvent.subscribe=I;J.beforeSelectEvent.unsubscribe=H;J.selectEvent=new M(K.SELECT);J.selectEvent.subscribe=I;J.selectEvent.unsubscribe=H;J.beforeDeselectEvent=new M(K.BEFORE_DESELECT);J.beforeDeselectEvent.subscribe=I;J.beforeDeselectEvent.unsubscribe=H;J.deselectEvent=new M(K.DESELECT);J.deselectEvent.subscribe=I;J.deselectEvent.unsubscribe=H;J.changePageEvent=new M(K.CHANGE_PAGE);J.changePageEvent.subscribe=I;J.changePageEvent.unsubscribe=H;J.beforeRenderEvent=new M(K.BEFORE_RENDER);J.beforeRenderEvent.subscribe=I;J.beforeRenderEvent.unsubscribe=H;J.renderEvent=new M(K.RENDER);J.renderEvent.subscribe=I;J.renderEvent.unsubscribe=H;J.resetEvent=new M(K.RESET);J.resetEvent.subscribe=I;J.resetEvent.unsubscribe=H;J.clearEvent=new M(K.CLEAR);J.clearEvent.subscribe=I;J.clearEvent.unsubscribe=H;J.beforeShowEvent=new M(K.BEFORE_SHOW);J.showEvent=new M(K.SHOW);J.beforeHideEvent=new M(K.BEFORE_HIDE);J.hideEvent=new M(K.HIDE);J.beforeShowNavEvent=new M(K.BEFORE_SHOW_NAV);J.showNavEvent=new M(K.SHOW_NAV);J.beforeHideNavEvent=new M(K.BEFORE_HIDE_NAV);J.hideNavEvent=new M(K.HIDE_NAV);J.beforeRenderNavEvent=new M(K.BEFORE_RENDER_NAV);J.renderNavEvent=new M(K.RENDER_NAV);J.beforeDestroyEvent=new M(K.BEFORE_DESTROY);J.destroyEvent=new M(K.DESTROY);},configPages:function(T,R,N){var L=R[0],J=C.PAGEDATE.key,W="_",M,O=null,S="groupcal",V="first-of-type",K="last-of-type";for(var I=0;I<L;++I){var U=this.id+W+I,Q=this.containerId+W+I,P=this.cfg.getConfig();P.close=false;P.title=false;P.navigator=null;if(I>0){M=new Date(O);this._setMonthOnDate(M,M.getMonth()+I);P.pageDate=M;}var H=this.constructChild(U,Q,P);D.removeClass(H.oDomContainer,this.Style.CSS_SINGLE);D.addClass(H.oDomContainer,S);if(I===0){O=H.cfg.getProperty(J);D.addClass(H.oDomContainer,V);}if(I==(L-1)){D.addClass(H.oDomContainer,K);}H.parent=this;H.index=I;this.pages[this.pages.length]=H;}},configPageDate:function(O,N,L){var J=N[0],M;var K=C.PAGEDATE.key;for(var I=0;I<this.pages.length;++I){var H=this.pages[I];if(I===0){M=H._parsePageDate(J);H.cfg.setProperty(K,M);}else{var P=new Date(M);this._setMonthOnDate(P,P.getMonth()+I);H.cfg.setProperty(K,P);}}},configSelected:function(J,H,L){var K=C.SELECTED.key;this.delegateConfig(J,H,L);var I=(this.pages.length>0)?this.pages[0].cfg.getProperty(K):[];this.cfg.setProperty(K,I,true);},delegateConfig:function(I,H,L){var M=H[0];var K;for(var J=0;J<this.pages.length;J++){K=this.pages[J];K.cfg.setProperty(I,M);}},setChildFunction:function(K,I){var H=this.cfg.getProperty(C.PAGES.key);for(var J=0;J<H;++J){this.pages[J][K]=I;}},callChildFunction:function(M,I){var H=this.cfg.getProperty(C.PAGES.key);for(var L=0;L<H;++L){var K=this.pages[L];if(K[M]){var J=K[M];J.call(K,I);}}},constructChild:function(K,I,J){var H=document.getElementById(I);if(!H){H=document.createElement("div");H.id=I;this.oDomContainer.appendChild(H);}return new G(K,I,J);},setMonth:function(L){L=parseInt(L,10);var M;var I=C.PAGEDATE.key;for(var K=0;K<this.pages.length;++K){var J=this.pages[K];var H=J.cfg.getProperty(I);if(K===0){M=H.getFullYear();}else{H.setFullYear(M);}this._setMonthOnDate(H,L+K);J.cfg.setProperty(I,H);}},setYear:function(J){var I=C.PAGEDATE.key;J=parseInt(J,10);for(var L=0;L<this.pages.length;++L){var K=this.pages[L];var H=K.cfg.getProperty(I);if((H.getMonth()+1)==1&&L>0){J+=1;}K.setYear(J);}},render:function(){this.renderHeader();for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.render();}this.renderFooter();},select:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.select(H);}return this.getSelectedDates();},selectCell:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.selectCell(H);}return this.getSelectedDates();},deselect:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.deselect(H);}return this.getSelectedDates();},deselectAll:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.deselectAll();}return this.getSelectedDates();},deselectCell:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.deselectCell(H);}return this.getSelectedDates();},reset:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.reset();}},clear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.clear();}this.cfg.setProperty(C.SELECTED.key,[]);this.cfg.setProperty(C.PAGEDATE.key,new Date(this.pages[0].today.getTime()));this.render();},nextMonth:function(){for(var I=0;I<this.pages.length; 791 ++I){var H=this.pages[I];H.nextMonth();}},previousMonth:function(){for(var I=this.pages.length-1;I>=0;--I){var H=this.pages[I];H.previousMonth();}},nextYear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.nextYear();}},previousYear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.previousYear();}},getSelectedDates:function(){var J=[];var I=this.cfg.getProperty(C.SELECTED.key);for(var L=0;L<I.length;++L){var K=I[L];var H=F.getDate(K[0],K[1]-1,K[2]);J.push(H);}J.sort(function(N,M){return N-M;});return J;},addRenderer:function(H,I){for(var K=0;K<this.pages.length;++K){var J=this.pages[K];J.addRenderer(H,I);}},addMonthRenderer:function(K,H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.addMonthRenderer(K,H);}},addWeekdayRenderer:function(I,H){for(var K=0;K<this.pages.length;++K){var J=this.pages[K];J.addWeekdayRenderer(I,H);}},removeRenderers:function(){this.callChildFunction("removeRenderers");},renderHeader:function(){},renderFooter:function(){},addMonths:function(H){this.callChildFunction("addMonths",H);},subtractMonths:function(H){this.callChildFunction("subtractMonths",H);},addYears:function(H){this.callChildFunction("addYears",H);},subtractYears:function(H){this.callChildFunction("subtractYears",H);},getCalendarPage:function(K){var M=null;if(K){var N=K.getFullYear(),J=K.getMonth();var I=this.pages;for(var L=0;L<I.length;++L){var H=I[L].cfg.getProperty("pagedate");if(H.getFullYear()===N&&H.getMonth()===J){M=I[L];break;}}}return M;},_setMonthOnDate:function(I,J){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(J<0||J>11)){var H=F.add(I,F.MONTH,J-I.getMonth());I.setTime(H.getTime());}else{I.setMonth(J);}},_fixWidth:function(){var H=0;for(var J=0;J<this.pages.length;++J){var I=this.pages[J];H+=I.oDomContainer.offsetWidth;}if(H>0){this.oDomContainer.style.width=H+"px";}},toString:function(){return"CalendarGroup "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var J=this;if(J.navigator){J.navigator.destroy();}if(J.cfg){J.cfg.destroy();}A.purgeElement(J.oDomContainer,true);D.removeClass(J.oDomContainer,B.CSS_CONTAINER);D.removeClass(J.oDomContainer,B.CSS_MULTI_UP);for(var I=0,H=J.pages.length;I<H;I++){J.pages[I].destroy();J.pages[I]=null;}J.oDomContainer.innerHTML="";J.oDomContainer=null;this.destroyEvent.fire();}}};B.CSS_CONTAINER="yui-calcontainer";B.CSS_MULTI_UP="multi";B.CSS_2UPTITLE="title";B.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(B,G,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","configStrings","configToday","configNavigator","createTitleBar","createCloseButton","removeTitleBar","removeCloseButton","hide","show","toDate","_toDate","_parseArgs","browser");YAHOO.widget.CalGrp=B;YAHOO.widget.CalendarGroup=B;YAHOO.widget.Calendar2up=function(J,H,I){this.init(J,H,I);};YAHOO.extend(YAHOO.widget.Calendar2up,B);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;})();YAHOO.widget.CalendarNavigator=function(A){this.init(A);};(function(){var A=YAHOO.widget.CalendarNavigator;A.CLASSES={NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};A.DEFAULT_CONFIG={strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};A._DEFAULT_CFG=A.DEFAULT_CONFIG;A.ID_SUFFIX="_nav";A.MONTH_SUFFIX="_month";A.YEAR_SUFFIX="_year";A.ERROR_SUFFIX="_error";A.CANCEL_SUFFIX="_cancel";A.SUBMIT_SUFFIX="_submit";A.YR_MAX_DIGITS=4;A.YR_MINOR_INC=1;A.YR_MAJOR_INC=10;A.UPDATE_DELAY=50;A.YR_PATTERN=/^\d+$/;A.TRIM=/^\s*(.*?)\s*$/;})();YAHOO.widget.CalendarNavigator.prototype={id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(A){var C=A.oDomContainer;this.cal=A;this.id=C.id+YAHOO.widget.CalendarNavigator.ID_SUFFIX;this._doc=C.ownerDocument;var B=YAHOO.env.ua.ie;this.__isIEQuirks=(B&&((B<=6)||(this._doc.compatMode=="BackCompat")));},show:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeShowNavEvent.fire()){if(!this.__rendered){this.render();}this.clearErrors();this._updateMonthUI();this._updateYearUI();this._show(this.navEl,true);this.setInitialFocus();this.showMask();YAHOO.util.Dom.addClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.showNavEvent.fire();}},hide:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeHideNavEvent.fire()){this._show(this.navEl,false);this.hideMask();YAHOO.util.Dom.removeClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.hideNavEvent.fire();}},showMask:function(){this._show(this.maskEl,true);if(this.__isIEQuirks){this._syncMask();}},hideMask:function(){this._show(this.maskEl,false);},getMonth:function(){return this._month;},getYear:function(){return this._year;},setMonth:function(A){if(A>=0&&A<12){this._month=A;}this._updateMonthUI();},setYear:function(B){var A=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(B)&&A.test(B+"")){this._year=B;}this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}this.cal.renderNavEvent.fire();},createNav:function(){var B=YAHOO.widget.CalendarNavigator;var C=this._doc;var D=C.createElement("div");D.className=B.CLASSES.NAV;var A=this.renderNavContents([]);D.innerHTML=A.join("");this.cal.oDomContainer.appendChild(D); 792 this.navEl=D;this.yearEl=C.getElementById(this.id+B.YEAR_SUFFIX);this.monthEl=C.getElementById(this.id+B.MONTH_SUFFIX);this.errorEl=C.getElementById(this.id+B.ERROR_SUFFIX);this.submitEl=C.getElementById(this.id+B.SUBMIT_SUFFIX);this.cancelEl=C.getElementById(this.id+B.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}this._setFirstLastElements();},createMask:function(){var B=YAHOO.widget.CalendarNavigator.CLASSES;var A=this._doc.createElement("div");A.className=B.MASK;this.cal.oDomContainer.appendChild(A);this.maskEl=A;},_syncMask:function(){var B=this.cal.oDomContainer;if(B&&this.maskEl){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(this.maskEl,"width",A.right-A.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",A.bottom-A.top+"px");}},renderNavContents:function(A){var D=YAHOO.widget.CalendarNavigator,E=D.CLASSES,B=A;B[B.length]='<div class="'+E.MONTH+'">';this.renderMonth(B);B[B.length]="</div>";B[B.length]='<div class="'+E.YEAR+'">';this.renderYear(B);B[B.length]="</div>";B[B.length]='<div class="'+E.BUTTONS+'">';this.renderButtons(B);B[B.length]="</div>";B[B.length]='<div class="'+E.ERROR+'" id="'+this.id+D.ERROR_SUFFIX+'"></div>';return B;},renderMonth:function(D){var G=YAHOO.widget.CalendarNavigator,H=G.CLASSES;var I=this.id+G.MONTH_SUFFIX,F=this.__getCfg("monthFormat"),A=this.cal.cfg.getProperty((F==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),E=D;if(A&&A.length>0){E[E.length]='<label for="'+I+'">';E[E.length]=this.__getCfg("month",true);E[E.length]="</label>";E[E.length]='<select name="'+I+'" id="'+I+'" class="'+H.MONTH_CTRL+'">';for(var B=0;B<A.length;B++){E[E.length]='<option value="'+B+'">';E[E.length]=A[B];E[E.length]="</option>";}E[E.length]="</select>";}return E;},renderYear:function(B){var E=YAHOO.widget.CalendarNavigator,F=E.CLASSES;var G=this.id+E.YEAR_SUFFIX,A=E.YR_MAX_DIGITS,D=B;D[D.length]='<label for="'+G+'">';D[D.length]=this.__getCfg("year",true);D[D.length]="</label>";D[D.length]='<input type="text" name="'+G+'" id="'+G+'" class="'+F.YEAR_CTRL+'" maxlength="'+A+'"/>';return D;},renderButtons:function(A){var D=YAHOO.widget.CalendarNavigator.CLASSES;var B=A;B[B.length]='<span class="'+D.BUTTON+" "+D.DEFAULT+'">';B[B.length]='<button type="button" id="'+this.id+"_submit"+'">';B[B.length]=this.__getCfg("submit",true);B[B.length]="</button>";B[B.length]="</span>";B[B.length]='<span class="'+D.BUTTON+'">';B[B.length]='<button type="button" id="'+this.id+"_cancel"+'">';B[B.length]=this.__getCfg("cancel",true);B[B.length]="</button>";B[B.length]="</span>";return B;},applyListeners:function(){var B=YAHOO.util.Event;function A(){if(this.validate()){this.setYear(this._getYearFromUI());}}function C(){this.setMonth(this._getMonthFromUI());}B.on(this.submitEl,"click",this.submit,this,true);B.on(this.cancelEl,"click",this.cancel,this,true);B.on(this.yearEl,"blur",A,this,true);B.on(this.monthEl,"change",C,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}this.applyKeyListeners();},purgeListeners:function(){var A=YAHOO.util.Event;A.removeListener(this.submitEl,"click",this.submit);A.removeListener(this.cancelEl,"click",this.cancel);A.removeListener(this.yearEl,"blur");A.removeListener(this.monthEl,"change");if(this.__isIEQuirks){A.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}this.purgeKeyListeners();},applyKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.on(this.yearEl,"keypress",this._handleEnterKey,this,true);D.on(this.yearEl,C,this._handleDirectionKeys,this,true);D.on(this.lastCtrl,B,this._handleTabKey,this,true);D.on(this.firstCtrl,B,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.removeListener(this.yearEl,"keypress",this._handleEnterKey);D.removeListener(this.yearEl,C,this._handleDirectionKeys);D.removeListener(this.lastCtrl,B,this._handleTabKey);D.removeListener(this.firstCtrl,B,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var B=this.cal;var A=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(A>0){var C=this;window.setTimeout(function(){C._update(B);},A);}else{this._update(B);}}},_update:function(B){var A=YAHOO.widget.DateMath.getDate(this.getYear()-B.cfg.getProperty("YEAR_OFFSET"),this.getMonth(),1);B.cfg.setProperty("pagedate",A);B.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(A){if(this.errorEl){this.errorEl.innerHTML=A;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var A=this.submitEl,C=this.__getCfg("initialFocus");if(C&&C.toLowerCase){C=C.toLowerCase();if(C=="year"){A=this.yearEl;try{this.yearEl.select();}catch(B){}}else{if(C=="month"){A=this.monthEl;}}}if(A&&YAHOO.lang.isFunction(A.focus)){try{A.focus();}catch(D){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}var B=this.navEl.parentNode;if(B){B.removeChild(this.navEl);}this.navEl=null;var A=this.maskEl.parentNode; 793 if(A){A.removeChild(this.maskEl);}this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(B,A){if(B){YAHOO.util.Dom.setStyle(B,"display",(A)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var B=YAHOO.widget.CalendarNavigator;var A=null;if(this.yearEl){var C=this.yearEl.value;C=C.replace(B.TRIM,"$1");if(B.YR_PATTERN.test(C)){A=parseInt(C,10);}}return A;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(B){var A=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(B)==A.ENTER){YAHOO.util.Event.preventDefault(B);this.submit();}},_handleDirectionKeys:function(H){var G=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY,D=YAHOO.widget.CalendarNavigator;var F=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(F)){var B=false;switch(G.getCharCode(H)){case A.UP:this.yearEl.value=F+D.YR_MINOR_INC;B=true;break;case A.DOWN:this.yearEl.value=Math.max(F-D.YR_MINOR_INC,0);B=true;break;case A.PAGE_UP:this.yearEl.value=F+D.YR_MAJOR_INC;B=true;break;case A.PAGE_DOWN:this.yearEl.value=Math.max(F-D.YR_MAJOR_INC,0);B=true;break;default:break;}if(B){G.preventDefault(H);try{this.yearEl.select();}catch(C){}}}},_handleTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(C.getCharCode(D)==A.TAB&&!D.shiftKey){try{C.preventDefault(D);this.firstCtrl.focus();}catch(B){}}},_handleShiftTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(D.shiftKey&&C.getCharCode(D)==A.TAB){try{C.preventDefault(D);this.lastCtrl.focus();}catch(B){}}},__getCfg:function(D,B){var C=YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;var A=this.cal.cfg.getProperty("navigator");if(B){return(A!==true&&A.strings&&A.strings[D])?A.strings[D]:C.strings[D];}else{return(A!==true&&A[D])?A[D]:C[D];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.8.0r4",build:"2449"});/* 794 Copyright (c) 2009, Yahoo! Inc. All rights reserved. 795 Code licensed under the BSD License: 796 http://developer.yahoo.net/yui/license.txt 797 version: 2.8.0r4 798 */ 799 (function(){var D=YAHOO.util.Dom,B=YAHOO.util.Event,F=YAHOO.lang,E=YAHOO.widget;YAHOO.widget.TreeView=function(H,G){if(H){this.init(H);}if(G){this.buildTreeFromObject(G);}else{if(F.trim(this._el.innerHTML)){this.buildTreeFromMarkup(H);}}};var C=E.TreeView;C.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,_hasDblClickSubscriber:false,_dblClickTimer:null,currentFocus:null,singleNodeHighlight:false,_currentlyHighlighted:null,setExpandAnim:function(G){this._expandAnim=(E.TVAnim.isValid(G))?G:null;},setCollapseAnim:function(G){this._collapseAnim=(E.TVAnim.isValid(G))?G:null;},animateExpand:function(I,J){if(this._expandAnim&&this._animCount<this.maxAnim){var G=this;var H=E.TVAnim.getAnim(this._expandAnim,I,function(){G.expandComplete(J);});if(H){++this._animCount;this.fireEvent("animStart",{"node":J,"type":"expand"});H.animate();}return true;}return false;},animateCollapse:function(I,J){if(this._collapseAnim&&this._animCount<this.maxAnim){var G=this;var H=E.TVAnim.getAnim(this._collapseAnim,I,function(){G.collapseComplete(J);});if(H){++this._animCount;this.fireEvent("animStart",{"node":J,"type":"collapse"});H.animate();}return true;}return false;},expandComplete:function(G){--this._animCount;this.fireEvent("animComplete",{"node":G,"type":"expand"});},collapseComplete:function(G){--this._animCount;this.fireEvent("animComplete",{"node":G,"type":"collapse"});},init:function(I){this._el=D.get(I);this.id=D.generateId(this._el,"yui-tv-auto-id-");this.createEvent("animStart",this);this.createEvent("animComplete",this);this.createEvent("collapse",this);this.createEvent("collapseComplete",this);this.createEvent("expand",this);this.createEvent("expandComplete",this);this.createEvent("enterKeyPressed",this);this.createEvent("clickEvent",this);this.createEvent("focusChanged",this);var G=this;this.createEvent("dblClickEvent",{scope:this,onSubscribeCallback:function(){G._hasDblClickSubscriber=true;}});this.createEvent("labelClick",this);this.createEvent("highlightEvent",this);this._nodes=[];C.trees[this.id]=this;this.root=new E.RootNode(this);var H=E.LogWriter;if(this._initEditor){this._initEditor();}},buildTreeFromObject:function(G){var H=function(P,M){var L,Q,K,J,O,I,N;for(L=0;L<M.length;L++){Q=M[L];if(F.isString(Q)){K=new E.TextNode(Q,P);}else{if(F.isObject(Q)){J=Q.children;delete Q.children;O=Q.type||"text";delete Q.type;switch(F.isString(O)&&O.toLowerCase()){case"text":K=new E.TextNode(Q,P);break;case"menu":K=new E.MenuNode(Q,P);break;case"html":K=new E.HTMLNode(Q,P);break;default:if(F.isString(O)){I=E[O];}else{I=O;}if(F.isObject(I)){for(N=I;N&&N!==E.Node;N=N.superclass.constructor){}if(N){K=new I(Q,P);}else{}}else{}}if(J){H(K,J);}}else{}}}};if(!F.isArray(G)){G=[G];}H(this.root,G);},buildTreeFromMarkup:function(I){var H=function(J){var N,Q,M=[],L={},K,O;for(N=D.getFirstChild(J);N;N=D.getNextSibling(N)){switch(N.tagName.toUpperCase()){case"LI":K="";L={expanded:D.hasClass(N,"expanded"),title:N.title||N.alt||null,className:F.trim(N.className.replace(/\bexpanded\b/,""))||null};Q=N.firstChild;if(Q.nodeType==3){K=F.trim(Q.nodeValue.replace(/[\n\t\r]*/g,""));if(K){L.type="text";L.label=K;}else{Q=D.getNextSibling(Q);}}if(!K){if(Q.tagName.toUpperCase()=="A"){L.type="text";L.label=Q.innerHTML;L.href=Q.href;L.target=Q.target;L.title=Q.title||Q.alt||L.title;}else{L.type="html";var P=document.createElement("div");P.appendChild(Q.cloneNode(true));L.html=P.innerHTML;L.hasIcon=true;}}Q=D.getNextSibling(Q);switch(Q&&Q.tagName.toUpperCase()){case"UL":case"OL":L.children=H(Q);break;}if(YAHOO.lang.JSON){O=N.getAttribute("yuiConfig");if(O){O=YAHOO.lang.JSON.parse(O);L=YAHOO.lang.merge(L,O);}}M.push(L);break;case"UL":case"OL":L={type:"text",label:"",children:H(Q)};M.push(L);break;}}return M;};var G=D.getChildrenBy(D.get(I),function(K){var J=K.tagName.toUpperCase();return J=="UL"||J=="OL";});if(G.length){this.buildTreeFromObject(H(G[0]));}else{}},_getEventTargetTdEl:function(H){var I=B.getTarget(H);while(I&&!(I.tagName.toUpperCase()=="TD"&&D.hasClass(I.parentNode,"ygtvrow"))){I=D.getAncestorByTagName(I,"td");}if(F.isNull(I)){return null;}if(/\bygtv(blank)?depthcell/.test(I.className)){return null;}if(I.id){var G=I.id.match(/\bygtv([^\d]*)(.*)/);if(G&&G[2]&&this._nodes[G[2]]){return I;}}return null;},_onClickEvent:function(J){var H=this,L=this._getEventTargetTdEl(J),I,K,G=function(M){I.focus();if(M||!I.href){I.toggle();try{B.preventDefault(J);}catch(N){}}};if(!L){return;}I=this.getNodeByElement(L);if(!I){return;}K=B.getTarget(J);if(D.hasClass(K,I.labelStyle)||D.getAncestorByClassName(K,I.labelStyle)){this.fireEvent("labelClick",I);}if(/\bygtv[tl][mp]h?h?/.test(L.className)){G(true);}else{if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}else{if(this._hasDblClickSubscriber){this._dblClickTimer=window.setTimeout(function(){H._dblClickTimer=null;if(H.fireEvent("clickEvent",{event:J,node:I})!==false){G();}},200);}else{if(H.fireEvent("clickEvent",{event:J,node:I})!==false){G();}}}}},_onDblClickEvent:function(G){if(!this._hasDblClickSubscriber){return;}var H=this._getEventTargetTdEl(G);if(!H){return;}if(!(/\bygtv[tl][mp]h?h?/.test(H.className))){this.fireEvent("dblClickEvent",{event:G,node:this.getNodeByElement(H)});if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}}},_onMouseOverEvent:function(G){var H;if((H=this._getEventTargetTdEl(G))&&(H=this.getNodeByElement(H))&&(H=H.getToggleEl())){H.className=H.className.replace(/\bygtv([lt])([mp])\b/gi,"ygtv$1$2h");}},_onMouseOutEvent:function(G){var H;if((H=this._getEventTargetTdEl(G))&&(H=this.getNodeByElement(H))&&(H=H.getToggleEl())){H.className=H.className.replace(/\bygtv([lt])([mp])h\b/gi,"ygtv$1$2");}},_onKeyDownEvent:function(L){var N=B.getTarget(L),K=this.getNodeByElement(N),J=K,G=YAHOO.util.KeyListener.KEY;switch(L.keyCode){case G.UP:do{if(J.previousSibling){J=J.previousSibling;}else{J=J.parent;}}while(J&&!J._canHaveFocus());if(J){J.focus(); 800 }B.preventDefault(L);break;case G.DOWN:do{if(J.nextSibling){J=J.nextSibling;}else{J.expand();J=(J.children.length||null)&&J.children[0];}}while(J&&!J._canHaveFocus);if(J){J.focus();}B.preventDefault(L);break;case G.LEFT:do{if(J.parent){J=J.parent;}else{J=J.previousSibling;}}while(J&&!J._canHaveFocus());if(J){J.focus();}B.preventDefault(L);break;case G.RIGHT:var I=this,M,H=function(O){I.unsubscribe("expandComplete",H);M(O);};M=function(O){do{if(O.isDynamic()&&!O.childrenRendered){I.subscribe("expandComplete",H);O.expand();O=null;break;}else{O.expand();if(O.children.length){O=O.children[0];}else{O=O.nextSibling;}}}while(O&&!O._canHaveFocus());if(O){O.focus();}};M(J);B.preventDefault(L);break;case G.ENTER:if(K.href){if(K.target){window.open(K.href,K.target);}else{window.location(K.href);}}else{K.toggle();}this.fireEvent("enterKeyPressed",K);B.preventDefault(L);break;case G.HOME:J=this.getRoot();if(J.children.length){J=J.children[0];}if(J._canHaveFocus()){J.focus();}B.preventDefault(L);break;case G.END:J=J.parent.children;J=J[J.length-1];if(J._canHaveFocus()){J.focus();}B.preventDefault(L);break;case 107:if(L.shiftKey){K.parent.expandAll();}else{K.expand();}break;case 109:if(L.shiftKey){K.parent.collapseAll();}else{K.collapse();}break;default:break;}},render:function(){var G=this.root.getHtml(),H=this.getEl();H.innerHTML=G;if(!this._hasEvents){B.on(H,"click",this._onClickEvent,this,true);B.on(H,"dblclick",this._onDblClickEvent,this,true);B.on(H,"mouseover",this._onMouseOverEvent,this,true);B.on(H,"mouseout",this._onMouseOutEvent,this,true);B.on(H,"keydown",this._onKeyDownEvent,this,true);}this._hasEvents=true;},getEl:function(){if(!this._el){this._el=D.get(this.id);}return this._el;},regNode:function(G){this._nodes[G.index]=G;},getRoot:function(){return this.root;},setDynamicLoad:function(G,H){this.root.setDynamicLoad(G,H);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(H){var G=this._nodes[H];return(G)?G:null;},getNodeByProperty:function(I,H){for(var G in this._nodes){if(this._nodes.hasOwnProperty(G)){var J=this._nodes[G];if((I in J&&J[I]==H)||(J.data&&H==J.data[I])){return J;}}}return null;},getNodesByProperty:function(J,I){var G=[];for(var H in this._nodes){if(this._nodes.hasOwnProperty(H)){var K=this._nodes[H];if((J in K&&K[J]==I)||(K.data&&I==K.data[J])){G.push(K);}}}return(G.length)?G:null;},getNodesBy:function(I){var G=[];for(var H in this._nodes){if(this._nodes.hasOwnProperty(H)){var J=this._nodes[H];if(I(J)){G.push(J);}}}return(G.length)?G:null;},getNodeByElement:function(I){var J=I,G,H=/ygtv([^\d]*)(.*)/;do{if(J&&J.id){G=J.id.match(H);if(G&&G[2]){return this.getNodeByIndex(G[2]);}}J=J.parentNode;if(!J||!J.tagName){break;}}while(J.id!==this.id&&J.tagName.toLowerCase()!=="body");return null;},getHighlightedNode:function(){return this._currentlyHighlighted;},removeNode:function(H,G){if(H.isRoot()){return false;}var I=H.parent;if(I.parent){I=I.parent;}this._deleteNode(H);if(G&&I&&I.childrenRendered){I.refresh();}return true;},_removeChildren_animComplete:function(G){this.unsubscribe(this._removeChildren_animComplete);this.removeChildren(G.node);},removeChildren:function(G){if(G.expanded){if(this._collapseAnim){this.subscribe("animComplete",this._removeChildren_animComplete,this,true);E.Node.prototype.collapse.call(G);return;}G.collapse();}while(G.children.length){this._deleteNode(G.children[0]);}if(G.isRoot()){E.Node.prototype.expand.call(G);}G.childrenRendered=false;G.dynamicLoadComplete=false;G.updateIcon();},_deleteNode:function(G){this.removeChildren(G);this.popNode(G);},popNode:function(J){var K=J.parent;var H=[];for(var I=0,G=K.children.length;I<G;++I){if(K.children[I]!=J){H[H.length]=K.children[I];}}K.children=H;K.childrenRendered=false;if(J.previousSibling){J.previousSibling.nextSibling=J.nextSibling;}if(J.nextSibling){J.nextSibling.previousSibling=J.previousSibling;}if(this.currentFocus==J){this.currentFocus=null;}if(this._currentlyHighlighted==J){this._currentlyHighlighted=null;}J.parent=null;J.previousSibling=null;J.nextSibling=null;J.tree=null;delete this._nodes[J.index];},destroy:function(){if(this._destroyEditor){this._destroyEditor();}var H=this.getEl();B.removeListener(H,"click");B.removeListener(H,"dblclick");B.removeListener(H,"mouseover");B.removeListener(H,"mouseout");B.removeListener(H,"keydown");for(var G=0;G<this._nodes.length;G++){var I=this._nodes[G];if(I&&I.destroy){I.destroy();}}H.innerHTML="";this._hasEvents=false;},toString:function(){return"TreeView "+this.id;},getNodeCount:function(){return this.getRoot().getNodeCount();},getTreeDefinition:function(){return this.getRoot().getNodeDefinition();},onExpand:function(G){},onCollapse:function(G){},setNodesProperty:function(G,I,H){this.root.setNodesProperty(G,I);if(H){this.root.refresh();}},onEventToggleHighlight:function(H){var G;if("node" in H&&H.node instanceof E.Node){G=H.node;}else{if(H instanceof E.Node){G=H;}else{return false;}}G.toggleHighlight();return false;}};var A=C.prototype;A.draw=A.render;YAHOO.augment(C,YAHOO.util.EventProvider);C.nodeCount=0;C.trees=[];C.getTree=function(H){var G=C.trees[H];return(G)?G:null;};C.getNode=function(H,I){var G=C.getTree(H);return(G)?G.getNodeByIndex(I):null;};C.FOCUS_CLASS_NAME="ygtvfocus";})();(function(){var B=YAHOO.util.Dom,C=YAHOO.lang,A=YAHOO.util.Event;YAHOO.widget.Node=function(F,E,D){if(F){this.init(F,E,D);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,isLeaf:false,contentStyle:"",contentElId:null,enableHighlight:true,highlightState:0,propagateHighlightUp:false,propagateHighlightDown:false,className:null,_type:"Node",init:function(G,F,D){this.data={};this.children=[];this.index=YAHOO.widget.TreeView.nodeCount; 801 ++YAHOO.widget.TreeView.nodeCount;this.contentElId="ygtvcontentel"+this.index;if(C.isObject(G)){for(var E in G){if(G.hasOwnProperty(E)){if(E.charAt(0)!="_"&&!C.isUndefined(this[E])&&!C.isFunction(this[E])){this[E]=G[E];}else{this.data[E]=G[E];}}}}if(!C.isUndefined(D)){this.expanded=D;}this.createEvent("parentChange",this);if(F){F.appendChild(this);}},applyParent:function(E){if(!E){return false;}this.tree=E.tree;this.parent=E;this.depth=E.depth+1;this.tree.regNode(this);E.childrenRendered=false;for(var F=0,D=this.children.length;F<D;++F){this.children[F].applyParent(this);}this.fireEvent("parentChange");return true;},appendChild:function(E){if(this.hasChildren()){var D=this.children[this.children.length-1];D.nextSibling=E;E.previousSibling=D;}this.children[this.children.length]=E;E.applyParent(this);if(this.childrenRendered&&this.expanded){this.getChildrenEl().style.display="";}return E;},appendTo:function(D){return D.appendChild(this);},insertBefore:function(D){var F=D.parent;if(F){if(this.tree){this.tree.popNode(this);}var E=D.isChildOf(F);F.children.splice(E,0,this);if(D.previousSibling){D.previousSibling.nextSibling=this;}this.previousSibling=D.previousSibling;this.nextSibling=D;D.previousSibling=this;this.applyParent(F);}return this;},insertAfter:function(D){var F=D.parent;if(F){if(this.tree){this.tree.popNode(this);}var E=D.isChildOf(F);if(!D.nextSibling){this.nextSibling=null;return this.appendTo(F);}F.children.splice(E+1,0,this);D.nextSibling.previousSibling=this;this.previousSibling=D;this.nextSibling=D.nextSibling;D.nextSibling=this;this.applyParent(F);}return this;},isChildOf:function(E){if(E&&E.children){for(var F=0,D=E.children.length;F<D;++F){if(E.children[F]===this){return F;}}}return -1;},getSiblings:function(){var D=this.parent.children.slice(0);for(var E=0;E<D.length&&D[E]!=this;E++){}D.splice(E,1);if(D.length){return D;}return null;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl(),this)){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl(),this)){this.getChildrenEl().style.display="none";}},getElId:function(){return"ygtv"+this.index;},getChildrenElId:function(){return"ygtvc"+this.index;},getToggleElId:function(){return"ygtvt"+this.index;},getEl:function(){return B.get(this.getElId());},getChildrenEl:function(){return B.get(this.getChildrenElId());},getToggleEl:function(){return B.get(this.getToggleElId());},getContentEl:function(){return B.get(this.contentElId);},collapse:function(){if(!this.expanded){return;}var D=this.tree.onCollapse(this);if(false===D){return;}D=this.tree.fireEvent("collapse",this);if(false===D){return;}if(!this.getEl()){this.expanded=false;}else{this.hideChildren();this.expanded=false;this.updateIcon();}D=this.tree.fireEvent("collapseComplete",this);},expand:function(F){if(this.isLoading||(this.expanded&&!F)){return;}var D=true;if(!F){D=this.tree.onExpand(this);if(false===D){return;}D=this.tree.fireEvent("expand",this);}if(false===D){return;}if(!this.getEl()){this.expanded=true;return;}if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}this.expanded=true;this.updateIcon();if(this.isLoading){this.expanded=false;return;}if(!this.multiExpand){var G=this.getSiblings();for(var E=0;G&&E<G.length;++E){if(G[E]!=this&&G[E].expanded){G[E].collapse();}}}this.showChildren();D=this.tree.fireEvent("expandComplete",this);},updateIcon:function(){if(this.hasIcon){var D=this.getToggleEl();if(D){D.className=D.className.replace(/\bygtv(([tl][pmn]h?)|(loading))\b/gi,this.getStyle());}}},getStyle:function(){if(this.isLoading){return"ygtvloading";}else{var E=(this.nextSibling)?"t":"l";var D="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){D=(this.expanded)?"m":"p";}return"ygtv"+E+D;}},getHoverStyle:function(){var D=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){D+="h";}return D;},expandAll:function(){var D=this.children.length;for(var E=0;E<D;++E){var F=this.children[E];if(F.isDynamic()){break;}else{if(!F.multiExpand){break;}else{F.expand();F.expandAll();}}}},collapseAll:function(){for(var D=0;D<this.children.length;++D){this.children[D].collapse();this.children[D].collapseAll();}},setDynamicLoad:function(D,E){if(D){this.dataLoader=D;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}if(E){this.iconMode=E;}},isRoot:function(){return(this==this.tree.root);},isDynamic:function(){if(this.isLeaf){return false;}else{return(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));}},getIconMode:function(){return(this.iconMode||this.tree.root.iconMode);},hasChildren:function(D){if(this.isLeaf){return false;}else{return(this.children.length>0||(D&&this.isDynamic()&&!this.dynamicLoadComplete));}},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;return['<div class="ygtvitem" id="',this.getElId(),'">',this.getNodeHtml(),this.getChildrenHtml(),"</div>"].join("");},getChildrenHtml:function(){var D=[];D[D.length]='<div class="ygtvchildren" id="'+this.getChildrenElId()+'"';if(!this.expanded||!this.hasChildren()){D[D.length]=' style="display:none;"';}D[D.length]=">";if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){D[D.length]=this.renderChildren();}D[D.length]="</div>";return D.join("");},renderChildren:function(){var D=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){D.dataLoader(D,function(){D.loadComplete();});},10);}else{if(this.tree.root.dataLoader){setTimeout(function(){D.tree.root.dataLoader(D,function(){D.loadComplete();});},10);}else{return"Error: data loader not found or not specified.";}}return"";}else{return this.completeRender();}},completeRender:function(){var E=[];for(var D=0;D<this.children.length;++D){E[E.length]=this.children[D].getHtml(); 802 }this.childrenRendered=true;return E.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.propagateHighlightDown){if(this.highlightState===1&&!this.tree.singleNodeHighlight){for(var D=0;D<this.children.length;D++){this.children[D].highlight(true);}}else{if(this.highlightState===0||this.tree.singleNodeHighlight){for(D=0;D<this.children.length;D++){this.children[D].unhighlight(true);}}}}this.dynamicLoadComplete=true;this.isLoading=false;this.expand(true);this.tree.locked=false;},getAncestor:function(E){if(E>=this.depth||E<0){return null;}var D=this.parent;while(D.depth>E){D=D.parent;}return D;},getDepthStyle:function(D){return(this.getAncestor(D).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){var E=[];E[E.length]='<table id="ygtvtableel'+this.index+'" border="0" cellpadding="0" cellspacing="0" class="ygtvtable ygtvdepth'+this.depth;if(this.enableHighlight){E[E.length]=" ygtv-highlight"+this.highlightState;}if(this.className){E[E.length]=" "+this.className;}E[E.length]='"><tr class="ygtvrow">';for(var D=0;D<this.depth;++D){E[E.length]='<td class="ygtvcell '+this.getDepthStyle(D)+'"><div class="ygtvspacer"></div></td>';}if(this.hasIcon){E[E.length]='<td id="'+this.getToggleElId();E[E.length]='" class="ygtvcell ';E[E.length]=this.getStyle();E[E.length]='"><a href="#" class="ygtvspacer"> </a></td>';}E[E.length]='<td id="'+this.contentElId;E[E.length]='" class="ygtvcell ';E[E.length]=this.contentStyle+' ygtvcontent" ';E[E.length]=(this.nowrap)?' nowrap="nowrap" ':"";E[E.length]=" >";E[E.length]=this.getContentHtml();E[E.length]="</td></tr></table>";return E.join("");},getContentHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var D=this.getToggleEl();if(D){D.className=D.className.replace(/\bygtv[lt][nmp]h*\b/gi,this.getStyle());}}},toString:function(){return this._type+" ("+this.index+")";},_focusHighlightedItems:[],_focusedItem:null,_canHaveFocus:function(){return this.getEl().getElementsByTagName("a").length>0;},_removeFocus:function(){if(this._focusedItem){A.removeListener(this._focusedItem,"blur");this._focusedItem=null;}var D;while((D=this._focusHighlightedItems.shift())){B.removeClass(D,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);}},focus:function(){var F=false,D=this;if(this.tree.currentFocus){this.tree.currentFocus._removeFocus();}var E=function(G){if(G.parent){E(G.parent);G.parent.expand();}};E(this);B.getElementsBy(function(G){return(/ygtv(([tl][pmn]h?)|(content))/).test(G.className);},"td",D.getEl().firstChild,function(H){B.addClass(H,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);if(!F){var G=H.getElementsByTagName("a");if(G.length){G=G[0];G.focus();D._focusedItem=G;A.on(G,"blur",function(){D.tree.fireEvent("focusChanged",{oldNode:D.tree.currentFocus,newNode:null});D.tree.currentFocus=null;D._removeFocus();});F=true;}}D._focusHighlightedItems.push(H);});if(F){this.tree.fireEvent("focusChanged",{oldNode:this.tree.currentFocus,newNode:this});this.tree.currentFocus=this;}else{this.tree.fireEvent("focusChanged",{oldNode:D.tree.currentFocus,newNode:null});this.tree.currentFocus=null;this._removeFocus();}return F;},getNodeCount:function(){for(var D=0,E=0;D<this.children.length;D++){E+=this.children[D].getNodeCount();}return E+1;},getNodeDefinition:function(){if(this.isDynamic()){return false;}var G,D=C.merge(this.data),F=[];if(this.expanded){D.expanded=this.expanded;}if(!this.multiExpand){D.multiExpand=this.multiExpand;}if(!this.renderHidden){D.renderHidden=this.renderHidden;}if(!this.hasIcon){D.hasIcon=this.hasIcon;}if(this.nowrap){D.nowrap=this.nowrap;}if(this.className){D.className=this.className;}if(this.editable){D.editable=this.editable;}if(this.enableHighlight){D.enableHighlight=this.enableHighlight;}if(this.highlightState){D.highlightState=this.highlightState;}if(this.propagateHighlightUp){D.propagateHighlightUp=this.propagateHighlightUp;}if(this.propagateHighlightDown){D.propagateHighlightDown=this.propagateHighlightDown;}D.type=this._type;for(var E=0;E<this.children.length;E++){G=this.children[E].getNodeDefinition();if(G===false){return false;}F.push(G);}if(F.length){D.children=F;}return D;},getToggleLink:function(){return"return false;";},setNodesProperty:function(D,G,F){if(D.charAt(0)!="_"&&!C.isUndefined(this[D])&&!C.isFunction(this[D])){this[D]=G;}else{this.data[D]=G;}for(var E=0;E<this.children.length;E++){this.children[E].setNodesProperty(D,G);}if(F){this.refresh();}},toggleHighlight:function(){if(this.enableHighlight){if(this.highlightState==1){this.unhighlight();}else{this.highlight();}}},highlight:function(E){if(this.enableHighlight){if(this.tree.singleNodeHighlight){if(this.tree._currentlyHighlighted){this.tree._currentlyHighlighted.unhighlight(E);}this.tree._currentlyHighlighted=this;}this.highlightState=1;this._setHighlightClassName();if(!this.tree.singleNodeHighlight){if(this.propagateHighlightDown){for(var D=0;D<this.children.length;D++){this.children[D].highlight(true);}}if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted();}}}if(!E){this.tree.fireEvent("highlightEvent",this);}}},unhighlight:function(E){if(this.enableHighlight){this.tree._currentlyHighlighted=null;this.highlightState=0;this._setHighlightClassName();if(!this.tree.singleNodeHighlight){if(this.propagateHighlightDown){for(var D=0;D<this.children.length;D++){this.children[D].unhighlight(true);}}if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted();}}}if(!E){this.tree.fireEvent("highlightEvent",this);}}},_childrenHighlighted:function(){var F=false,E=false;if(this.enableHighlight){for(var D=0;D<this.children.length;D++){switch(this.children[D].highlightState){case 0:E=true;break;case 1:F=true;break;case 2:F=E=true;break;}}if(F&&E){this.highlightState=2;}else{if(F){this.highlightState=1;}else{this.highlightState=0;}}this._setHighlightClassName();if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted(); 803 }}}},_setHighlightClassName:function(){var D=B.get("ygtvtableel"+this.index);if(D){D.className=D.className.replace(/\bygtv-highlight\d\b/gi,"ygtv-highlight"+this.highlightState);}}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);})();YAHOO.widget.RootNode=function(A){this.init(null,null,true);this.tree=A;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{_type:"RootNode",getNodeHtml:function(){return"";},toString:function(){return this._type;},loadComplete:function(){this.tree.draw();},getNodeCount:function(){for(var A=0,B=0;A<this.children.length;A++){B+=this.children[A].getNodeCount();}return B;},getNodeDefinition:function(){for(var C,A=[],B=0;B<this.children.length;B++){C=this.children[B].getNodeDefinition();if(C===false){return false;}A.push(C);}return A;},collapse:function(){},expand:function(){},getSiblings:function(){return null;},focus:function(){}});(function(){var B=YAHOO.util.Dom,C=YAHOO.lang,A=YAHOO.util.Event;YAHOO.widget.TextNode=function(F,E,D){if(F){if(C.isString(F)){F={label:F};}this.init(F,E,D);this.setUpLabel(F);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,title:null,href:null,target:"_self",_type:"TextNode",setUpLabel:function(D){if(C.isString(D)){D={label:D};}else{if(D.style){this.labelStyle=D.style;}}this.label=D.label;this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return B.get(this.labelElId);},getContentHtml:function(){var D=[];D[D.length]=this.href?"<a":"<span";D[D.length]=' id="'+this.labelElId+'"';D[D.length]=' class="'+this.labelStyle+'"';if(this.href){D[D.length]=' href="'+this.href+'"';D[D.length]=' target="'+this.target+'"';}if(this.title){D[D.length]=' title="'+this.title+'"';}D[D.length]=" >";D[D.length]=this.label;D[D.length]=this.href?"</a>":"</span>";return D.join("");},getNodeDefinition:function(){var D=YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);if(D===false){return false;}D.label=this.label;if(this.labelStyle!="ygtvlabel"){D.style=this.labelStyle;}if(this.title){D.title=this.title;}if(this.href){D.href=this.href;}if(this.target!="_self"){D.target=this.target;}return D;},toString:function(){return YAHOO.widget.TextNode.superclass.toString.call(this)+": "+this.label;},onLabelClick:function(){return false;},refresh:function(){YAHOO.widget.TextNode.superclass.refresh.call(this);var D=this.getLabelEl();D.innerHTML=this.label;if(D.tagName.toUpperCase()=="A"){D.href=this.href;D.target=this.target;}}});})();YAHOO.widget.MenuNode=function(C,B,A){YAHOO.widget.MenuNode.superclass.constructor.call(this,C,B,A);this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{_type:"MenuNode"});(function(){var B=YAHOO.util.Dom,C=YAHOO.lang,A=YAHOO.util.Event;YAHOO.widget.HTMLNode=function(G,F,E,D){if(G){this.init(G,F,E);this.initContent(G,D);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",html:null,_type:"HTMLNode",initContent:function(E,D){this.setHtml(E);this.contentElId="ygtvcontentel"+this.index;if(!C.isUndefined(D)){this.hasIcon=D;}},setHtml:function(E){this.html=(typeof E==="string")?E:E.html;var D=this.getContentEl();if(D){D.innerHTML=this.html;}},getContentHtml:function(){return this.html;},getNodeDefinition:function(){var D=YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);if(D===false){return false;}D.html=this.html;return D;}});})();(function(){var B=YAHOO.util.Dom,C=YAHOO.lang,A=YAHOO.util.Event,D=YAHOO.widget.Calendar;YAHOO.widget.DateNode=function(G,F,E){YAHOO.widget.DateNode.superclass.constructor.call(this,G,F,E);};YAHOO.extend(YAHOO.widget.DateNode,YAHOO.widget.TextNode,{_type:"DateNode",calendarConfig:null,fillEditorContainer:function(G){var H,F=G.inputContainer;if(C.isUndefined(D)){B.replaceClass(G.editorPanel,"ygtv-edit-DateNode","ygtv-edit-TextNode");YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this,G);return;}if(G.nodeType!=this._type){G.nodeType=this._type;G.saveOnEnter=false;G.node.destroyEditorContents(G);G.inputObject=H=new D(F.appendChild(document.createElement("div")));if(this.calendarConfig){H.cfg.applyConfig(this.calendarConfig,true);H.cfg.fireQueue();}H.selectEvent.subscribe(function(){this.tree._closeEditor(true);},this,true);}else{H=G.inputObject;}G.oldValue=this.label;H.cfg.setProperty("selected",this.label,false);var I=H.cfg.getProperty("DATE_FIELD_DELIMITER");var E=this.label.split(I);H.cfg.setProperty("pagedate",E[H.cfg.getProperty("MDY_MONTH_POSITION")-1]+I+E[H.cfg.getProperty("MDY_YEAR_POSITION")-1]);H.cfg.fireQueue();H.render();H.oDomContainer.focus();},getEditorValue:function(F){if(C.isUndefined(D)){return F.inputElement.value;}else{var H=F.inputObject,G=H.getSelectedDates()[0],E=[];E[H.cfg.getProperty("MDY_DAY_POSITION")-1]=G.getDate();E[H.cfg.getProperty("MDY_MONTH_POSITION")-1]=G.getMonth()+1;E[H.cfg.getProperty("MDY_YEAR_POSITION")-1]=G.getFullYear();return E.join(H.cfg.getProperty("DATE_FIELD_DELIMITER"));}},displayEditedValue:function(G,E){var F=E.node;F.label=G;F.getLabelEl().innerHTML=G;},getNodeDefinition:function(){var E=YAHOO.widget.DateNode.superclass.getNodeDefinition.call(this);if(E===false){return false;}if(this.calendarConfig){E.calendarConfig=this.calendarConfig;}return E;}});})();(function(){var E=YAHOO.util.Dom,F=YAHOO.lang,B=YAHOO.util.Event,D=YAHOO.widget.TreeView,C=D.prototype;D.editorData={active:false,whoHasIt:null,nodeType:null,editorPanel:null,inputContainer:null,buttonsContainer:null,node:null,saveOnEnter:true,oldValue:undefined};C.validator=null;C._initEditor=function(){this.createEvent("editorSaveEvent",this);this.createEvent("editorCancelEvent",this);};C._nodeEditing=function(M){if(M.fillEditorContainer&&M.editable){var I,K,L,J,H=D.editorData;H.active=true;H.whoHasIt=this;if(!H.nodeType){H.editorPanel=I=document.body.appendChild(document.createElement("div"));E.addClass(I,"ygtv-label-editor");L=H.buttonsContainer=I.appendChild(document.createElement("div"));E.addClass(L,"ygtv-button-container");J=L.appendChild(document.createElement("button")); 804 E.addClass(J,"ygtvok");J.innerHTML=" ";J=L.appendChild(document.createElement("button"));E.addClass(J,"ygtvcancel");J.innerHTML=" ";B.on(L,"click",function(O){var P=B.getTarget(O);var N=D.editorData.node;if(E.hasClass(P,"ygtvok")){B.stopEvent(O);this._closeEditor(true);}if(E.hasClass(P,"ygtvcancel")){B.stopEvent(O);this._closeEditor(false);}},this,true);H.inputContainer=I.appendChild(document.createElement("div"));E.addClass(H.inputContainer,"ygtv-input");B.on(I,"keydown",function(P){var O=D.editorData,N=YAHOO.util.KeyListener.KEY;switch(P.keyCode){case N.ENTER:B.stopEvent(P);if(O.saveOnEnter){this._closeEditor(true);}break;case N.ESCAPE:B.stopEvent(P);this._closeEditor(false);break;}},this,true);}else{I=H.editorPanel;}H.node=M;if(H.nodeType){E.removeClass(I,"ygtv-edit-"+H.nodeType);}E.addClass(I," ygtv-edit-"+M._type);K=E.getXY(M.getContentEl());E.setStyle(I,"left",K[0]+"px");E.setStyle(I,"top",K[1]+"px");E.setStyle(I,"display","block");I.focus();M.fillEditorContainer(H);return true;}};C.onEventEditNode=function(H){if(H instanceof YAHOO.widget.Node){H.editNode();}else{if(H.node instanceof YAHOO.widget.Node){H.node.editNode();}}};C._closeEditor=function(J){var H=D.editorData,I=H.node,K=true;if(J){K=H.node.saveEditorValue(H)!==false;}else{this.fireEvent("editorCancelEvent",I);}if(K){E.setStyle(H.editorPanel,"display","none");H.active=false;I.focus();}};C._destroyEditor=function(){var H=D.editorData;if(H&&H.nodeType&&(!H.active||H.whoHasIt===this)){B.removeListener(H.editorPanel,"keydown");B.removeListener(H.buttonContainer,"click");H.node.destroyEditorContents(H);document.body.removeChild(H.editorPanel);H.nodeType=H.editorPanel=H.inputContainer=H.buttonsContainer=H.whoHasIt=H.node=null;H.active=false;}};var G=YAHOO.widget.Node.prototype;G.editable=false;G.editNode=function(){this.tree._nodeEditing(this);};G.fillEditorContainer=null;G.destroyEditorContents=function(H){B.purgeElement(H.inputContainer,true);H.inputContainer.innerHTML="";};G.saveEditorValue=function(H){var J=H.node,K,I=J.tree.validator;K=this.getEditorValue(H);if(F.isFunction(I)){K=I(K,H.oldValue,J);if(F.isUndefined(K)){return false;}}if(this.tree.fireEvent("editorSaveEvent",{newValue:K,oldValue:H.oldValue,node:J})!==false){this.displayEditedValue(K,H);}};G.getEditorValue=function(H){};G.displayEditedValue=function(I,H){};var A=YAHOO.widget.TextNode.prototype;A.fillEditorContainer=function(I){var H;if(I.nodeType!=this._type){I.nodeType=this._type;I.saveOnEnter=true;I.node.destroyEditorContents(I);I.inputElement=H=I.inputContainer.appendChild(document.createElement("input"));}else{H=I.inputElement;}I.oldValue=this.label;H.value=this.label;H.focus();H.select();};A.getEditorValue=function(H){return H.inputElement.value;};A.displayEditedValue=function(J,H){var I=H.node;I.label=J;I.getLabelEl().innerHTML=J;};A.destroyEditorContents=function(H){H.inputContainer.innerHTML="";};})();YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(B,A,C){if(YAHOO.widget[B]){return new YAHOO.widget[B](A,C);}else{return null;}},isValid:function(A){return(YAHOO.widget[A]);}};}();YAHOO.widget.TVFadeIn=function(A,B){this.el=A;this.callback=B;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var D=this;var C=this.el.style;C.opacity=0.1;C.filter="alpha(opacity=10)";C.display="";var B=0.4;var A=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},B);A.onComplete.subscribe(function(){D.onComplete();});A.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(A,B){this.el=A;this.callback=B;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var C=this;var B=0.4;var A=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},B);A.onComplete.subscribe(function(){C.onComplete();});A.animate();},onComplete:function(){var A=this.el.style;A.display="none";A.opacity=1;A.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}};YAHOO.register("treeview",YAHOO.widget.TreeView,{version:"2.8.0r4",build:"2449"});/** 805 * The top-level WSO2Vis namespace. All public methods and fields should be 806 * registered on this object. Note that core wso2vis source is surrounded by an 807 * anonymous function, so any other declared globals will not be visible outside 808 * of core methods. This also allows multiple versions of WSO2Vis to coexist, 809 * since each version will see their own <tt>wso2vis</tt> namespace. 810 * 811 * @namespace The top-level wso2vis namespace, <tt>wso2vis</tt>. 812 */ 813 var wso2vis = {}; 814 815 /** 816 * @namespace wso2vis namespace for Providers, <tt>wso2vis.p</tt>. 817 */ 818 wso2vis.p = {}; 819 820 /** 821 * @namespace wso2vis namespace for Filters, <tt>wso2vis.f</tt>. 822 */ 823 wso2vis.f = {}; 824 825 /** 826 * @namespace wso2vis namespace for Filter Forms, <tt>wso2vis.f.form</tt>. 827 */ 828 wso2vis.f.form = {}; 829 830 /** 831 * @namespace wso2vis namespace for Subscribers, <tt>wso2vis.s</tt>. 832 */ 833 wso2vis.s = {}; 834 835 /** 836 * @namespace wso2vis namespace for Subscriber Charts, <tt>wso2vis.s.chart</tt>. 837 */ 838 wso2vis.s.chart = {}; 839 840 /** 841 * @namespace wso2vis namespace for Subscriber Protovis Charts, <tt>wso2vis.s.chart.protovis</tt>. 842 */ 843 wso2vis.s.chart.protovis = {}; 844 845 /** 846 * @namespace wso2vis namespace for Subscriber Raphael Charts, <tt>wso2vis.s.chart.raphael</tt>. 847 */ 848 wso2vis.s.chart.raphael = {}; 849 850 /** 851 * @namespace wso2vis namespace for Subscriber Infovis Charts, <tt>wso2vis.s.chart.raphael</tt>. 852 */ 853 wso2vis.s.chart.infovis = {}; 854 855 /** 856 * @namespace wso2vis namespace for Subscriber composite Charts, <tt>wso2vis.s.chart.composite</tt>. 857 */ 858 wso2vis.s.chart.composite = {}; 859 860 /** 861 * @namespace wso2vis namespace for Subscriber Forms, <tt>wso2vis.s.form</tt>. 862 */ 863 wso2vis.s.form = {}; 864 865 /** 866 * @namespace wso2vis namespace for Subscriber Gauges, <tt>wso2vis.s.gauge</tt>. 867 */ 868 wso2vis.s.gauge = {}; 869 870 /** 871 * @namespace wso2vis namespace for Subscriber Raphael Charts, <tt>wso2vis.s.chart.raphael</tt>. 872 */ 873 wso2vis.s.gauge.raphael = {}; 874 875 /** 876 * @namespace wso2vis namespace for Utility Components, <tt>wso2vis.u</tt>. 877 */ 878 wso2vis.u = {}; 879 880 /** 881 * @namespace wso2vis namespace for utility functions, <tt>wso2vis.util</tt>. 882 */ 883 wso2vis.util = {}; 884 885 /** 886 * @namespace wso2vis namespace for Adaptors, <tt>wso2vis.a</tt>. 887 */ 888 wso2vis.a = {}; 889 890 /** 891 * @namespace wso2vis namespace for controls, <tt>wso2vis.c</tt>. 892 */ 893 wso2vis.c = {}; 894 895 wso2vis.ctrls = {}; 896 897 /** 898 * @namespace wso2vis namespace for user defined custom functions, <tt>wso2vis.fn</tt>. 899 */ 900 wso2vis.fn = {}; 901 902 /** 903 * WSO2Vis major and minor version numbers. 904 * 905 * @namespace WSO2Vis major and minor version numbers. 906 */ 907 wso2vis.version = { 908 /** 909 * The major version number. 910 * 911 * @type number 912 * @constant 913 */ 914 major: 0, 915 916 /** 917 * The minor version number. 918 * 919 * @type number 920 * @constant 921 */ 922 minor: 1 923 }; 924 925 /** 926 * WSO2Vis environment. All data providers, filters and charts are registred in the environment. 927 */ 928 wso2vis.environment = { 929 /** 930 * providers array 931 */ 932 providers: [], 933 934 /** 935 * filters array 936 */ 937 filters: [], 938 939 /** 940 * charts array 941 */ 942 charts: [], 943 944 /** 945 * dialogs array 946 */ 947 dialogs: [], 948 949 /** 950 * subscribers array 951 */ 952 subscribers: [], 953 954 /** 955 * adapters array 956 */ 957 adapters: [], 958 959 /** 960 * controls array 961 */ 962 controls: [], 963 964 /** 965 * gauges array 966 */ 967 gauges: [] 968 969 }; 970 971 wso2vis.fn.getProviderFromID = function(id) { 972 if ((id >= 0) && (wso2vis.environment.providers.length > id)) { 973 return wso2vis.environment.providers[id]; 974 } 975 return null; 976 }; 977 978 wso2vis.fn.getFilterFromID = function(id) { 979 if ((id >= 0) && (wso2vis.environment.filters.length > id)) { 980 return wso2vis.environment.filters[id]; 981 } 982 return null; 983 }; 984 985 wso2vis.fn.getChartFromID = function(id) { 986 if ((id >= 0) && (wso2vis.environment.charts.length > id)) { 987 return wso2vis.environment.charts[id]; 988 } 989 return null; 990 }; 991 992 wso2vis.fn.getDialogFromID = function(id) { 993 if ((id >= 0) && (wso2vis.environment.dialogs.length > id)) { 994 return wso2vis.environment.dialogs[id]; 995 } 996 return null; 997 }; 998 999 wso2vis.fn.getElementFromID = function(id) { 1000 if ((id >= 0) && (wso2vis.environment.elements.length > id)) { 1001 return wso2vis.environment.elements[id]; 1002 } 1003 return null; 1004 }; 1005 1006 wso2vis.fn.getAdapterFromID = function(id) { 1007 if ((id >= 0) && (wso2vis.environment.adapters.length > id)) { 1008 return wso2vis.environment.adapters[id]; 1009 } 1010 return null; 1011 }; 1012 1013 wso2vis.fn.getControlFromID = function(id) { 1014 if ((id >= 0) && (wso2vis.environment.controls.length > id)) { 1015 return wso2vis.environment.controls[id]; 1016 } 1017 return null; 1018 }; 1019 1020 wso2vis.fn.getGaugeFromID = function(id) { 1021 if ((id >= 0) && (wso2vis.environment.gauges.length > id)) { 1022 return wso2vis.environment.gauges[id]; 1023 } 1024 return null; 1025 }; 1026 1027 wso2vis.fn.traverseToDataField = function (object, dataFieldArray) { 1028 var a = object; 1029 for (var i = 0; i < dataFieldArray.length; i++) { 1030 a = a[dataFieldArray[i]]; 1031 } 1032 return a; 1033 }; 1034 1035 wso2vis.fn.traverseNKillLeaf = function (object, dataFieldArray) { 1036 var a = object; 1037 for (var i = 0; i < dataFieldArray.length; i++) { 1038 if (i == dataFieldArray.length - 1) { 1039 delete a[dataFieldArray[i]]; 1040 } 1041 else { 1042 a = a[dataFieldArray[i]]; 1043 } 1044 } 1045 }; 1046 1047 /* using "Parasitic Combination Inheritance" */ 1048 wso2vis.extend = function(subc, superc /*, overrides*/) { 1049 if (!superc||!subc) { 1050 throw new Error("extend failed, please check that " + 1051 "all dependencies are included."); 1052 } 1053 var F = function() {}/*, i*/; 1054 F.prototype=superc.prototype; 1055 subc.prototype=new F(); 1056 subc.prototype.constructor=subc; 1057 subc.superclass=superc.prototype; 1058 if (superc.prototype.constructor == Object.prototype.constructor) { 1059 superc.prototype.constructor=superc; 1060 } 1061 1062 /* Lets worry about the following later 1063 if (overrides) { 1064 for (i in overrides) { 1065 if (L.hasOwnProperty(overrides, i)) { 1066 subc.prototype[i]=overrides[i]; 1067 } 1068 } 1069 1070 L._IEEnumFix(subc.prototype, overrides); 1071 } */ 1072 }; 1073 1074 wso2vis.initialize = function() { 1075 wso2vis.environment.tooltip = new wso2vis.c.Tooltip(); 1076 }; 1077 1078 1079 //Global utility functions 1080 1081 function $(_id) { 1082 return document.getElementById(_id); 1083 } 1084 1085 Array.prototype.max = function() { 1086 var max = this[0]; 1087 var len = this.length; 1088 for (var i = 1; i < len; i++) if (this[i] > max) max = this[i]; 1089 return max; 1090 } 1091 1092 Array.prototype.min = function() { 1093 var min = this[0]; 1094 var len = this.length; 1095 for (var i = 1; i < len; i++) if (this[i] < min) min = this[i]; 1096 return min; 1097 } 1098 1099 wso2vis.util.generateColors = function(count, scheme) { 1100 function hexNumtoHexStr(n) { 1101 function toHexStr(N) { 1102 if (N==null) return "00"; 1103 N=parseInt(N); if (N==0 || isNaN(N)) return "00"; 1104 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N); 1105 return "0123456789ABCDEF".charAt((N-N%16)/16) 1106 + "0123456789ABCDEF".charAt(N%16); 1107 } 1108 1109 return "#" + toHexStr((n & 0xFF0000)>>>16) + toHexStr((n & 0x00FF00)>>>8) + toHexStr((n & 0x0000FF)); 1110 } 1111 1112 function generateInterpolatedColorArray(count, colors) { 1113 function interpolateColors(color1, color2, f) { 1114 if (f >= 1) 1115 return color2; 1116 if (f <= 0) 1117 return color1; 1118 var fb = 1 - f; 1119 return ((((color2 & 0xFF0000) * f)+((color1 & 0xFF0000) * fb)) & 0xFF0000) 1120 +((((color2 & 0x00FF00) * f)+((color1 & 0x00FF00) * fb)) & 0x00FF00) 1121 +((((color2 & 0x0000FF) * f)+((color1 & 0x0000FF) * fb)) & 0x0000FF); 1122 } 1123 1124 var len = colors.length; 1125 var res = new Array(); 1126 res.push(hexNumtoHexStr(colors[0])); 1127 1128 for (var i = 1; i < count; i++) { 1129 var val = i * len / count; 1130 var color1 = Math.floor(val); 1131 var color2 = Math.ceil(val); 1132 res.push(hexNumtoHexStr(interpolateColors(colors[color1], colors[color2], val - color1))); 1133 } 1134 1135 return res; 1136 } 1137 1138 if (count <= 0) 1139 return null; 1140 1141 var a10 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 1142 0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22, 0x17becf]; 1143 var b20 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 1144 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, 1145 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 1146 0xc7c7c7, 0xbcbd22, 0xdbdb8d, 0x17becf, 0x9edae5]; 1147 var c19 = [0x9c9ede, 0x7375b5, 0x4a5584, 0xcedb9c, 0xb5cf6b, 1148 0x8ca252, 0x637939, 0xe7cb94, 0xe7ba52, 0xbd9e39, 1149 0x8c6d31, 0xe7969c, 0xd6616b, 0xad494a, 0x843c39, 1150 0xde9ed6, 0xce6dbd, 0xa55194, 0x7b4173]; 1151 var colorScheme; 1152 1153 if (scheme == 20) { 1154 colorScheme = b20; 1155 } 1156 else if (scheme == 10) { 1157 colorScheme = a10; 1158 } 1159 else /* any ((scheme === undefined) || (scheme == 19))*/{ 1160 colorScheme = c19; 1161 } 1162 1163 if (count <= colorScheme.length) { 1164 c = new Array(); 1165 for (var i = 0; i < count; i++) 1166 c.push(hexNumtoHexStr(colorScheme[i])); 1167 return c; 1168 } 1169 1170 return generateInterpolatedColorArray(count, colorScheme); 1171 } 1172 1173 /** 1174 * Timer 1175 */ 1176 wso2vis.u.Timer = function(timerInterval) { 1177 this.timerInterval = timerInterval; // sets the interval 1178 1179 var timerID = 0; 1180 var timerRunning = false; 1181 var thisObject = null; 1182 1183 this.updateInterval = function(interval) { 1184 if ((interval > 0) && (interval != this.timerInterval)) { 1185 this.timerInterval = interval; 1186 stopTimer(); 1187 startTimer(); 1188 } 1189 }; 1190 1191 this.startTimer = function() { 1192 if (timerInterval > 0) { 1193 this.timerRunning = true; 1194 1195 thisObject = this; 1196 if (thisObject.timerRunning) 1197 { 1198 thisObject.timerID = setInterval( 1199 function() 1200 { 1201 thisObject.tick(); 1202 }, 1203 thisObject.timerInterval); 1204 } 1205 } 1206 }; 1207 1208 this.stopTimer = function() { 1209 if (this.timerRunning) 1210 clearInterval(thisObject.timerID); 1211 this.timerRunning = false; 1212 }; 1213 1214 this.tick = function() { 1215 }; 1216 }; 1217 1218 wso2vis.c.Tooltip = function () { 1219 this.el = document.createElement('div'); 1220 this.el.setAttribute('id', 'ttipRRR'); // a random name to avoid conflicts. 1221 this.el.style.display = 'none'; 1222 this.el.style.width = 'auto'; 1223 this.el.style.height = 'auto'; 1224 this.el.style.margin = '0'; 1225 this.el.style.padding = '5px'; 1226 this.el.style.backgroundColor = '#ffffff'; 1227 this.el.style.borderStyle = 'solid'; 1228 this.el.style.borderWidth = '1px'; 1229 this.el.style.borderColor = '#444444'; 1230 this.el.style.opacity = 0.85; 1231 1232 this.el.style.fontFamily = 'Fontin-Sans, Arial'; 1233 this.el.style.fontSize = '12px'; 1234 1235 this.el.innerHTML = "<b>wso2vis</b> tooltip demo <br/> works damn fine!"; 1236 document.body.appendChild(this.el); 1237 }; 1238 1239 wso2vis.c.Tooltip.prototype.style = function() { 1240 return this.el.style; 1241 }; 1242 1243 wso2vis.c.Tooltip.prototype.show = function(x, y, content) { 1244 var w = this.el.style.width; 1245 var h = this.el.style.height; 1246 var deltaX = 15; 1247 var deltaY = 15; 1248 1249 if ((w + x) >= (this.getWindowWidth() - deltaX)) { 1250 x = x - w; 1251 x = x - deltaX; 1252 } 1253 else { 1254 x = x + deltaX; 1255 } 1256 1257 if ((h + y) >= (this.getWindowHeight() - deltaY)) { 1258 y = y - h; 1259 y = y - deltaY; 1260 } 1261 else { 1262 y = y + deltaY; 1263 } 1264 1265 this.el.style.position = 'absolute'; 1266 this.el.style.top = y + 'px'; 1267 this.el.style.left = x + 'px'; 1268 if (content != undefined) 1269 this.el.innerHTML = content; 1270 this.el.style.display = 'block'; 1271 this.el.style.zindex = 1000; 1272 }; 1273 1274 wso2vis.c.Tooltip.prototype.hide = function() { 1275 this.el.style.display = 'none'; 1276 }; 1277 1278 wso2vis.c.Tooltip.prototype.getWindowHeight = function(){ 1279 var innerHeight; 1280 if (navigator.appVersion.indexOf('MSIE')>0) { 1281 innerHeight = document.body.clientHeight; 1282 } 1283 else { 1284 innerHeight = window.innerHeight; 1285 } 1286 return innerHeight; 1287 }; 1288 1289 wso2vis.c.Tooltip.prototype.getWindowWidth = function(){ 1290 var innerWidth; 1291 if (navigator.appVersion.indexOf('MSIE')>0) { 1292 innerWidth = document.body.clientWidth; 1293 } 1294 else { 1295 innerWidth = window.innerWidth; 1296 } 1297 return innerWidth; 1298 }; 1299 1300 1301 /** 1302 * Provider 1303 */ 1304 wso2vis.p.Provider = function() { 1305 this.drList = []; 1306 wso2vis.environment.providers.push(this); 1307 id = wso2vis.environment.providers.length - 1; 1308 this.getID = function() { 1309 return id; 1310 } 1311 }; 1312 1313 wso2vis.p.Provider.prototype.initialize = function() { 1314 this.pullData(); 1315 }; 1316 1317 wso2vis.p.Provider.prototype.addDataReceiver = function(dataReceiver) { 1318 this.drList.push(dataReceiver); 1319 }; 1320 1321 wso2vis.p.Provider.prototype.pushData = function(data) { 1322 // loop all data receivers. Pump data to them. 1323 //console.log(JSON.stringify(data) + this.url); 1324 for (i = 0; i < this.drList.length; i++) { 1325 (this.drList[i]).pushData(data); 1326 } 1327 }; 1328 1329 wso2vis.p.Provider.prototype.pullData = function() { 1330 }; 1331 1332 /** 1333 * @class ProviderGET 1334 * @extends Provider 1335 **/ 1336 wso2vis.p.ProviderGET = function(url) { 1337 this.url = url; 1338 this.xmlHttpReq = null; 1339 1340 wso2vis.p.Provider.call(this); 1341 }; 1342 1343 wso2vis.extend(wso2vis.p.ProviderGET, wso2vis.p.Provider); 1344 1345 wso2vis.p.ProviderGET.prototype.initialize = function() { 1346 this.pullDataSync(); // initial pullData call should fill the wire with data to populate filter forms properly, hense the sync call. 1347 }; 1348 1349 wso2vis.p.ProviderGET.prototype.pullData = function() { 1350 // Make sure the XMLHttpRequest object was instantiated 1351 var that = this; 1352 if (!that.xmlHttpReq) { 1353 that.xmlHttpReq = this.createXmlHttpRequest(); 1354 } 1355 if (that.xmlHttpReq) 1356 { 1357 that.xmlHttpReq.open("GET", that.getURLwithRandomParam()); // to prevent IE caching 1358 that.xmlHttpReq.onreadystatechange = function() { 1359 if (that.xmlHttpReq.readyState == 4) { 1360 that.pushData(that.parseResponse(that.xmlHttpReq.responseText, that)); 1361 } 1362 }; 1363 that.xmlHttpReq.send(null); 1364 } 1365 } 1366 1367 wso2vis.p.ProviderGET.prototype.pullDataSync = function() { 1368 var that = this; 1369 if (!that.xmlHttpReq) { 1370 that.xmlHttpReq = this.createXmlHttpRequest(); 1371 } 1372 1373 if (that.xmlHttpReq) 1374 { 1375 that.xmlHttpReq.open("GET", that.getURLwithRandomParam(), false); // to prevent IE caching 1376 that.xmlHttpReq.send(null); 1377 if (that.xmlHttpReq.status == 200) { 1378 that.pushData(that.parseResponse(that.xmlHttpReq.responseText, that)); 1379 } 1380 } 1381 1382 return false; 1383 } 1384 1385 wso2vis.p.ProviderGET.prototype.parseResponse = function(response, that) { 1386 var resp = that.parseXml(response); 1387 return that.xmlToJson(resp, " "); 1388 } 1389 1390 wso2vis.p.ProviderGET.prototype.getURLwithRandomParam = function() { 1391 if (this.url.indexOf('?') == -1) { 1392 return this.url + '?random=' + new Date().getTime(); 1393 } 1394 return this.url + '&random=' + new Date().getTime(); 1395 } 1396 1397 wso2vis.p.ProviderGET.prototype.createXmlHttpRequest = function() { 1398 var request; 1399 1400 // Lets try using ActiveX to instantiate the XMLHttpRequest 1401 // object 1402 try { 1403 request = new ActiveXObject("Microsoft.XMLHTTP"); 1404 } catch(ex1) { 1405 try { 1406 request = new ActiveXObject("Msxml2.XMLHTTP"); 1407 } catch(ex2) { 1408 request = null; 1409 } 1410 } 1411 1412 // If the previous didn't work, lets check if the browser natively support XMLHttpRequest 1413 if (!request && typeof XMLHttpRequest != "undefined") { 1414 //The browser does, so lets instantiate the object 1415 request = new XMLHttpRequest(); 1416 } 1417 1418 return request; 1419 } 1420 1421 /** 1422 * converts xml string to a dom object 1423 * 1424 * @param {string} [xml] a xml string 1425 * @returns {dom} a xml dom object 1426 */ 1427 wso2vis.p.ProviderGET.prototype.parseXml = function(xml) { 1428 var dom = null; 1429 if (window.DOMParser) { 1430 try { 1431 dom = (new DOMParser()).parseFromString(xml, "text/xml"); 1432 } 1433 catch (e) { dom = null; } 1434 } 1435 else if (window.ActiveXObject) { 1436 try { 1437 dom = new ActiveXObject('Microsoft.XMLDOM'); 1438 dom.async = false; 1439 if (!dom.loadXML(xml)) // parse error .. 1440 window.alert(dom.parseError.reason + dom.parseError.srcText); 1441 } 1442 catch (e) { dom = null; } 1443 } 1444 else 1445 window.alert("oops"); 1446 return dom; 1447 } 1448 1449 /** 1450 * Once passed an xml dom object xmlToJson will create a corresponding JSON object. 1451 * 1452 * @param {DOM} [xml] a xml dom object 1453 * @param {string} [tab] an optional whitespace character to beutify the created JSON string. 1454 * @returns {object} a JSON object 1455 */ 1456 wso2vis.p.ProviderGET.prototype.xmlToJson = function(xml, tab) { 1457 var X = { 1458 toObj: function(xml) { 1459 var o = {}; 1460 if (xml.nodeType == 1) { 1461 if (xml.attributes.length) 1462 for (var i=0; i<xml.attributes.length; i++) 1463 o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString(); 1464 if (xml.firstChild) { 1465 var textChild=0, cdataChild=0, hasElementChild=false; 1466 for (var n=xml.firstChild; n; n=n.nextSibling) { 1467 if (n.nodeType==1) hasElementChild = true; 1468 else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; 1469 else if (n.nodeType==4) cdataChild++; 1470 } 1471 if (hasElementChild) { 1472 if (textChild < 2 && cdataChild < 2) { 1473 X.removeWhite(xml); 1474 for (var n=xml.firstChild; n; n=n.nextSibling) { 1475 if (n.nodeType == 3) 1476 o["#text"] = X.escape(n.nodeValue); 1477 else if (n.nodeType == 4) 1478 o["#cdata"] = X.escape(n.nodeValue); 1479 else if (o[n.nodeName]) { 1480 if (o[n.nodeName] instanceof Array) 1481 o[n.nodeName][o[n.nodeName].length] = X.toObj(n); 1482 else 1483 o[n.nodeName] = [o[n.nodeName], X.toObj(n)]; 1484 } 1485 else 1486 o[n.nodeName] = X.toObj(n); 1487 } 1488 } 1489 else { 1490 if (!xml.attributes.length) 1491 o = X.escape(X.innerXml(xml)); 1492 else 1493 o["#text"] = X.escape(X.innerXml(xml)); 1494 } 1495 } //(hasElementChild) 1496 else if (textChild) { 1497 if (!xml.attributes.length) 1498 o = X.escape(X.innerXml(xml)); 1499 else 1500 o["#text"] = X.escape(X.innerXml(xml)); 1501 } 1502 else if (cdataChild) { 1503 if (cdataChild > 1) 1504 o = X.escape(X.innerXml(xml)); 1505 else 1506 for (var n=xml.firstChild; n; n=n.nextSibling) 1507 o["#cdata"] = X.escape(n.nodeValue); 1508 } 1509 } 1510 if (!xml.attributes.length && !xml.firstChild) o = null; 1511 } 1512 else if (xml.nodeType==9) { 1513 o = X.toObj(xml.documentElement); 1514 } 1515 else 1516 alert("unhandled node type: " + xml.nodeType); 1517 return o; 1518 }, 1519 toJson: function(o, name, ind) { 1520 var p = name.lastIndexOf(':'); 1521 if (p != -1) { 1522 if (p + 1 >= name.length) 1523 name = ""; 1524 else 1525 name = name.substr(p + 1); 1526 } 1527 var json = name ? ("\""+name+"\"") : ""; 1528 if (o instanceof Array) { 1529 for (var i=0,n=o.length; i<n; i++) 1530 o[i] = X.toJson(o[i], "", ind+"\t"); 1531 json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]"; 1532 } 1533 else if (o == null) 1534 json += (name&&":") + "null"; 1535 else if (typeof(o) == "object") { 1536 var arr = []; 1537 for (var m in o) 1538 arr[arr.length] = X.toJson(o[m], m, ind+"\t"); 1539 json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}"; 1540 } 1541 else if (typeof(o) == "string") 1542 json += (name&&":") + "\"" + o.toString() + "\""; 1543 else 1544 json += (name&&":") + o.toString(); 1545 return json; 1546 }, 1547 innerXml: function(node) { 1548 var s = "" 1549 if ("innerHTML" in node) 1550 s = node.innerHTML; 1551 else { 1552 var asXml = function(n) { 1553 var s = ""; 1554 if (n.nodeType == 1) { 1555 s += "<" + n.nodeName; 1556 for (var i=0; i<n.attributes.length;i++) 1557 s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\""; 1558 if (n.firstChild) { 1559 s += ">"; 1560 for (var c=n.firstChild; c; c=c.nextSibling) 1561 s += asXml(c); 1562 s += "</"+n.nodeName+">"; 1563 } 1564 else 1565 s += "/>"; 1566 } 1567 else if (n.nodeType == 3) 1568 s += n.nodeValue; 1569 else if (n.nodeType == 4) 1570 s += "<![CDATA[" + n.nodeValue + "]]>"; 1571 return s; 1572 }; 1573 for (var c=node.firstChild; c; c=c.nextSibling) 1574 s += asXml(c); 1575 } 1576 return s; 1577 }, 1578 escape: function(txt) { 1579 return txt.replace(/[\\]/g, "\\\\") 1580 .replace(/[\"]/g, '\\"') 1581 .replace(/[\n]/g, '\\n') 1582 .replace(/[\r]/g, '\\r'); 1583 }, 1584 removeWhite: function(e) { 1585 e.normalize(); 1586 for (var n = e.firstChild; n; ) { 1587 if (n.nodeType == 3) { 1588 if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { 1589 var nxt = n.nextSibling; 1590 e.removeChild(n); 1591 n = nxt; 1592 } 1593 else 1594 n = n.nextSibling; 1595 } 1596 else if (n.nodeType == 1) { 1597 X.removeWhite(n); 1598 n = n.nextSibling; 1599 } 1600 else 1601 n = n.nextSibling; 1602 } 1603 return e; 1604 } 1605 }; 1606 if (xml.nodeType == 9) 1607 xml = xml.documentElement; 1608 var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, "\t"); 1609 return JSON.parse("{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}"); 1610 } 1611 1612 /** 1613 * @class ProviderGET 1614 * @extends Provider 1615 **/ 1616 wso2vis.p.ProviderGETJSON = function(url) { 1617 this.url = url; 1618 this.xmlHttpReq = null; 1619 1620 wso2vis.p.Provider.call(this); 1621 }; 1622 1623 wso2vis.extend(wso2vis.p.ProviderGETJSON, wso2vis.p.ProviderGET); 1624 1625 1626 wso2vis.p.ProviderGETJSON.prototype.parseResponse = function(response, that) { 1627 1628 return JSON.parse(response); 1629 } 1630 /** 1631 * @class ProviderGETMakeRequest 1632 * @extends ProviderGET 1633 * @author suho@wso2.com 1634 **/ 1635 1636 wso2vis.p.ProviderGETMakeRequest = function(url) { 1637 wso2vis.p.ProviderGET.call(this, url); 1638 }; 1639 1640 wso2vis.extend(wso2vis.p.ProviderGETMakeRequest, wso2vis.p.ProviderGET); 1641 1642 wso2vis.p.ProviderGETMakeRequest.prototype.pullData = function() { 1643 // Make sure the XMLHttpRequest object was instantiated 1644 var that = this; 1645 1646 var params = {}; 1647 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM; 1648 var refreshInterval = 0; 1649 var sep = "?"; 1650 if (this.url.indexOf("nocache=") < 0) { 1651 if (this.url.indexOf("?") > -1) { 1652 sep = "&"; 1653 } 1654 this.url = [ this.url, sep, "nocache=", refreshInterval ].join(""); 1655 } 1656 1657 gadgets.io.makeRequest(this.url,callback, params); 1658 1659 function callback(resp) { 1660 that.parseResponse(resp, that); 1661 } 1662 1663 } 1664 1665 wso2vis.p.ProviderGETMakeRequest.prototype.pullDataSync = function() { 1666 var that = this; 1667 var params = {}; 1668 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM; 1669 var refreshInterval = 0; 1670 var sep = "?"; 1671 if (this.url.indexOf("nocache=") < 0) { 1672 if (this.url.indexOf("?") > -1) { 1673 sep = "&"; 1674 } 1675 this.url = [ this.url, sep, "nocache=", refreshInterval ].join(""); 1676 } 1677 1678 gadgets.io.makeRequest(this.url,callback, params); 1679 1680 function callback(resp) { 1681 that.parseResponse(resp, that); 1682 } 1683 return false; 1684 } 1685 1686 wso2vis.p.ProviderGETMakeRequest.prototype.parseResponse = function(response, that) { 1687 that.pushData( that.xmlToJson(response.data, " ")); 1688 } 1689 1690 1691 /** 1692 * DataSubscriber 1693 */ 1694 wso2vis.s.Subscriber = function() { 1695 this.attr = []; 1696 wso2vis.environment.subscribers.push(this); 1697 id = wso2vis.environment.subscribers.length - 1; 1698 this.getID = function() { 1699 return id; 1700 }; 1701 }; 1702 1703 wso2vis.s.Subscriber.prototype.property = function(name) { 1704 /* 1705 * Define the setter-getter globally 1706 */ 1707 wso2vis.s.Subscriber.prototype[name] = function(v) { 1708 if (arguments.length) { 1709 this.attr[name] = v; 1710 return this; 1711 } 1712 return this.attr[name]; 1713 }; 1714 1715 return this; 1716 }; 1717 1718 /** 1719 * Set data to the subscriber. Providers use this method to push data to subscribers. 1720 * 1721 * @param {object} [data] a JSON object. 1722 */ 1723 wso2vis.s.Subscriber.prototype.pushData = function(data) { 1724 }; 1725 1726 /** 1727 * Filter 1728 */ 1729 wso2vis.f.Filter = function() { 1730 this.attr = []; 1731 this.dp = null; 1732 this.drList = []; 1733 wso2vis.environment.filters.push(this); 1734 id = wso2vis.environment.filters.length - 1; 1735 this.getID = function() {return id;} 1736 }; 1737 1738 wso2vis.f.Filter.prototype.property = function(name) { 1739 /* 1740 * Define the setter-getter globally 1741 */ 1742 wso2vis.f.Filter.prototype[name] = function(v) { 1743 if (arguments.length) { 1744 this.attr[name] = v; 1745 return this; 1746 } 1747 return this.attr[name]; 1748 }; 1749 1750 return this; 1751 }; 1752 1753 wso2vis.f.Filter.prototype.dataProvider = function(dp) { 1754 this.dp = dp; 1755 this.dp.addDataReceiver(this); 1756 return; 1757 }; 1758 1759 wso2vis.f.Filter.prototype.addDataReceiver = function(dr) { 1760 this.drList.push(dr); 1761 }; 1762 1763 wso2vis.f.Filter.prototype.pushData = function(data) { 1764 var filteredData = this.filterData(data); 1765 for (i = 0; i < this.drList.length; i++) { 1766 (this.drList[i]).pushData(filteredData); 1767 } 1768 }; 1769 1770 wso2vis.f.Filter.prototype.pullData = function() { 1771 this.dp.pullData(); 1772 }; 1773 1774 wso2vis.f.Filter.prototype.filterData = function(data) { 1775 return data; 1776 }; 1777 1778 wso2vis.f.Filter.prototype.traverseToDataField = function (object, dataFieldArray) { 1779 var a = object; 1780 for (var i = 0; i < dataFieldArray.length; i++) { 1781 a = a[dataFieldArray[i]]; 1782 } 1783 return a; 1784 }; 1785 /** 1786 * BasicFilter (Inherited from Filter) 1787 */ 1788 wso2vis.f.BasicFilter = function(dataField, dataLabel, filterArray) { 1789 wso2vis.f.Filter.call(this); 1790 1791 this.dataField(dataField) 1792 .dataLabel(dataLabel) 1793 .filterArray(filterArray); 1794 1795 /* @private */ 1796 this.remainingArray = []; 1797 }; 1798 1799 wso2vis.extend(wso2vis.f.BasicFilter, wso2vis.f.Filter); 1800 1801 wso2vis.f.BasicFilter.prototype 1802 .property("dataField") 1803 .property("dataLabel") 1804 .property("filterArray"); 1805 1806 wso2vis.f.BasicFilter.prototype.filterData = function(data) { 1807 function getLbl(obj, dataLabel, x, that) { 1808 var r; 1809 if (obj instanceof Array) { 1810 r = obj[x]; 1811 } 1812 else { 1813 r = obj; 1814 } 1815 return that.traverseToDataField(r, dataLabel); 1816 } 1817 1818 function filter(object, dataLabel, filterArray, that) { 1819 var dcount = 1; 1820 if (object instanceof Array) 1821 dcount = object.length; 1822 1823 if ((filterArray === undefined) || (filterArray == null)) { 1824 var arr = []; 1825 1826 for (var i = dcount - 1; i >= 0; i--) { 1827 arr.push(getLbl(object, dataLabel, i, that)); 1828 } 1829 return {rem:[], fil:arr, isObj:false}; 1830 } 1831 else { 1832 remainingArray = []; 1833 var isObj = false; 1834 for (var i = dcount - 1; i >= 0; i--) { 1835 var found = false; 1836 var label = getLbl(object, dataLabel, i, that); 1837 for (var j = 0; j < filterArray.length; j++) { 1838 if (label == filterArray[j]) { 1839 found = true; 1840 break; 1841 } 1842 } 1843 if (!found) { 1844 remainingArray.push(label); 1845 if (object instanceof Array) 1846 object.splice(i, 1); // not found! remove from the object 1847 else { 1848 isObj = true; 1849 } 1850 } 1851 } 1852 return {rem:remainingArray, fil:filterArray, isObj:isObj}; 1853 } 1854 } 1855 1856 function sortthem(object, dataLabel, filterArray, that) { 1857 if ((filterArray === undefined) || (filterArray == null)) { 1858 return; 1859 } 1860 var dcount = 1; 1861 if (object instanceof Array) 1862 dcount = object.length; 1863 1864 var index = 0; 1865 for (var i = 0; i < filterArray.length; i++) { 1866 for (var j = 0; j < dcount; j++) { 1867 var label = getLbl(object, dataLabel, j, that); 1868 if (label == filterArray[i]) { 1869 if (index != j) { 1870 var temp = object[index]; 1871 object[index] = object[j]; 1872 object[j] = temp; 1873 } 1874 index++; 1875 break; 1876 } 1877 } 1878 } 1879 } 1880 1881 1882 var cloned = JSON.parse(JSON.stringify(data)); //eval (data.toSource()); 1883 var filtered = wso2vis.fn.traverseToDataField(cloned, this.dataField()); 1884 var result = filter(filtered, this.dataLabel(), this.filterArray(), this); 1885 this.remainingArray = result.rem; 1886 this.filterArray(result.fil); 1887 if (result.isObj) { 1888 wso2vis.fn.traverseNKillLeaf(cloned, this.dataField()); 1889 } 1890 else { 1891 sortthem(filtered, this.dataLabel(), this.filterArray(), this); 1892 } 1893 1894 return cloned; 1895 }; 1896 /** 1897 * @class Select 1898 * @extends Form 1899 */ 1900 wso2vis.f.form.Select = function() { //canvas, selectID, onChangeFuncStr, dataField, key, value, defaultText) { 1901 wso2vis.f.BasicFilter.call(this); 1902 this.defaultText("default"); 1903 this.filterArray([]); 1904 /* @private */ 1905 this.dirty = true; 1906 }; 1907 1908 wso2vis.extend(wso2vis.f.form.Select, wso2vis.f.BasicFilter); 1909 1910 wso2vis.f.form.Select.prototype 1911 .property("canvas") 1912 .property("dataField") 1913 .property("dataLabel") 1914 .property("dataValue") 1915 .property("defaultText"); 1916 1917 wso2vis.f.form.Select.prototype.invalidate = function() { 1918 this.dirty = true; 1919 } 1920 1921 /*wso2vis.f.form.Select.prototype.filterData = function(data) { 1922 if (this.dirty) { 1923 this.dirty = false; 1924 1925 1926 1927 } 1928 this.superclass.filterData(data); 1929 };*/ 1930 1931 wso2vis.f.form.Select.prototype.create = function() { 1932 var newElementHTML = '<select id="wso2visSelect_'+this.getID()+'" onchange="wso2vis.fn.selectFormChanged('+this.getID()+');">'; 1933 if ((this.filterArray() !== undefined) && (this.filterArray() !== null) && (this.filterArray().length > 0)) { 1934 newElementHTML += '<option value="' + this.defaultText() + '">' + this.defaultText() + '</option>'; 1935 newElementHTML += '<option value="' + this.filterArray()[0] + '" selected>' + this.filterArray()[0] + '</option>'; 1936 } 1937 else { 1938 newElementHTML += '<option value="' + this.defaultText() + '" selected>' + this.defaultText() + '</option>'; 1939 } 1940 if (this.remainingArray !== null && this.remainingArray.length > 0) { 1941 for (var x = 0; x < this.remainingArray.length; x++) { 1942 newElementHTML += '<option value="' + this.remainingArray[x] + '">' + this.remainingArray[x] + '</option>' 1943 } 1944 } 1945 newElementHTML += '</select>'; 1946 return newElementHTML; 1947 }; 1948 1949 wso2vis.f.form.Select.prototype.load = function() { var canvas = document.getElementById(this.canvas()); canvas.innerHTML = this.create(); }; 1950 wso2vis.f.form.Select.prototype.unload = function() { var canvas = document.getElementById(this.canvas()); canvas.innerHTML = ""; }; 1951 1952 wso2vis.f.form.Select.prototype.onChange = function(text) { 1953 }; 1954 1955 wso2vis.fn.selectFormChanged = function(id) { 1956 var filter = wso2vis.fn.getFilterFromID(id); 1957 var elem = document.getElementById("wso2visSelect_"+id); 1958 filter.filterArray([]); 1959 if (elem[elem.selectedIndex].text != filter.defaultText()) 1960 filter.filterArray().push(elem[elem.selectedIndex].text); 1961 filter.onChange(elem[elem.selectedIndex].text); 1962 }; 1963 /** 1964 * FilterForm 1965 */ 1966 wso2vis.f.form.FilterForm = function() { 1967 wso2vis.f.BasicFilter.call(this); 1968 }; 1969 1970 wso2vis.extend(wso2vis.f.form.FilterForm, wso2vis.f.BasicFilter); 1971 1972 wso2vis.f.form.FilterForm.prototype.property("canvas"); 1973 1974 wso2vis.f.form.FilterForm.prototype.create = function() { 1975 var i = 0; 1976 var content; 1977 content = '<form>' + 1978 '<table width="100%" border="0">' + 1979 '<tr>' + 1980 ' <td width="13%" rowspan="4"><select name="FilterFormList1_'+this.getID()+'" id="FilterFormList1_'+this.getID()+'" size="10" style="width: 110px">'; 1981 for (i = 0; i < this.remainingArray.length; i++) { 1982 if (i == 0) 1983 content += '<option value="'+i+'" selected>' + this.remainingArray[i] +'</option>'; 1984 else 1985 content += '<option value="'+i+'">' + this.remainingArray[i] +'</option>'; 1986 } 1987 content += ' </select></td>' + 1988 ' <td width="6%"> </td>' + 1989 ' <td width="14%" rowspan="4"><select name="FilterFormList2_'+this.getID()+'" id="FilterFormList2_'+this.getID()+'" size="10" style="width: 110px">'; 1990 if (this.filterArray() !== undefined) { 1991 for (i = 0; i < this.filterArray().length; i++) { 1992 if (i == 0) 1993 content += '<option value="'+i+'" selected>' + this.filterArray()[i] +'</option>'; 1994 else 1995 content += '<option value="'+i+'">' + this.filterArray()[i] +'</option>'; 1996 } 1997 } 1998 content += ' </select></td>' + 1999 ' <td width="7%"> </td>' + 2000 ' <td width="60%" rowspan="4"> </td>' + 2001 '</tr>' + 2002 '<tr>' + 2003 ' <td><div align="center">' + 2004 ' <input type="button" name="buttonLeft" id="buttonLeft" value="Add" style="width: 50px" onclick="FilterFormButtonLeft('+this.getID()+');"/>' + 2005 ' </div></td>' + 2006 ' <td><div align="center">' + 2007 ' <input type="button" name="buttonUp" id="buttonUp" value="Up" style="width: 50px" onclick="FilterFormButtonUp('+this.getID()+');"/>' + 2008 ' </div></td>' + 2009 '</tr>' + 2010 '<tr>' + 2011 ' <td><div align="center">' + 2012 ' <input type="button" name="buttonRight" id="buttonRight" value="Remove" style="width: 50px" onclick="FilterFormButtonRight('+this.getID()+');"/>' + 2013 ' </div></td>' + 2014 ' <td><div align="center">' + 2015 ' <input type="button" name="buttonDown" id="buttonDown" value="Down" style="width: 50px" onclick="FilterFormButtonDown('+this.getID()+');"/>' + 2016 ' </div></td>' + 2017 '</tr>' + 2018 '<tr>' + 2019 ' <td> </td>' + 2020 ' <td> </td>' + 2021 '</tr>' + 2022 '<tr>' + 2023 ' <td colspan="5">' + 2024 ' <input type="button" name="buttonApply" id="buttonApply" value="Apply" style="width: 50px" onclick="FilterFormButtonApply('+this.getID()+')"/>' + 2025 ' <input type="button" name="buttonCancel" id="buttonCancel" value="Cancel" style="width: 50px" onclick="FilterFormButtonCancel('+this.getID()+')"/></td>' + 2026 '</tr>' + 2027 '</table>' + 2028 '</form>'; 2029 2030 return content; 2031 } 2032 2033 wso2vis.f.form.FilterForm.prototype.load = function() { var canvas = document.getElementById(this.canvas()); canvas.innerHTML = this.create(); }; 2034 wso2vis.f.form.FilterForm.prototype.unload = function() { var canvas = document.getElementById(this.canvas()); canvas.innerHTML = ""; }; 2035 2036 wso2vis.f.form.FilterForm.prototype.onApply = function(data) { 2037 }; 2038 2039 wso2vis.f.form.FilterForm.prototype.create.onCancel = function() { 2040 }; 2041 2042 FilterFormButtonUp = function(id) { 2043 FilterFormItemMoveWithin(true, "FilterFormList2_"+id); 2044 }; 2045 2046 FilterFormButtonDown = function(id) { 2047 FilterFormItemMoveWithin(false, "FilterFormList2_"+id); 2048 }; 2049 2050 FilterFormButtonLeft = function(id) { 2051 FilterFormItemMoveInbetween("FilterFormList1_"+id, "FilterFormList2_"+id); 2052 }; 2053 2054 FilterFormButtonRight = function(id) { 2055 FilterFormItemMoveInbetween("FilterFormList2_"+id, "FilterFormList1_"+id); 2056 }; 2057 2058 FilterFormButtonApply = function(id) { 2059 var basicDataFilter = wso2vis.fn.getFilterFromID(id); 2060 var list2Element = document.getElementById("FilterFormList2_" + id); 2061 var i = 0; 2062 basicDataFilter.filterArray([]); 2063 for (i = 0; i < list2Element.length; i++) { 2064 basicDataFilter.filterArray().push(list2Element.options[i].text); 2065 } 2066 basicDataFilter.onApply(basicDataFilter.filterArray()); 2067 }; 2068 2069 FilterFormButtonCancel = function(id) { 2070 var FilterForm = wso2vis.fn.getFilterFromID(id); 2071 FilterForm.onCancel(); 2072 }; 2073 2074 FilterFormItemMoveInbetween = function(listName, listName2) { 2075 var src = document.getElementById(listName); 2076 var dst = document.getElementById(listName2); 2077 var idx = src.selectedIndex; 2078 if (idx==-1) 2079 alert("You must first select the item to move."); 2080 else { 2081 var oldVal = src[idx].value; 2082 var oldText = src[idx].text; 2083 src.remove(idx); 2084 2085 var nxidx; 2086 if (idx>=src.length-1) 2087 nxidx=src.length-1; 2088 else 2089 nxidx=idx; 2090 if (src.length > 0) { 2091 src.selectedIndex = nxidx; 2092 } 2093 2094 var opNew = document.createElement('option'); 2095 opNew.text = oldText; 2096 opNew.value = oldVal; 2097 try { 2098 dst.add(opNew, null); // standards compliant; doesn't work in IE 2099 } 2100 catch(ex) { 2101 dst.add(opNew); // IE only 2102 } 2103 dst.selectedIndex = dst.length - 1; 2104 } 2105 }; 2106 2107 FilterFormItemMoveWithin = function(bDir,sName) { 2108 var el = document.getElementById(sName); 2109 var idx = el.selectedIndex 2110 if (idx==-1) 2111 alert("You must first select the item to reorder.") 2112 else { 2113 var nxidx = idx+( bDir? -1 : 1) 2114 if (nxidx<0) nxidx=el.length-1 2115 if (nxidx>=el.length) nxidx=0 2116 var oldVal = el[idx].value 2117 var oldText = el[idx].text 2118 el[idx].value = el[nxidx].value 2119 el[idx].text = el[nxidx].text 2120 el[nxidx].value = oldVal 2121 el[nxidx].text = oldText 2122 el.selectedIndex = nxidx 2123 } 2124 }; 2125 2126 /** 2127 * @class 2128 * Base class for all charts 2129 */ 2130 wso2vis.s.chart.Chart = function (canvas, ttle, desc) { 2131 wso2vis.s.Subscriber.call(this); 2132 /* @private */ 2133 this.title(ttle) 2134 .description(desc) 2135 .divEl(canvas) 2136 .tooltip(true) 2137 .legend(true) 2138 .marks(false) 2139 .width(600) 2140 .height(500) 2141 .titleFont("10px sans-serif") 2142 .labelFont("10px sans-serif") 2143 .legendX(0) 2144 .legendY(0) 2145 .paddingTop(25) 2146 .paddingLeft(10) 2147 .paddingRight(60) 2148 .paddingBottom(10); 2149 2150 /* @private */ 2151 this.data = null; 2152 this.formattedData = null; 2153 2154 wso2vis.environment.charts.push(this); 2155 id = wso2vis.environment.charts.length - 1; 2156 this.getID = function() { 2157 return id; 2158 }; 2159 }; 2160 2161 wso2vis.extend(wso2vis.s.chart.Chart, wso2vis.s.Subscriber); 2162 2163 wso2vis.s.chart.Chart.prototype 2164 .property("title") 2165 .property("description") 2166 .property("divEl") 2167 .property("msgDiv") 2168 .property("tooltip") 2169 .property("legend") 2170 .property("x") 2171 .property("y") 2172 .property("width") 2173 .property("height") 2174 .property("paddingTop") 2175 .property("paddingLeft") 2176 .property("paddingRight") 2177 .property("paddingBottom") 2178 .property("anchorTop") 2179 .property("anchorLeft") 2180 .property("anchorRight") 2181 .property("anchorBottom") 2182 .property("legendX") 2183 .property("legendY") 2184 .property("titleFont") 2185 .property("labelFont") 2186 .property("marks"); 2187 2188 wso2vis.s.chart.Chart.prototype.pushData = function (d) { 2189 if( this.validateData(d) ){ 2190 this.data = d; 2191 this.update(); 2192 } else { 2193 this.updateMessageDiv(this.messageInterceptFunction()); 2194 } 2195 }; 2196 2197 wso2vis.s.chart.Chart.prototype.validateData = function (d) { 2198 //Check whether we have valid data or not. 2199 if( d === null || d === undefined ) { 2200 return false; 2201 } 2202 else { 2203 return true; 2204 } 2205 }; 2206 2207 wso2vis.s.chart.Chart.prototype.update = function () { 2208 }; 2209 2210 wso2vis.s.chart.Chart.prototype.updateMessageDiv = function (s) { 2211 2212 if( this.msgDiv() !== undefined ) { 2213 var msgdiv = document.getElementById(this.msgDiv()); 2214 if( msgdiv !== undefined ) { 2215 msgdiv.innerHTML = s; 2216 msgdiv.style.display = "block"; 2217 } 2218 } 2219 }; 2220 2221 wso2vis.s.chart.Chart.prototype.messageInterceptFunction = function () { 2222 2223 return "Invalid Data"; 2224 }; 2225 2226 wso2vis.s.chart.Chart.prototype.onClick = function () { 2227 }; 2228 2229 wso2vis.s.chart.Chart.prototype.onTooltip = function (data) { 2230 return ""; 2231 }; 2232 2233 wso2vis.s.chart.Chart.prototype.onKey = function () { 2234 }; 2235 2236 wso2vis.s.chart.Chart.prototype.traverseToDataField = function (object, dataFieldArray) { 2237 var a = object; 2238 try { //Try catch outside the loop TODO 2239 for (var i = 0; i < dataFieldArray.length; i++) { 2240 a = a[dataFieldArray[i]]; 2241 } 2242 } 2243 catch (e) { 2244 this.updateMessageDiv(this.messageInterceptFunction()); 2245 } 2246 return a; 2247 }; 2248 2249 wso2vis.s.chart.Chart.prototype.getDataObject = function (dataObj, i) { 2250 if( dataObj instanceof Array ) { 2251 return dataObj[i]; 2252 } 2253 else { 2254 return dataObj; 2255 } 2256 }; 2257 2258 //@class wso2vis.s.chart.protovis.WedgeChart : wso2vis.s.chart.Chart 2259 //This is the custom wrapper class for axiis bar charts 2260 2261 //Constructor 2262 wso2vis.s.chart.protovis.WedgeChart = function(canvas, chartTitle, chartDesc) { 2263 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 2264 2265 this.labelLength(12) 2266 .thickness(30); 2267 2268 /* @private */ 2269 this.vis = null; 2270 } 2271 2272 // this makes c.protovis.WedgeChart.prototype inherits from wso2vis.s.chart.Chart 2273 wso2vis.extend(wso2vis.s.chart.protovis.WedgeChart, wso2vis.s.chart.Chart); 2274 2275 wso2vis.s.chart.protovis.WedgeChart.prototype 2276 .property("dataField") 2277 .property("dataValue") 2278 .property("dataLabel") 2279 .property("labelLength") 2280 .property("thickness"); 2281 2282 //Public function load 2283 //Loads the chart inside the given HTML element 2284 wso2vis.s.chart.protovis.WedgeChart.prototype.load = function (w) { 2285 if ( w !== undefined ) { 2286 this.width(w); 2287 } 2288 /*if ( h !== undefined ) { //not using height for the Wedge 2289 this.height(h); 2290 }*/ 2291 //var r = this.width() / 2.5; 2292 2293 var thisObject = this; 2294 2295 this.vis = new pv.Panel() 2296 .canvas(function() { return thisObject.divEl(); }) 2297 .width(function() { return thisObject.width(); }) 2298 .height(function() { return thisObject.height(); }) 2299 .overflow('hidden'); 2300 2301 var chart = this.vis.add(pv.Panel) 2302 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 2303 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 2304 .top(thisObject.paddingTop()) 2305 .bottom(thisObject.paddingBottom()) 2306 .left(thisObject.paddingLeft()) 2307 .right(thisObject.paddingRight()); 2308 2309 var wedge = chart.add(pv.Wedge) 2310 .data(function() { return pv.normalize(thisObject.getData(thisObject)); }) 2311 .left((thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) / 2) 2312 .bottom((thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()) / 2) 2313 .innerRadius(function() { return (((thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) / 2.5) - thisObject.thickness()); }) 2314 .outerRadius(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) / 2.5; }) 2315 .angle(function(d) { return (d * 2 * Math.PI); }) 2316 .title(function() { 2317 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2318 if( dataObj instanceof Array ) { 2319 return thisObject.onTooltip(dataObj[this.index]); 2320 } 2321 else { 2322 return thisObject.onTooltip(dataObj); 2323 } 2324 }) 2325 .event("click", function() { 2326 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2327 if( dataObj instanceof Array ) { 2328 return thisObject.onClick(dataObj[this.index]); 2329 } 2330 else { 2331 return thisObject.onClick(dataObj); 2332 } 2333 }); 2334 2335 wedge.anchor("outer").add(pv.Label) 2336 .visible(function(d) { return (d > 0.05); }) 2337 .textMargin(function(){ return thisObject.thickness() + 5; }) 2338 .text(function(d) { var lbl=thisObject.getDataLabel(this.index); return (lbl.length > thisObject.labelLength() ? lbl.substring(0,thisObject.labelLength())+"..." : lbl); }) 2339 .font(function() { return thisObject.labelFont(); }) 2340 .textStyle(function() { return wedge.fillStyle(); }); 2341 2342 wedge.anchor("center").add(pv.Label) 2343 .visible(function(d) { return (thisObject.marks() && (d > 0.10)); }) 2344 .textAngle(0) 2345 .text(function(d) { return (d*100).toFixed() + "%"; }) 2346 .textStyle("#fff"); 2347 2348 /* Legend */ 2349 /* var legend = chart.add(pv.Panel) 2350 .top(function() { return thisObject.legendTop(); }) 2351 .left(function() { return thisObject.legendLeft(); }) 2352 .right(function() { return thisObject.legendRight(); }) 2353 .bottom(function() { return thisObject.legendBottom(); })*/ 2354 2355 2356 chart.add(pv.Dot) 2357 .data(function() { return pv.normalize(thisObject.getData(thisObject)); }) 2358 .visible(function() { return thisObject.legend(); }) 2359 .fillStyle(function() { return wedge.fillStyle(); }) 2360 .right(function() { return (thisObject.width() - thisObject.legendX()); }) 2361 .bottom(function() { return (this.index * 15) + (thisObject.height() - thisObject.legendY()); }) 2362 .size(20) 2363 .lineWidth(1) 2364 .strokeStyle("#000") 2365 .anchor("right").add(pv.Label) 2366 .text(function() { var lbl=thisObject.getDataLabel(this.index); return (lbl.length > thisObject.labelLength() ? lbl.substring(0,thisObject.labelLength())+"..." : lbl); }); 2367 2368 this.vis.add(pv.Label) 2369 .left(this.width() / 2) 2370 .visible(function() { return !(thisObject.title() === ""); }) 2371 .top(16) 2372 .textAlign("center") 2373 .text(function() { return thisObject.title(); }) 2374 .font(function() { return thisObject.titleFont(); }); 2375 }; 2376 2377 /** 2378 * @private 2379 */ 2380 wso2vis.s.chart.protovis.WedgeChart.prototype.titleSpacing = function () { 2381 if(this.title() === "") { 2382 return 1; 2383 } 2384 else { 2385 return 0.9; 2386 } 2387 }; 2388 2389 /** 2390 * @private 2391 */ 2392 wso2vis.s.chart.protovis.WedgeChart.prototype.populateData = function (thisObject) { 2393 2394 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2395 var dataGrpCount = 1; 2396 2397 if( _dataField instanceof Array ) { 2398 dataGrpCount = _dataField.length; 2399 } 2400 2401 this.formattedData = pv.range(dataGrpCount).map( genDataMap ); 2402 2403 function genDataMap(x) { 2404 var rootObj; 2405 if( _dataField instanceof Array ) { 2406 rootObj = _dataField[x]; 2407 } 2408 else { 2409 rootObj = _dataField; 2410 } 2411 return parseInt(thisObject.traverseToDataField(rootObj, thisObject.dataValue())); 2412 } 2413 }; 2414 2415 wso2vis.s.chart.protovis.WedgeChart.prototype.getData = function (thisObject) { 2416 2417 return thisObject.formattedData; 2418 }; 2419 2420 wso2vis.s.chart.protovis.WedgeChart.prototype.update = function () { 2421 2422 this.populateData(this); 2423 this.vis.render(); 2424 if(this.tooltip() === true) { 2425 tooltip.init(); 2426 } 2427 }; 2428 2429 wso2vis.s.chart.protovis.WedgeChart.prototype.getDataLabel = function (i) { 2430 2431 if (this.data !== null){ 2432 2433 var rootObj = this.traverseToDataField(this.data, this.dataField()); 2434 if( rootObj instanceof Array ) { 2435 return this.traverseToDataField(rootObj[i], this.dataLabel()); 2436 } 2437 else { 2438 return this.traverseToDataField(rootObj, this.dataLabel()); 2439 } 2440 } 2441 2442 return i; 2443 }; 2444 2445 //@class wso2vis.s.chart.protovis.PieChart : wso2vis.s.chart.WedgeChart 2446 2447 //Constructor 2448 wso2vis.s.chart.protovis.PieChart = function(canvas, chartTitle, chartDesc) { 2449 wso2vis.s.chart.protovis.WedgeChart.call(this, canvas, chartTitle, chartDesc); 2450 } 2451 2452 // this makes c.protovis.PieChart.prototype inherits from wso2vis.s.chart.WedgeChart 2453 wso2vis.extend(wso2vis.s.chart.protovis.PieChart, wso2vis.s.chart.protovis.WedgeChart); 2454 2455 //Public function load 2456 //Loads the chart inside the given HTML element 2457 wso2vis.s.chart.protovis.PieChart.prototype.load = function (w) { 2458 if ( w !== undefined ) { 2459 this.width(w); 2460 } 2461 /*if ( h !== undefined ) { //not using height for the Wedge 2462 this.height(h); 2463 }*/ 2464 //var r = this.width() / 2.5; 2465 2466 var thisObject = this; 2467 2468 this.vis = new pv.Panel() 2469 .canvas(function() { return thisObject.divEl(); }) 2470 .width(function() { return thisObject.width(); }) 2471 .height(function() { return thisObject.height(); }); 2472 2473 var chart = this.vis.add(pv.Panel) 2474 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 2475 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 2476 .top(thisObject.paddingTop()) 2477 .bottom(thisObject.paddingBottom()) 2478 .left(thisObject.paddingLeft()) 2479 .right(thisObject.paddingRight()); 2480 2481 var wedge = chart.add(pv.Wedge) 2482 .data(function() { return pv.normalize(thisObject.getData(thisObject)); }) 2483 .left((thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) / 2) 2484 .bottom((thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()) / 2) 2485 .innerRadius(0) 2486 .outerRadius(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) / 2.5; }) 2487 .angle(function(d) { return (d * 2 * Math.PI); }) 2488 .title(function() { 2489 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2490 if( dataObj instanceof Array ) { 2491 return thisObject.onTooltip(dataObj[this.index]); 2492 } 2493 else { 2494 return thisObject.onTooltip(dataObj); 2495 } 2496 }) 2497 .event("click", function() { 2498 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2499 if( dataObj instanceof Array ) { 2500 return thisObject.onClick(dataObj[this.index]); 2501 } 2502 else { 2503 return thisObject.onClick(dataObj); 2504 } 2505 }); 2506 2507 wedge.anchor("center").add(pv.Label) 2508 .visible(function(d) { return (thisObject.marks() && (d > 0.10)); }) 2509 .textAngle(0) 2510 .text(function(d) { return (d*100).toFixed() + "%"; }) 2511 .textStyle("#fff"); 2512 2513 //wedge.anchor("end").add(pv.Label) 2514 //.visible(function(d) { return (d > 0.05); }) 2515 //.textMargin(0) //function(){ return thisObject.thickness() + 5; } 2516 //.text(function(d) { var lbl=thisObject.getDataLabel(this.index); return (lbl.length > thisObject.labelLength() ? lbl.substring(0,thisObject.labelLength())+"..." : lbl); }) 2517 //.font(function() { return thisObject.labelFont(); }); 2518 // .textStyle(function() { return wedge.fillStyle(); }); 2519 2520 /* Legend */ 2521 /* var legend = chart.add(pv.Panel) 2522 .top(function() { return thisObject.legendTop(); }) 2523 .left(function() { return thisObject.legendLeft(); }) 2524 .right(function() { return thisObject.legendRight(); }) 2525 .bottom(function() { return thisObject.legendBottom(); })*/ 2526 2527 2528 chart.add(pv.Dot) 2529 .data(function() { return pv.normalize(thisObject.getData(thisObject)); }) 2530 .visible(function() { return thisObject.legend(); }) 2531 .fillStyle(function() { return wedge.fillStyle(); }) 2532 .right(function() { return (thisObject.width() - thisObject.legendX()); }) 2533 .bottom(function() { return (this.index * 15) + (thisObject.height() - thisObject.legendY()); }) 2534 .size(20) 2535 .lineWidth(1) 2536 .strokeStyle("#000") 2537 .anchor("right").add(pv.Label) 2538 .text(function() { return thisObject.getDataLabel(this.index); }); 2539 2540 this.vis.add(pv.Label) 2541 .left(this.width() / 2) 2542 .visible(function() { return !(thisObject.title() === ""); }) 2543 .top(16) 2544 .textAlign("center") 2545 .text(function() { return thisObject.title(); }) 2546 .font(function() { return thisObject.titleFont(); }); 2547 }; 2548 2549 //Class c.protovis.BarChart : Chart 2550 //This is the custom wrapper class for protovis bar charts 2551 2552 //Constructor 2553 wso2vis.s.chart.protovis.BarChart = function(canvas, chartTitle, chartDesc) { 2554 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 2555 2556 /* @private */ 2557 this.vis = null; 2558 this.y = null; 2559 this.x = null; 2560 2561 this.legendText("Data 1"); 2562 } 2563 2564 // this makes c.protovis.BarChart.prototype inherits 2565 // from Chart.prototype 2566 wso2vis.extend(wso2vis.s.chart.protovis.BarChart, wso2vis.s.chart.Chart); 2567 2568 wso2vis.s.chart.protovis.BarChart.prototype 2569 .property("dataField") 2570 .property("dataValue") 2571 .property("dataLabel") 2572 .property("ySuffix") 2573 .property("xSuffix") 2574 .property("titleTop") 2575 .property("titleLeft") 2576 .property("titleRight") 2577 .property("titleBottom") 2578 .property("xTitle") 2579 .property("yTitle") 2580 .property("legendText") 2581 .property("segmentBorderColor"); 2582 2583 //Public function load 2584 //Loads the chart inside the given HTML element 2585 wso2vis.s.chart.protovis.BarChart.prototype.load = function (w, h) { 2586 if ( w !== undefined ) { 2587 this.width(w); 2588 } 2589 if ( h !== undefined ) { 2590 this.height(h); 2591 } 2592 2593 var thisObject = this; 2594 2595 this.x = pv.Scale.linear(0, 1).range(0, this.width()); 2596 this.y = pv.Scale.ordinal(pv.range(3)).splitBanded(0, this.height(), 4/5); 2597 2598 this.vis = new pv.Panel() 2599 .canvas(function() { return thisObject.divEl(); }) 2600 .width(function() { return thisObject.width(); }) 2601 .height(function() { return thisObject.height(); }); 2602 2603 var chart = this.vis.add(pv.Panel) 2604 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 2605 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 2606 .top(thisObject.paddingTop()) 2607 .bottom(thisObject.paddingBottom()) 2608 .left(thisObject.paddingLeft()) 2609 .right(thisObject.paddingRight()); 2610 2611 /* Draw Bars */ 2612 var bar = chart.add(pv.Bar) 2613 .data(function() { return thisObject.getData(thisObject); }) 2614 .top(function() { return thisObject.y(this.index); }) 2615 .height(function() { return thisObject.y.range().band; }) 2616 .width(thisObject.x) 2617 .left(0) 2618 //.strokeStyle("rgba(15, 55, 90, .9)") 2619 .fillStyle("rgba(31, 119, 180, 1)") 2620 .title(function() { 2621 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2622 if( dataObj instanceof Array ) { 2623 return thisObject.onTooltip(dataObj[this.index]); 2624 } 2625 else { 2626 return thisObject.onTooltip(dataObj); 2627 } 2628 }) 2629 .event("click", function() { 2630 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2631 if( dataObj instanceof Array ) { 2632 return thisObject.onClick(dataObj[this.index]); 2633 } 2634 else { 2635 return thisObject.onClick(dataObj); 2636 } 2637 }); 2638 2639 /* marks */ 2640 bar.anchor("right").add(pv.Label) 2641 .visible(function() { return thisObject.marks(); }) 2642 .textStyle("white") 2643 .textMargin(5) 2644 .text(function(d) { return d; }); 2645 2646 /* legend */ 2647 chart.add(pv.Dot) 2648 .data(function() { return [thisObject.legendText()]; }) 2649 .visible(function() { return thisObject.legend(); }) 2650 .left(function() { return thisObject.legendX(); }) 2651 .top(function() { return thisObject.legendY(); }) 2652 .fillStyle(function() { return bar.fillStyle(); }) 2653 .size(20) 2654 .lineWidth(1) 2655 .strokeStyle("#000") 2656 .anchor("right").add(pv.Label); 2657 2658 bar.anchor("left").add(pv.Label) 2659 .textMargin(5) 2660 .textAlign("right") 2661 .text(function() { return thisObject.getDataLabel(this.index); }) 2662 .font(function() { return thisObject.labelFont(); }) 2663 .textStyle("rgb(0,0,0)"); 2664 2665 chart.add(pv.Rule) 2666 .data(function() { return thisObject.x.ticks(); }) 2667 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 2668 .strokeStyle(function(d) { return (d ? "rgba(128,128,128,.3)" : "rgba(128,128,128,.8)"); }) 2669 .add(pv.Rule) 2670 .bottom(0) 2671 .height(5) 2672 .strokeStyle("rgba(128,128,128,1)") 2673 .anchor("bottom").add(pv.Label) 2674 .text(function(d) { return d.toFixed(); }) 2675 .font(function() { return thisObject.labelFont(); }) 2676 .textStyle("rgb(0,0,0)"); 2677 2678 this.vis.add(pv.Label) 2679 .left(this.width() / 2) 2680 .visible(function() { return !(thisObject.title() === ""); }) 2681 .top(16) 2682 .textAlign("center") 2683 .text(function() { return thisObject.title(); }) 2684 .font(function() { return thisObject.titleFont(); }); 2685 }; 2686 2687 /** 2688 * @private 2689 */ 2690 wso2vis.s.chart.protovis.BarChart.prototype.titleSpacing = function () { 2691 if(this.title() === "") { 2692 return 1; 2693 } 2694 else { 2695 return 0.9; 2696 } 2697 }; 2698 2699 /** 2700 * @private 2701 */ 2702 wso2vis.s.chart.protovis.BarChart.prototype.populateData = function (thisObject) { 2703 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2704 2705 var dataGrpCount = 1; 2706 if( _dataField instanceof Array ) { 2707 dataGrpCount = _dataField.length; 2708 } 2709 2710 thisObject.formattedData = pv.range(dataGrpCount).map( genDataMap ); 2711 2712 2713 var maxVal = thisObject.formattedData.max(); 2714 if (maxVal < 5) maxVal = 5; // fixing value repeating issue. 2715 2716 thisObject.x.domain(0, maxVal).range(0, (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) ); 2717 thisObject.y.domain(pv.range(dataGrpCount)).splitBanded(0, (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()), 4/5); 2718 2719 function genDataMap(x) { 2720 var rootObj; 2721 if( _dataField instanceof Array ) { 2722 rootObj = _dataField[x]; 2723 } 2724 else { 2725 rootObj = _dataField; 2726 } 2727 return parseInt(thisObject.traverseToDataField(rootObj, thisObject.dataValue())); 2728 } 2729 }; 2730 2731 wso2vis.s.chart.protovis.BarChart.prototype.getData = function (thisObject) { 2732 return thisObject.formattedData; 2733 }; 2734 2735 wso2vis.s.chart.protovis.BarChart.prototype.update = function () { 2736 this.populateData(this); 2737 this.vis.render(); 2738 if(this.tooltip() === true) { 2739 tooltip.init(); 2740 } 2741 }; 2742 2743 wso2vis.s.chart.protovis.BarChart.prototype.getDataLabel = function (i) { 2744 if (this.data !== null){ 2745 2746 var rootObj = this.traverseToDataField(this.data, this.dataField()); 2747 if( rootObj instanceof Array ) { 2748 return this.traverseToDataField(rootObj[i], this.dataLabel()); 2749 } 2750 else { 2751 return this.traverseToDataField(rootObj, this.dataLabel()); 2752 } 2753 } 2754 2755 return i; 2756 }; 2757 2758 //Class c.protovis.ClusteredBarChart : Chart 2759 //This is the custom wrapper class for protovis bar charts 2760 2761 //Constructor 2762 wso2vis.s.chart.protovis.ClusteredBarChart = function(canvas, chartTitle, chartDesc) { 2763 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 2764 2765 this.ySuffix("") 2766 .xSuffix(""); 2767 2768 /* @private */ 2769 this.vis = null; 2770 this.y = null; 2771 this.x = null; 2772 this.dataFieldCount = 1; 2773 this.subDataFieldCount = 1; 2774 this.maxDataValue = 50; 2775 } 2776 2777 // this makes c.protovis.ClusteredBarChart.prototype inherit from Chart 2778 wso2vis.extend(wso2vis.s.chart.protovis.ClusteredBarChart, wso2vis.s.chart.Chart); 2779 2780 wso2vis.s.chart.protovis.ClusteredBarChart.prototype 2781 .property("dataField") 2782 .property("dataLabel") 2783 .property("subDataField") 2784 .property("subDataValue") 2785 .property("subDataLabel") 2786 .property("ySuffix") 2787 .property("xSuffix"); 2788 2789 //Public function load 2790 //Loads the chart inside the given HTML element 2791 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.load = function (w, h) { 2792 if ( w !== undefined ) { 2793 this.width(w); 2794 } 2795 if ( h !== undefined ) { 2796 this.height(h); 2797 } 2798 2799 var thisObject = this; 2800 2801 this.x = pv.Scale.linear(0, this.maxDataValue).range(0, this.width()); 2802 this.y = pv.Scale.ordinal(pv.range(this.dataFieldCount)).splitBanded(0, this.height(), 4/5); 2803 2804 this.vis = new pv.Panel() 2805 .canvas(function() { return thisObject.divEl(); }) 2806 .width(function() { return thisObject.width(); }) 2807 .height(function() { return thisObject.height(); }); 2808 2809 var chart = this.vis.add(pv.Panel) 2810 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 2811 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 2812 .top(thisObject.paddingTop()) 2813 .bottom(thisObject.paddingBottom()) 2814 .left(thisObject.paddingLeft()) 2815 .right(thisObject.paddingRight()); 2816 2817 var bar = chart.add(pv.Panel) 2818 .data(function() { return thisObject.getData(thisObject); }) 2819 .top(function() { return thisObject.y(this.index); }) 2820 .add(pv.Bar) 2821 .data(function(a) { return a; }) 2822 .top(function() { return (this.index * thisObject.y.range().band / thisObject.subDataFieldCount); }) 2823 .height(function() { return (thisObject.y.range().band / thisObject.subDataFieldCount); }) 2824 .left(0) 2825 .width(thisObject.x) 2826 .fillStyle(pv.Colors.category20().by(pv.index)) 2827 .title(function() { 2828 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2829 if( dataObj instanceof Array ) { 2830 return thisObject.onTooltip(dataObj[this.parent.index], this.index); 2831 } 2832 else { 2833 return thisObject.onTooltip(dataObj, this.index); 2834 } 2835 }) 2836 .event("click", function() { 2837 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2838 if( dataObj instanceof Array ) { 2839 return thisObject.onClick(dataObj[this.parent.index], this.index); 2840 } 2841 else { 2842 return thisObject.onClick(dataObj, this.index); 2843 } 2844 }); 2845 2846 /* marks */ 2847 bar.anchor("right").add(pv.Label) 2848 .visible(function() { return thisObject.marks(); }) 2849 .textStyle("white") 2850 .text(function(d) { return d; }); 2851 2852 chart.add(pv.Label) 2853 .data(function() { return pv.range(thisObject.dataFieldCount); }) 2854 .left(0) 2855 .top(function() { return (thisObject.y(this.index) + thisObject.y.range().band / 2); }) 2856 .textMargin(5) 2857 .textAlign("right") 2858 .text(function() { return thisObject.getDataLabel(this.index); }) 2859 .font(function() { return thisObject.labelFont(); }) 2860 .textStyle("rgb(0,0,0)"); 2861 2862 chart.add(pv.Rule) 2863 .data(function() { return thisObject.x.ticks(); }) 2864 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 2865 .strokeStyle(function(d) { return (d ? "rgba(128,128,128,.3)" : "rgba(128,128,128,.8)"); }) 2866 .add(pv.Rule) 2867 .bottom(0) 2868 .height(5) 2869 .strokeStyle("rgba(128,128,128,1)") 2870 .anchor("bottom").add(pv.Label) 2871 .text(function(d) { return d.toFixed(); }) 2872 .font(function() { return thisObject.labelFont(); }) 2873 .textStyle("rgb(0,0,0)"); 2874 2875 this.vis.add(pv.Label) 2876 .left(this.width() / 2) 2877 .visible(function() { return !(thisObject.title() === ""); }) 2878 .top(16) 2879 .textAlign("center") 2880 .text(function() { return thisObject.title(); }) 2881 .font(function() { return thisObject.titleFont(); }); 2882 }; 2883 2884 /** 2885 * @private 2886 */ 2887 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.titleSpacing = function () { 2888 if(this.title() === "") { 2889 return 1; 2890 } 2891 else { 2892 return 0.9; 2893 } 2894 }; 2895 2896 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.populateData = function (thisObject) { 2897 2898 var tmpMaxValHolder = []; 2899 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 2900 2901 var dataGrpCount = 1; 2902 if( _dataField instanceof Array ) { 2903 dataGrpCount = _dataField.length; 2904 } 2905 2906 thisObject.subDataFieldCount = 1; 2907 thisObject.formattedData = pv.range(dataGrpCount).map( genDataMap ); 2908 thisObject.dataFieldCount = dataGrpCount; 2909 thisObject.maxDataValue = tmpMaxValHolder.max() + 5; //to keep bars inside the ruler 2910 if (thisObject.maxDataValue < 5) thisObject.maxDataValue = 5; // fixing value repeating issue. 2911 2912 thisObject.x.domain(0, thisObject.maxDataValue).range(0, (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight())); 2913 thisObject.y.domain(pv.range(thisObject.dataFieldCount)).splitBanded(0, (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()), 4/5); 2914 2915 function genDataMap(x) { 2916 var innerArray = []; 2917 2918 var rootObja; 2919 if( _dataField instanceof Array ) { 2920 rootObja = _dataField[x]; 2921 } 2922 else { 2923 rootObja = _dataField; 2924 } 2925 2926 var _subDataField = thisObject.traverseToDataField(rootObja, thisObject.subDataField()); 2927 2928 var subDataGrpCount = 1; 2929 if( _subDataField instanceof Array ) { 2930 subDataGrpCount = _subDataField.length; 2931 thisObject.subDataFieldCount = (thisObject.subDataFieldCount < _subDataField.length) ? _subDataField.length : thisObject.subDataFieldCount; 2932 } 2933 2934 for(var y=0; y<subDataGrpCount; y++) { 2935 var rootObjb; 2936 if( _subDataField instanceof Array ) { 2937 rootObjb = _subDataField[y]; 2938 } 2939 else { 2940 rootObjb = _subDataField; 2941 } 2942 var temp = parseInt(thisObject.traverseToDataField(rootObjb, thisObject.subDataValue())); 2943 innerArray.push(temp); 2944 } 2945 tmpMaxValHolder.push(innerArray.max()); 2946 return innerArray; 2947 } 2948 }; 2949 2950 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.getData = function (thisObject) { 2951 2952 return thisObject.formattedData; 2953 }; 2954 2955 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.update = function () { 2956 2957 this.populateData(this); 2958 this.vis.render(); 2959 if(this.tooltip() === true) { 2960 tooltip.init(); 2961 } 2962 }; 2963 2964 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.getDataLabel = function (i) { 2965 if (this.data !== null){ 2966 2967 var rootObj = this.traverseToDataField(this.data, this.dataField()); 2968 if( rootObj instanceof Array ) { 2969 return this.traverseToDataField(rootObj[i], this.dataLabel()); 2970 } 2971 else { 2972 return this.traverseToDataField(rootObj, this.dataLabel()); 2973 } 2974 } 2975 return i; 2976 }; 2977 2978 wso2vis.s.chart.protovis.ClusteredBarChart.prototype.getSubDataLable = function (i, j) { 2979 if (this.data !== null){ 2980 var rootDataObj; 2981 var _dataField = this.traverseToDataField(this.data, this.dataField()); 2982 2983 if( _dataField instanceof Array ) { 2984 rootDataObj = _dataField[i]; 2985 } 2986 else { 2987 rootDataObj = _dataField; 2988 } 2989 2990 var rootSubDataObj = this.traverseToDataField(rootDataObj, this.subDataField()); 2991 2992 if( rootSubDataObj instanceof Array ) { 2993 return this.traverseToDataField(rootSubDataObj[j], this.subDataLabel()); 2994 } 2995 else { 2996 return this.traverseToDataField(rootSubDataObj, this.subDataLabel()); 2997 } 2998 } 2999 return j; 3000 }; 3001 3002 //Class c.protovis.ColumnChart : Chart 3003 //This is the custom wrapper class for protovis column charts 3004 3005 //Constructor 3006 wso2vis.s.chart.protovis.ColumnChart = function(canvas, chartTitle, chartDesc) { 3007 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 3008 3009 this.ySuffix("") 3010 .xSuffix(""); 3011 3012 /* @private */ 3013 this.vis = null; 3014 this.y = null; 3015 this.x = null; 3016 } 3017 3018 // this makes c.protovis.ColumnChart.prototype inherits 3019 // from Chart.prototype 3020 wso2vis.extend(wso2vis.s.chart.protovis.ColumnChart, wso2vis.s.chart.Chart); 3021 3022 wso2vis.s.chart.protovis.ColumnChart.prototype 3023 .property("dataField") 3024 .property("dataValue") 3025 .property("dataLabel") 3026 .property("ySuffix") 3027 .property("xSuffix"); 3028 3029 //Public function load 3030 //Loads the chart inside the given HTML element 3031 wso2vis.s.chart.protovis.ColumnChart.prototype.load = function (w, h) { 3032 if ( w !== undefined ) { 3033 this.width(w); 3034 } 3035 if ( h !== undefined ) { 3036 this.height(h); 3037 } 3038 3039 var n = 3; 3040 var thisObject = this; 3041 3042 this.y = pv.Scale.linear(0, 1).range(0, this.height()); 3043 this.x = pv.Scale.ordinal(pv.range(n)).splitBanded(0, this.width(), 4/5); 3044 3045 this.vis = new pv.Panel() 3046 .canvas(function() { return thisObject.divEl(); }) 3047 .width(function() { return thisObject.width(); }) 3048 .height(function() { return thisObject.height(); }); 3049 3050 var chart = this.vis.add(pv.Panel) 3051 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 3052 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 3053 .top(thisObject.paddingTop()) 3054 .bottom(thisObject.paddingBottom()) 3055 .left(thisObject.paddingLeft()) 3056 .right(thisObject.paddingRight()); 3057 3058 var bar = chart.add(pv.Bar) 3059 .data(function() { return thisObject.getData(thisObject); }) 3060 .left(function() { return thisObject.x(this.index); }) 3061 .width(function() { return thisObject.x.range().band; }) 3062 .bottom(0) 3063 .height(thisObject.y) 3064 .title(function() { 3065 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3066 if( dataObj instanceof Array ) { 3067 return thisObject.onTooltip(dataObj[this.index]); 3068 } 3069 else { 3070 return thisObject.onTooltip(dataObj); 3071 } 3072 }) 3073 .event("click", function() { 3074 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3075 if( dataObj instanceof Array ) { 3076 return thisObject.onClick(dataObj[this.index]); 3077 } 3078 else { 3079 return thisObject.onClick(dataObj); 3080 } 3081 }); 3082 3083 bar.anchor("top").add(pv.Label) 3084 .visible(function() { return thisObject.marks(); }) 3085 .textStyle("white") 3086 .textMargin(5) 3087 .text(function(d) { return d; }); 3088 3089 bar.anchor("bottom").add(pv.Label) 3090 .textMargin(10) 3091 .textBaseline("top") 3092 .textAngle(Math.PI / 2) 3093 .textAlign("left") 3094 .text(function() { return thisObject.getDataLabel(this.index); }) 3095 .font(function() { return thisObject.labelFont(); }); 3096 /*.add(pv.Bar).fillStyle("rgba(128,128,128,0.1)").height(6);*/ 3097 3098 chart.add(pv.Rule) 3099 .data(function() { return thisObject.y.ticks(); }) 3100 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 3101 .strokeStyle(function(d) { return (d ? "rgba(128,128,128,.5)" : "#000"); }) 3102 .add(pv.Rule) 3103 .left(0) 3104 .width(5) 3105 .strokeStyle("rgba(128,128,128,1)") 3106 .anchor("left").add(pv.Label) 3107 .text(function(d) { return d.toFixed(); }) 3108 .font(function() { return thisObject.labelFont(); }); 3109 3110 this.vis.add(pv.Label) 3111 .left(this.width() / 2) 3112 .visible(function() { return !(thisObject.title() === ""); }) 3113 .top(16) 3114 .textAlign("center") 3115 .text(function() { return thisObject.title(); }) 3116 .font(function() { return thisObject.titleFont(); }); 3117 }; 3118 3119 /** 3120 * @private 3121 */ 3122 wso2vis.s.chart.protovis.ColumnChart.prototype.titleSpacing = function () { 3123 if(this.title() === "") { 3124 return 1; 3125 } 3126 else { 3127 return 0.9; 3128 } 3129 }; 3130 3131 wso2vis.s.chart.protovis.ColumnChart.prototype.populateData = function (thisObject) { 3132 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3133 3134 var dataGrpCount = 1; 3135 if( _dataField instanceof Array ) { 3136 dataGrpCount = _dataField.length; 3137 } 3138 3139 thisObject.formattedData = pv.range(dataGrpCount).map( genDataMap ); 3140 3141 3142 var maxVal = thisObject.formattedData.max() + 5; //to make sure the bars are inside the rule 3143 if (maxVal < 5) maxVal = 5; // fixing value repeating issue. 3144 3145 this.y.domain(0, maxVal).range(0, (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom())); 3146 this.x.domain(pv.range(dataGrpCount)).splitBanded(0, (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()), 4/5); 3147 3148 var maxLabelLength = (maxVal == 0) ? 1 : Math.floor(Math.log(maxVal)/Math.log(10)) + 1; //TODO: maxheight will never become 0. But we check it just to be in the safe side. useless? 3149 this.vis.left((maxLabelLength*9.5)+5); 3150 3151 function genDataMap(x) { 3152 var rootObj; 3153 if( _dataField instanceof Array ) { 3154 rootObj = _dataField[x]; 3155 } 3156 else { 3157 rootObj = _dataField; 3158 } 3159 return parseInt(thisObject.traverseToDataField(rootObj, thisObject.dataValue())); 3160 } 3161 }; 3162 3163 wso2vis.s.chart.protovis.ColumnChart.prototype.getData = function (thisObject) { 3164 return thisObject.formattedData; 3165 }; 3166 3167 wso2vis.s.chart.protovis.ColumnChart.prototype.update = function () { 3168 this.populateData(this); 3169 this.vis.render(); 3170 if(this.tooltip() === true) { 3171 tooltip.init(); 3172 } 3173 }; 3174 3175 wso2vis.s.chart.protovis.ColumnChart.prototype.getDataLabel = function (i) { 3176 if (this.data !== null){ 3177 3178 var rootObj = this.traverseToDataField(this.data, this.dataField()); 3179 if( rootObj instanceof Array ) { 3180 return this.traverseToDataField(rootObj[i], this.dataLabel()); 3181 } 3182 else { 3183 return this.traverseToDataField(rootObj, this.dataLabel()); 3184 } 3185 } 3186 3187 return i; 3188 }; 3189 3190 //Class c.protovis.ClusteredColumnChart : Chart 3191 //This is the custom wrapper class for protovis bar charts 3192 3193 //Constructor 3194 wso2vis.s.chart.protovis.ClusteredColumnChart = function(canvas, chartTitle, chartDesc) { 3195 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 3196 3197 this.ySuffix("") 3198 .xSuffix(""); 3199 3200 /* @private */ 3201 this.vis = null; 3202 this.y = null; 3203 this.x = null; 3204 this.dataFieldCount = 1; 3205 this.subDataFieldCount = 1; 3206 this.maxDataValue = 50; 3207 } 3208 3209 // this makes c.protovis.ClusteredColumnChart.prototype inherit from Chart 3210 wso2vis.extend(wso2vis.s.chart.protovis.ClusteredColumnChart, wso2vis.s.chart.Chart); 3211 3212 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype 3213 .property("dataField") 3214 .property("dataLabel") 3215 .property("subDataField") 3216 .property("subDataValue") 3217 .property("subDataLabel") 3218 .property("ySuffix") 3219 .property("xSuffix"); 3220 3221 //Public function load 3222 //Loads the chart inside the given HTML element 3223 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.load = function (w, h) { 3224 if ( w !== undefined ) { 3225 this.width(w); 3226 } 3227 if ( h !== undefined ) { 3228 this.height(h); 3229 } 3230 3231 var thisObject = this; 3232 3233 this.y = pv.Scale.linear(0, this.maxDataValue).range(0, this.height()); 3234 this.x = pv.Scale.ordinal(pv.range(this.dataFieldCount)).splitBanded(0, this.width(), 4/5); 3235 3236 this.vis = new pv.Panel() 3237 .canvas(function() { return thisObject.divEl(); }) 3238 .width(function() { return thisObject.width(); }) 3239 .height(function() { return thisObject.height(); }); 3240 3241 var chart = this.vis.add(pv.Panel) 3242 .width(function() { return (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()); }) 3243 .height(function() { return (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()); }) 3244 .top(thisObject.paddingTop()) 3245 .bottom(thisObject.paddingBottom()) 3246 .left(thisObject.paddingLeft()) 3247 .right(thisObject.paddingRight()); 3248 3249 var bar = chart.add(pv.Panel) 3250 .data(function() { return thisObject.getData(thisObject); }) 3251 .left(function() { return thisObject.x(this.index); }) 3252 .add(pv.Bar) 3253 .data(function(a) { return a; }) 3254 .left(function() { return (this.index * thisObject.x.range().band / thisObject.subDataFieldCount); }) 3255 .width(function() { return (thisObject.x.range().band / thisObject.subDataFieldCount); }) 3256 .bottom(0) 3257 .height(thisObject.y) 3258 .fillStyle(pv.Colors.category20().by(pv.index)) 3259 .title(function() { 3260 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3261 if( dataObj instanceof Array ) { 3262 return thisObject.onTooltip(dataObj[this.parent.index], this.index); 3263 } 3264 else { 3265 return thisObject.onTooltip(dataObj); 3266 } 3267 }) 3268 .event("click", function() { 3269 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3270 if( dataObj instanceof Array ) { 3271 return thisObject.onClick(dataObj[this.parent.index], this.index); 3272 } 3273 else { 3274 return thisObject.onClick(dataObj); 3275 } 3276 }); 3277 3278 bar.anchor("top").add(pv.Label) 3279 .visible(function() { return thisObject.marks(); }) 3280 .textStyle("white") 3281 .text(function(d) { return d; }); 3282 3283 chart.add(pv.Label) 3284 .data(function() { return pv.range(thisObject.dataFieldCount); }) 3285 .bottom(0) 3286 .left(function() { return thisObject.x(this.index); }) //TODO fix the alignment issue (+ thisObject.x.range().band / 2) 3287 .textMargin(5) 3288 .textBaseline("top") 3289 .text(function() { return thisObject.getDataLabel(this.index); }) 3290 .font(function() { return thisObject.labelFont(); }); 3291 3292 chart.add(pv.Rule) 3293 .data(function() { return thisObject.y.ticks(); }) 3294 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 3295 .strokeStyle(function(d) { return (d ? "rgba(128,128,128,.3)" : "#000"); }) 3296 .add(pv.Rule) 3297 .left(0) 3298 .width(5) 3299 .strokeStyle("rgba(128,128,128,1)") 3300 .anchor("left").add(pv.Label) 3301 .text(function(d) { return d.toFixed(); }) 3302 .font(function() { return thisObject.labelFont(); }); 3303 3304 this.vis.add(pv.Label) 3305 .left(this.width() / 2) 3306 .visible(function() { return !(thisObject.title() === ""); }) 3307 .top(16) 3308 .textAlign("center") 3309 .text(function() { return thisObject.title(); }) 3310 .font(function() { return thisObject.titleFont(); }); 3311 }; 3312 3313 /** 3314 * @private 3315 */ 3316 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.titleSpacing = function () { 3317 if(this.title() === "") { 3318 return 1; 3319 } 3320 else { 3321 return 0.9; 3322 } 3323 }; 3324 3325 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.populateData = function (thisObject) { 3326 3327 var tmpMaxValHolder = []; 3328 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3329 3330 var dataGrpCount = 1; 3331 if( _dataField instanceof Array ) { 3332 dataGrpCount = _dataField.length; 3333 } 3334 3335 thisObject.subDataFieldCount = 1; 3336 thisObject.formattedData = pv.range(dataGrpCount).map( genDataMap ); 3337 thisObject.dataFieldCount = dataGrpCount; 3338 thisObject.maxDataValue = tmpMaxValHolder.max(); 3339 if (thisObject.maxDataValue < 5) thisObject.maxDataValue = 5; // fixing value repeating issue. 3340 3341 thisObject.y.domain(0, thisObject.maxDataValue).range(0, (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom())); 3342 thisObject.x.domain(pv.range(thisObject.dataFieldCount)).splitBanded(0, (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()), 4/5); 3343 3344 function genDataMap(x) { 3345 var innerArray = []; 3346 3347 var rootObja; 3348 if( _dataField instanceof Array ) { 3349 rootObja = _dataField[x]; 3350 } 3351 else { 3352 rootObja = _dataField; 3353 } 3354 3355 var _subDataField = thisObject.traverseToDataField(rootObja, thisObject.subDataField()); 3356 3357 var subDataGrpCount = 1; 3358 if( _subDataField instanceof Array ) { 3359 subDataGrpCount = _subDataField.length; 3360 thisObject.subDataFieldCount = (thisObject.subDataFieldCount < _subDataField.length) ? _subDataField.length : thisObject.subDataFieldCount; 3361 } 3362 3363 for(var y=0; y<subDataGrpCount; y++) { 3364 var rootObjb; 3365 if( _subDataField instanceof Array ) { 3366 rootObjb = _subDataField[y]; 3367 } 3368 else { 3369 rootObjb = _subDataField; 3370 } 3371 var temp = parseInt(thisObject.traverseToDataField(rootObjb, thisObject.subDataValue())); 3372 innerArray.push(temp); 3373 } 3374 tmpMaxValHolder.push(innerArray.max()); 3375 return innerArray; 3376 } 3377 }; 3378 3379 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.getData = function (thisObject) { 3380 3381 return thisObject.formattedData; 3382 }; 3383 3384 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.update = function () { 3385 3386 this.populateData(this); 3387 this.vis.render(); 3388 if(this.tooltip() === true) { 3389 tooltip.init(); 3390 } 3391 }; 3392 3393 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.getDataLabel = function (i) { 3394 if (this.data !== null){ 3395 3396 var rootObj = this.traverseToDataField(this.data, this.dataField()); 3397 if( rootObj instanceof Array ) { 3398 return this.traverseToDataField(rootObj[i], this.dataLabel()); 3399 } 3400 else { 3401 return this.traverseToDataField(rootObj, this.dataLabel()); 3402 } 3403 } 3404 return i; 3405 }; 3406 3407 wso2vis.s.chart.protovis.ClusteredColumnChart.prototype.getSubDataLable = function (i, j) { 3408 if (this.data !== null){ 3409 var rootDataObj; 3410 var _dataField = this.traverseToDataField(this.data, this.dataField()); 3411 3412 if( _dataField instanceof Array ) { 3413 rootDataObj = _dataField[i]; 3414 } 3415 else { 3416 rootDataObj = _dataField; 3417 } 3418 3419 var rootSubDataObj = this.traverseToDataField(rootDataObj, this.subDataField()); 3420 3421 if( rootSubDataObj instanceof Array ) { 3422 return this.traverseToDataField(rootSubDataObj[j], this.subDataLabel()); 3423 } 3424 else { 3425 return this.traverseToDataField(rootSubDataObj, this.subDataLabel()); 3426 } 3427 } 3428 return j; 3429 }; 3430 3431 //Class AreaChart : Chart 3432 //This is the custom wrapper class for protovis area/line charts 3433 3434 //Constructor 3435 wso2vis.s.chart.protovis.AreaChart = function(div, chartTitle, chartDesc) { 3436 wso2vis.s.chart.Chart.call(this, div, chartTitle, chartDesc); 3437 3438 this.band(12) 3439 .ySuffix("") 3440 .xSuffix("") 3441 .xInterval(10000) 3442 .dirFromLeft(true); 3443 3444 /* @private */ 3445 this.dataHistory = []; 3446 this.vis = null; 3447 this.x = null; 3448 this.y = null; 3449 }; 3450 3451 // this makes AreaChart.prototype inherit from Chart 3452 wso2vis.extend(wso2vis.s.chart.protovis.AreaChart, wso2vis.s.chart.Chart); 3453 3454 wso2vis.s.chart.protovis.AreaChart.prototype 3455 .property("band") 3456 .property("dataField") 3457 .property("dataValue") 3458 .property("dataLabel") 3459 .property("ySuffix") 3460 .property("xSuffix") 3461 .property("xInterval") 3462 .property("dirFromLeft"); 3463 3464 //Public function load 3465 //Loads the chart inside the given HTML element 3466 wso2vis.s.chart.protovis.AreaChart.prototype.load = function (w, h, band) { 3467 if ( w !== undefined ) { 3468 this.width(w); 3469 } 3470 if ( h !== undefined ) { 3471 this.height(h); 3472 } 3473 if ( band !== undefined ) { 3474 this.band(band); 3475 } 3476 3477 var thisObject = this; 3478 3479 this.x = pv.Scale.linear(0, this.band()).range(0, this.width()); 3480 this.y = pv.Scale.linear(0, 50).range(0, this.height()*0.9); 3481 3482 this.vis = new pv.Panel() 3483 .canvas(function() { return thisObject.divEl(); }) 3484 .width(function() { return thisObject.width(); }) 3485 .height(function() { return thisObject.height(); }) 3486 .bottom(20) 3487 .top(0) 3488 .left(30) 3489 .right(10); 3490 3491 var panel = this.vis.add(pv.Panel) 3492 .data(function() { return thisObject.getData(thisObject); }) 3493 .top(function() { return (thisObject.height() * (1 - thisObject.titleSpacing())); }) 3494 .height(function() { return (thisObject.height() * thisObject.titleSpacing()); }); 3495 //.strokeStyle("#ccc"); 3496 3497 var area = panel.add(pv.Area) 3498 .data(function(a) { return a; }) 3499 .left(function(d) 3500 { 3501 if (thisObject.dirFromLeft()) 3502 return thisObject.x(this.index); 3503 return thisObject.x((thisObject.dataHistory[this.parent.index].length <= thisObject.band()) ? (thisObject.band() - thisObject.dataHistory[this.parent.index].length) + this.index + 1: this.index); 3504 }) 3505 .bottom(0)//pv.Layout.stack()) 3506 .height(function(d) { return thisObject.y(d); }) 3507 .title(function() { 3508 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3509 if( dataObj instanceof Array ) { 3510 return thisObject.onTooltip(dataObj[this.parent.index]); 3511 } 3512 else { 3513 return thisObject.onTooltip(dataObj); 3514 } 3515 }) 3516 .event("click", function() { 3517 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3518 if( dataObj instanceof Array ) { 3519 return thisObject.onClick(dataObj[this.parent.index]); 3520 } 3521 else { 3522 return thisObject.onClick(dataObj); 3523 } 3524 }); 3525 3526 var areaDot = area.anchor("top").add(pv.Dot).title(function(d) { return d; }) 3527 .visible(function() { return thisObject.marks(); }) 3528 .fillStyle("#fff") 3529 .size(10); 3530 //.add(pv.Label); 3531 3532 /* Legend */ 3533 panel.add(pv.Dot) 3534 .visible(function() { return thisObject.legend(); }) 3535 .right(100) 3536 .fillStyle(function() { return area.fillStyle(); }) 3537 .bottom(function() { return (this.parent.index * 15) + 10; }) 3538 .size(20) 3539 .lineWidth(1) 3540 .strokeStyle("#000") 3541 .anchor("right").add(pv.Label) 3542 .text(function() { return thisObject.getDataLabel(this.parent.index); }); 3543 3544 /* Vertical Grid Lines */ 3545 panel.add(pv.Rule) 3546 .data(function() { return thisObject.x.ticks(); }) 3547 //.visible(function(d) { return (d > 0); }) 3548 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 3549 //.strokeStyle("rgba(128,128,128,.1)") 3550 //.add(pv.Rule) 3551 .bottom(-2) 3552 .height(5) 3553 .strokeStyle("rgba(128,128,128,1)") 3554 .anchor("bottom").add(pv.Label) 3555 .textMargin(10) 3556 .text(function(d) { var n = new Number(((thisObject.dirFromLeft())? d : thisObject.band() - d) * thisObject.xInterval() / 1000); return n.toFixed() + thisObject.xSuffix(); }) 3557 .font(function() { return thisObject.labelFont(); }) 3558 .textStyle("rgb(0,0,0)"); 3559 3560 /* Horizontal Grid Lines */ 3561 panel.add(pv.Rule) 3562 .data(function() { return thisObject.y.ticks(); }) 3563 //.visible(function() { return !(this.parent.index % 2); }) 3564 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 3565 .strokeStyle("rgba(128,128,128,.2)") 3566 //.strokeStyle(function(d) { return (d==12) ? "green" : "rgba(128,128,128,.2)"; }) 3567 .add(pv.Rule) 3568 .left(-5) 3569 .width(5) 3570 .strokeStyle("rgba(128,128,128,1)") 3571 .anchor("left").add(pv.Label) 3572 .textMargin(10) 3573 .text(function(d) {return d.toFixed() + thisObject.ySuffix(); }) 3574 .font(function() { return thisObject.labelFont(); }) 3575 .textStyle("rgb(0,0,0)"); 3576 3577 this.vis.add(pv.Label) 3578 .left(this.width() / 2) 3579 .visible(function() { return !(thisObject.title() === ""); }) 3580 .top(16) 3581 .textAlign("center") 3582 .text(function() { return thisObject.title(); }) 3583 .font(function() { return thisObject.titleFont(); }); 3584 }; 3585 3586 /** 3587 * @private 3588 */ 3589 wso2vis.s.chart.protovis.AreaChart.prototype.titleSpacing = function () { 3590 if(this.title() === "") { 3591 return 1; 3592 } 3593 else { 3594 return 0.9; 3595 } 3596 }; 3597 3598 /** 3599 * @private 3600 */ 3601 wso2vis.s.chart.protovis.AreaChart.prototype.populateData = function (thisObject) { 3602 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3603 3604 var dataGrpCount = 1; 3605 if( _dataField instanceof Array ) { 3606 dataGrpCount = _dataField.length; 3607 } 3608 3609 thisObject.formattedData = pv.range(dataGrpCount).map(genDataMap); 3610 3611 thisObject.x.domain(0, thisObject.band()).range(0,thisObject.width()); 3612 var maxheight = calcMaxHeight(); 3613 if (maxheight < 5) maxheight = 5; // fixing value repeating issue. 3614 thisObject.y.domain(0, maxheight).range(0, (thisObject.height() * thisObject.titleSpacing()) - 35); 3615 thisObject.y.nice(); 3616 3617 var maxLabelLength = (maxheight == 0) ? 1 : Math.floor(Math.log(maxheight)/Math.log(10)) + 1; //TODO: maxheight will never become 0. But we check it just to be in the safe side. useless? 3618 this.vis.left((maxLabelLength*9.5)+10); 3619 3620 function genDataMap(x) { 3621 var rootObj; 3622 if( _dataField instanceof Array ) { 3623 rootObj = _dataField[x]; 3624 } 3625 else { 3626 rootObj = _dataField; 3627 } 3628 var valObj = parseInt(thisObject.traverseToDataField(rootObj, thisObject.dataValue())); 3629 3630 if (thisObject.dataHistory[x] === undefined){ 3631 thisObject.dataHistory[x] = new Array(); 3632 } 3633 if (thisObject.dirFromLeft()) { 3634 thisObject.dataHistory[x].unshift(valObj); 3635 3636 if(thisObject.dataHistory[x].length > thisObject.band()+1){ 3637 thisObject.dataHistory[x].pop(); 3638 } 3639 } 3640 else { 3641 thisObject.dataHistory[x].push(valObj); 3642 3643 if(thisObject.dataHistory[x].length > thisObject.band()+1){ 3644 thisObject.dataHistory[x].shift(); 3645 } 3646 } 3647 return thisObject.dataHistory[x]; 3648 } 3649 3650 function calcMaxHeight() { 3651 var totHeights = []; 3652 for (var k=0; k<thisObject.dataHistory.length; k++) { 3653 totHeights.push(thisObject.dataHistory[k].max()); 3654 } 3655 return totHeights.max(); 3656 } 3657 }; 3658 3659 wso2vis.s.chart.protovis.AreaChart.prototype.getData = function (thisObject) { 3660 return thisObject.formattedData; 3661 }; 3662 3663 wso2vis.s.chart.protovis.AreaChart.prototype.update = function () { 3664 this.populateData(this); 3665 this.vis.render(); 3666 if(this.tooltip() === true) { 3667 tooltip.init(); 3668 } 3669 }; 3670 3671 wso2vis.s.chart.protovis.AreaChart.prototype.getDataLabel = function (i) { 3672 if (this.data !== null){ 3673 var rootObj = this.traverseToDataField(this.data, this.dataField()); 3674 if( rootObj instanceof Array ) { 3675 return this.traverseToDataField(rootObj[i], this.dataLabel()); 3676 } 3677 else { 3678 return this.traverseToDataField(rootObj, this.dataLabel()); 3679 } 3680 } 3681 return i; 3682 }; 3683 3684 wso2vis.s.chart.protovis.AreaChart.prototype.clear = function () { 3685 this.dataHistory.length = 0; 3686 }; 3687 3688 //Class AreaChart2 : Chart 3689 //This is the custom wrapper class for protovis area/line charts 3690 3691 //Constructor 3692 wso2vis.s.chart.protovis.AreaChart2 = function(div, chartTitle, chartDesc) { 3693 wso2vis.s.chart.Chart.call(this, div, chartTitle, chartDesc); 3694 3695 this.band(12) 3696 .xSuffix("") 3697 .ySuffix(""); 3698 3699 /* @private */ 3700 this.vis = null; 3701 this.x = null; 3702 this.y = null; 3703 this.customXticks = null; 3704 }; 3705 3706 // this makes AreaChart2.prototype inherit from Chart 3707 wso2vis.extend(wso2vis.s.chart.protovis.AreaChart2, wso2vis.s.chart.Chart); 3708 3709 wso2vis.s.chart.protovis.AreaChart2.prototype 3710 .property("dataField") 3711 .property("subDataField") 3712 .property("xDataValue") 3713 .property("yDataValue") 3714 .property("dataLabel") 3715 .property("xSuffix") 3716 .property("ySuffix") 3717 .property("xLabel") 3718 .property("band"); 3719 3720 //Public function load 3721 //Loads the chart inside the given HTML element 3722 wso2vis.s.chart.protovis.AreaChart2.prototype.load = function (w, h) { 3723 if ( w !== undefined ) { 3724 this.width(w); 3725 } 3726 if ( h !== undefined ) { 3727 this.height(h); 3728 } 3729 3730 var thisObject = this; 3731 3732 this.x = pv.Scale.linear(0, 4).range(0, this.width()); 3733 this.y = pv.Scale.linear(0, 50).range(0, this.height()*0.9); 3734 this.customXticks = []; 3735 3736 this.vis = new pv.Panel() 3737 .canvas(function() { return thisObject.divEl(); }) 3738 .width(function() { return thisObject.width(); }) 3739 .height(function() { return thisObject.height(); }) 3740 .bottom(20) 3741 .top(0) 3742 .left(30) 3743 .right(10); 3744 3745 var panel = this.vis.add(pv.Panel) 3746 .data(function() { return thisObject.getData(thisObject); }) 3747 .top(function() { return (thisObject.height() * (1 - thisObject.titleSpacing())); }) 3748 .height(function() { return (thisObject.height() * thisObject.titleSpacing()); }) 3749 .strokeStyle("#ccc"); 3750 3751 var area = panel.add(pv.Area) 3752 .data(function(a) { return a; }) 3753 .left(function(d) { return thisObject.x(d.x); }) 3754 .bottom(0)//pv.Layout.stack()) 3755 .height(function(d) { return thisObject.y(d.y); }) 3756 .title(function() { 3757 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3758 if( dataObj instanceof Array ) { 3759 return thisObject.onTooltip(dataObj[this.parent.index]); 3760 } 3761 else { 3762 return thisObject.onTooltip(dataObj); 3763 } 3764 }) 3765 .event("click", function() { 3766 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3767 if( dataObj instanceof Array ) { 3768 return thisObject.onClick(dataObj[this.parent.index]); 3769 } 3770 else { 3771 return thisObject.onClick(dataObj); 3772 } 3773 }); 3774 3775 var areaDot = area.anchor("top").add(pv.Dot).title(function(d) { return d.y; }) 3776 .visible(function() { return thisObject.marks(); }) 3777 .fillStyle("#fff") 3778 .size(10); 3779 //.add(pv.Label); 3780 3781 /* Legend */ 3782 panel.add(pv.Dot) 3783 .visible(function() { return thisObject.legend(); }) 3784 .right(100) 3785 .fillStyle(function() { return area.fillStyle(); }) 3786 .bottom(function() { return (this.parent.index * 15) + 10; }) 3787 .size(20) 3788 .lineWidth(1) 3789 .strokeStyle("#000") 3790 .anchor("right").add(pv.Label) 3791 .text(function() { return thisObject.getDataLabel(this.parent.index); }); 3792 3793 panel.add(pv.Rule) 3794 .data(function() { return thisObject.customXticks; /*thisObject.x.ticks();*/ }) 3795 .visible(function(d) { return (d > 0); }) 3796 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 3797 .strokeStyle("rgba(128,128,128,.1)") 3798 .anchor("bottom").add(pv.Label) 3799 .text(function(d) { return d.toFixed() + thisObject.xSuffix(); }) 3800 .font(function() { return thisObject.labelFont(); }) 3801 .textStyle("rgba(128,128,128,0.5)"); 3802 3803 panel.add(pv.Rule) 3804 .data(function() { return thisObject.y.ticks(); }) 3805 .visible(function() { return !(this.parent.index % 2); }) 3806 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 3807 .strokeStyle("rgba(128,128,128,.2)") 3808 .anchor("left").add(pv.Label) 3809 .text(function(d) {return d.toFixed() + thisObject.ySuffix(); }) 3810 .font(function() { return thisObject.labelFont(); }) 3811 .textStyle("rgba(128,128,128,0.5)"); 3812 3813 this.vis.add(pv.Label) 3814 .left(this.width() / 2) 3815 .visible(function() { return !(thisObject.title() === ""); }) 3816 .top(16) 3817 .textAlign("center") 3818 .text(function() { return thisObject.title(); }) 3819 .font(function() { return thisObject.titleFont(); }); 3820 }; 3821 3822 /** 3823 * @private 3824 */ 3825 wso2vis.s.chart.protovis.AreaChart2.prototype.titleSpacing = function () { 3826 if(this.title() === "") { 3827 return 1; 3828 } 3829 else { 3830 return 0.9; 3831 } 3832 }; 3833 3834 /** 3835 * @private 3836 */ 3837 wso2vis.s.chart.protovis.AreaChart2.prototype.populateData = function (thisObject) { 3838 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3839 var tempDataArray = []; 3840 3841 var dataGrpCount = 1; 3842 if( _dataField instanceof Array ) { 3843 dataGrpCount = _dataField.length; 3844 } 3845 3846 thisObject.formattedData = pv.range(dataGrpCount).map(genDataMap); 3847 var xMax = 0; 3848 var xMin = Infinity; 3849 3850 for (var x=0; x<thisObject.formattedData.length; x++) { 3851 var dataSet = thisObject.formattedData[x]; 3852 for (var y=0; y<dataSet.length; y++) { 3853 xMax = (xMax < dataSet[y].x) ? dataSet[y].x : xMax; 3854 xMin = (xMin > dataSet[y].x) ? dataSet[y].x : xMin; 3855 //TODO clean up this. we need only one data set 3856 thisObject.customXticks[y] = dataSet[y].x; 3857 } 3858 } 3859 3860 var maxheight = tempDataArray.max(); 3861 if (maxheight < 5) maxheight = 5; // fixing value repeating issue. 3862 if (thisObject.xDataValue() === undefined) { 3863 thisObject.x.domain(0, thisObject.band()).range(0, this.width()); 3864 } 3865 else { 3866 //thisObject.x.domain(thisObject.formattedData[0], function(d) { return d.x; }).range(0, this.width()); 3867 thisObject.x.domain(xMin, xMax).range(0, this.width()); 3868 } 3869 thisObject.y.domain(0, maxheight).range(0, (thisObject.height() * thisObject.titleSpacing()) - 35); 3870 thisObject.y.nice(); 3871 3872 function genDataMap(x) { 3873 var innerArray = []; 3874 var rootObja; 3875 if( _dataField instanceof Array ) { 3876 rootObja = _dataField[x]; 3877 } 3878 else { 3879 rootObja = _dataField; 3880 } 3881 3882 var _subDataField = thisObject.traverseToDataField(rootObja, thisObject.subDataField()); 3883 3884 var subDataGrpCount = 1; 3885 if( _subDataField instanceof Array ) { 3886 subDataGrpCount = _subDataField.length; 3887 } 3888 3889 for(var y=0; y<subDataGrpCount; y++) { 3890 var rootObjb; 3891 if( _subDataField instanceof Array ) { 3892 rootObjb = _subDataField[y]; 3893 } 3894 else { 3895 rootObjb = _subDataField; 3896 } 3897 3898 var valObjY = parseInt(thisObject.traverseToDataField(rootObjb, thisObject.yDataValue())); 3899 tempDataArray.push(valObjY); 3900 3901 if (thisObject.xDataValue() === undefined) { 3902 innerArray.push(valObjY); 3903 } 3904 else { 3905 var valObjX = parseInt(thisObject.traverseToDataField(rootObjb, thisObject.xDataValue())); 3906 innerArray.push({ x: valObjX, y: valObjY }); 3907 } 3908 } 3909 return innerArray; 3910 } 3911 }; 3912 3913 wso2vis.s.chart.protovis.AreaChart2.prototype.getData = function (thisObject) { 3914 return thisObject.formattedData; 3915 }; 3916 3917 wso2vis.s.chart.protovis.AreaChart2.prototype.update = function () { 3918 this.populateData(this); 3919 this.vis.render(); 3920 if(this.tooltip() === true) { 3921 tooltip.init(); 3922 } 3923 }; 3924 3925 wso2vis.s.chart.protovis.AreaChart2.prototype.getDataLabel = function (i) { 3926 if (this.data !== null){ 3927 var rootObj = this.traverseToDataField(this.data, this.dataField()); 3928 if( rootObj instanceof Array ) { 3929 return this.traverseToDataField(rootObj[i], this.dataLabel()); 3930 } 3931 else { 3932 return this.traverseToDataField(rootObj, this.dataLabel()); 3933 } 3934 } 3935 return i; 3936 }; 3937 3938 //Class c.protovis.LineChart : AreaChart 3939 //This is the custom wrapper class for protovis area/line charts 3940 3941 //Constructor 3942 wso2vis.s.chart.protovis.LineChart = function(div, chartTitle, chartDesc) { 3943 wso2vis.s.chart.protovis.AreaChart.call(this, div, chartTitle, chartDesc); 3944 } 3945 3946 // this makes c.protovis.LineChart.prototype inherit from ProtovisStakedAreaChart 3947 wso2vis.extend(wso2vis.s.chart.protovis.LineChart, wso2vis.s.chart.protovis.AreaChart); 3948 3949 //Public function load 3950 //Loads the chart inside the given HTML element 3951 wso2vis.s.chart.protovis.LineChart.prototype.load = function (w, h, band) { 3952 if ( w !== undefined ) { 3953 this.width(w); 3954 } 3955 if ( h !== undefined ) { 3956 this.height(h); 3957 } 3958 if ( band !== undefined ) { 3959 this.band(band); 3960 } 3961 3962 var thisObject = this; 3963 3964 this.x = pv.Scale.linear(0, this.band).range(0, this.width()); 3965 this.y = pv.Scale.linear(0, 50).range(0, this.height()*0.9); 3966 3967 this.vis = new pv.Panel() 3968 .canvas(function() { return thisObject.divEl(); }) 3969 .width(function() { return thisObject.width(); }) 3970 .height(function() { return thisObject.height(); }) 3971 .def("i", -1) 3972 .bottom(20) 3973 .top(0) 3974 .left(30) 3975 .right(10); 3976 3977 var panel = this.vis.add(pv.Panel) 3978 .top(function() { return (thisObject.height() * (1 - thisObject.titleSpacing())); }) 3979 .height(function() { return (thisObject.height() * thisObject.titleSpacing()); }) 3980 .data(function() { return thisObject.getData(thisObject); }); 3981 3982 var line = panel.add(pv.Line) 3983 .data(function(a) { return a; }) 3984 //.left(function(d) { return thisObject.x(this.index); }) 3985 .left(function(d) 3986 { 3987 if (thisObject.dirFromLeft()) 3988 return thisObject.x(this.index); 3989 return thisObject.x((thisObject.dataHistory[this.parent.index].length <= thisObject.band()) ? (thisObject.band() - thisObject.dataHistory[this.parent.index].length) + this.index + 1: this.index); 3990 }) 3991 .bottom(function(d) { return thisObject.y(d); }) 3992 .lineWidth(3) 3993 .title(function() { 3994 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 3995 if( dataObj instanceof Array ) { 3996 return thisObject.onTooltip(dataObj[this.parent.index]); 3997 } 3998 else { 3999 return thisObject.onTooltip(dataObj); 4000 } 4001 }) 4002 .event("click", function() { 4003 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 4004 if( dataObj instanceof Array ) { 4005 return thisObject.onClick(dataObj[this.parent.index]); 4006 } 4007 else { 4008 return thisObject.onClick(dataObj); 4009 } 4010 }); 4011 4012 var lineDot = line.add(pv.Dot).title(function(d) { return d; }) 4013 .visible(function() { return thisObject.marks(); }) 4014 .fillStyle(function() { return this.strokeStyle(); }); 4015 //.add(pv.Label); 4016 4017 line.add(pv.Dot).title(function(d) { return d; }) 4018 .visible(function() { return thisObject.marks(); }) 4019 .strokeStyle("#fff") 4020 .lineWidth(1); 4021 4022 /* Legend */ 4023 panel.add(pv.Dot) 4024 .visible(function() { return thisObject.legend(); }) 4025 .right(100) 4026 .fillStyle(function() { return line.strokeStyle(); }) 4027 .bottom(function() { return (this.parent.index * 15) + 10; }) 4028 .size(20) 4029 .lineWidth(1) 4030 .strokeStyle("#000") 4031 .anchor("right").add(pv.Label) 4032 .text(function() { return thisObject.getDataLabel(this.parent.index); }); 4033 4034 panel.add(pv.Rule) 4035 .data(function() { return thisObject.x.ticks(); }) 4036 //.visible(function(d) { return (d > 0); }) 4037 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 4038 .strokeStyle("rgba(128,128,128,.1)") 4039 .add(pv.Rule) 4040 .bottom(-2) 4041 .height(5) 4042 .strokeStyle("rgba(128,128,128,1)") 4043 .anchor("bottom").add(pv.Label) 4044 .textMargin(10) 4045 .text(function(d) { var n = new Number(((thisObject.dirFromLeft())? d : thisObject.band() - d) * thisObject.xInterval() / 1000); return n.toFixed() + thisObject.xSuffix(); }) 4046 .font(function() { return thisObject.labelFont(); }) 4047 .textStyle("rgba(128,128,128,0.5)"); 4048 4049 panel.add(pv.Rule) 4050 .data(function() { return thisObject.y.ticks(); }) 4051 //.visible(function() { return !(this.index % 2); }) 4052 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 4053 .strokeStyle("rgba(128,128,128,.2)") 4054 .add(pv.Rule) 4055 .left(-5) //TODO right(5) 4056 .width(5) 4057 .strokeStyle("rgba(128,128,128,1)") 4058 .anchor("left").add(pv.Label) //TODO right 4059 .textMargin(10) 4060 .text(function(d) {return d.toFixed() + thisObject.ySuffix(); }) 4061 .font(function() { return thisObject.labelFont(); }) 4062 .textStyle("rgba(128,128,128,0.5)"); 4063 4064 this.vis.add(pv.Label) 4065 .left(this.width() / 2) 4066 .visible(function() { return !(thisObject.title() === ""); }) 4067 .top(16) 4068 .textAlign("center") 4069 .text(function() { return thisObject.title(); }) 4070 .font(function() { return thisObject.titleFont(); }); 4071 }; 4072 4073 //Class c.protovis.LineChart2 : AreaChart2 4074 //This is the custom wrapper class for protovis area/line charts 4075 4076 //Constructor 4077 wso2vis.s.chart.protovis.LineChart2 = function(div, chartTitle, chartDesc) { 4078 wso2vis.s.chart.protovis.AreaChart2.call(this, div, chartTitle, chartDesc); 4079 } 4080 4081 // this makes c.protovis.LineChart2.prototype inherit from ProtovisStakedAreaChart 4082 wso2vis.extend(wso2vis.s.chart.protovis.LineChart2, wso2vis.s.chart.protovis.AreaChart2); 4083 4084 //Public function load 4085 //Loads the chart inside the given HTML element 4086 wso2vis.s.chart.protovis.LineChart2.prototype.load = function (w, h) { 4087 if ( w !== undefined ) { 4088 this.width(w); 4089 } 4090 if ( h !== undefined ) { 4091 this.height(h); 4092 } 4093 4094 var thisObject = this; 4095 4096 this.x = pv.Scale.linear(0, 4).range(0, this.width()); 4097 this.y = pv.Scale.linear(0, 50).range(0, this.height()*0.9); 4098 this.customXticks = []; 4099 4100 this.vis = new pv.Panel() 4101 .canvas(function() { return thisObject.divEl(); }) 4102 .width(function() { return thisObject.width(); }) 4103 .height(function() { return thisObject.height(); }) 4104 .def("i", -1) 4105 .bottom(160) 4106 .top(0) 4107 .left(30) 4108 .right(60); 4109 4110 var panel = this.vis.add(pv.Panel) 4111 .top(function() { return (thisObject.height() * (1 - thisObject.titleSpacing())); }) 4112 .height(function() { return (thisObject.height() * thisObject.titleSpacing()); }) 4113 .data(function() { return thisObject.getData(thisObject); }); 4114 4115 var line = panel.add(pv.Line) 4116 .data(function(a) { return a; }) 4117 .left(function(d) { return thisObject.x(d.x); }) 4118 .bottom(function(d) { return thisObject.y(d.y); }) 4119 .lineWidth(3) 4120 .title(function() { 4121 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 4122 if( dataObj instanceof Array ) { 4123 return thisObject.onTooltip(dataObj[this.parent.index]); 4124 } 4125 else { 4126 return thisObject.onTooltip(dataObj); 4127 } 4128 }) 4129 .event("click", function() { 4130 var dataObj = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 4131 if( dataObj instanceof Array ) { 4132 return thisObject.onClick(dataObj[this.parent.index]); 4133 } 4134 else { 4135 return thisObject.onClick(dataObj); 4136 } 4137 }); 4138 4139 var lineDot = line.add(pv.Dot).title(function(d) { return d.y; }) 4140 .visible(function() { return thisObject.marks(); }) 4141 .fillStyle(function() { return this.strokeStyle(); }); 4142 //.add(pv.Label); 4143 4144 line.add(pv.Dot).title(function(d) { return d.y; }) 4145 .visible(function() { return thisObject.marks(); }) 4146 .strokeStyle("#fff") 4147 .lineWidth(1); 4148 4149 /* Legend */ 4150 panel.add(pv.Dot) 4151 .visible(function() { return thisObject.legend(); }) 4152 .right(150) 4153 .fillStyle(function() { return line.strokeStyle(); }) 4154 .bottom(function() { return (this.parent.index * 15) + 10; }) 4155 .size(20) 4156 .lineWidth(1) 4157 .strokeStyle("#000") 4158 .anchor("right").add(pv.Label) 4159 .text(function() { return thisObject.getDataLabel(this.parent.index); }); 4160 4161 panel.add(pv.Rule) 4162 .data(function() { return thisObject.customXticks; /*thisObject.x.ticks()*/ }) 4163 .visible(function(d) { return (d >= 0); }) 4164 .left(function(d) { return (Math.round(thisObject.x(d)) - 0.5); }) 4165 .strokeStyle("rgba(128,128,128,.1)") 4166 .add(pv.Rule) 4167 .bottom(-2) 4168 .height(5) 4169 .strokeStyle("rgba(128,128,128,1)") 4170 .anchor("bottom").add(pv.Label) 4171 .textMargin(5) 4172 .textBaseline("top") 4173 .textAlign("left") 4174 .textAngle(Math.PI / 3) 4175 .text(function(d) { return thisObject.formatDataLabel( thisObject.traverseToDataField(thisObject.traverseToDataField(thisObject.traverseToDataField(thisObject.data, thisObject.dataField())[this.parent.index], thisObject.subDataField())[this.index], thisObject.xLabel()) ) + thisObject.xSuffix(); }) 4176 .font(function() { return thisObject.labelFont(); }) 4177 .textStyle("rgba(128,128,128,0.5)"); 4178 4179 panel.add(pv.Rule) 4180 .data(function() { return thisObject.y.ticks(); }) 4181 //.visible(function() { return !(this.index % 2); }) 4182 .bottom(function(d) { return (Math.round(thisObject.y(d)) - 0.5); }) 4183 .strokeStyle("rgba(128,128,128,.2)") 4184 .add(pv.Rule) 4185 .left(-5) 4186 .width(5) 4187 .strokeStyle("rgba(128,128,128,1)") 4188 .anchor("left").add(pv.Label) 4189 .textMargin(10) 4190 .text(function(d) {return d.toFixed() + thisObject.ySuffix(); }) 4191 .font(function() { return thisObject.labelFont(); }) 4192 .textStyle("rgba(128,128,128,0.5)"); 4193 4194 this.vis.add(pv.Label) 4195 .left(this.width() / 2) 4196 .visible(function() { return !(thisObject.title() === ""); }) 4197 .top(16) 4198 .textAlign("center") 4199 .text(function() { return thisObject.title(); }) 4200 .font(function() { return thisObject.titleFont(); }); 4201 }; 4202 4203 wso2vis.s.chart.protovis.LineChart2.prototype.formatDataLabel = function (label) { 4204 4205 return label; 4206 }; 4207 //@class wso2vis.s.chart.protovis.Sunburst : wso2vis.s.chart.Chart 4208 4209 //Constructor 4210 wso2vis.s.chart.protovis.Sunburst = function(canvas, chartTitle, chartDesc) { 4211 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 4212 4213 this.labelLength(12) 4214 .thickness(30); 4215 4216 /* @private */ 4217 this.vis = null; 4218 this.sunburst = null; 4219 this.wedge = null; 4220 4221 this.flare = { 4222 analytics: { 4223 cluster: { 4224 AgglomerativeCluster: 3938, 4225 CommunityStructure: 3812, 4226 HierarchicalCluster: 6714, 4227 MergeEdge: 743 4228 }, 4229 graph: { 4230 BetweennessCentrality: 3534, 4231 LinkDistance: 5731, 4232 MaxFlowMinCut: 7840, 4233 ShortestPaths: 5914, 4234 SpanningTree: 3416 4235 }, 4236 optimization: { 4237 AspectRatioBanker: 7074 4238 } 4239 } 4240 }; 4241 } 4242 4243 // this makes c.protovis.Sunburst.prototype inherits from wso2vis.s.chart.Chart 4244 wso2vis.extend(wso2vis.s.chart.protovis.Sunburst, wso2vis.s.chart.Chart); 4245 4246 wso2vis.s.chart.protovis.Sunburst.prototype 4247 .property("dataField") 4248 .property("dataValue") 4249 .property("dataLabel") 4250 .property("labelLength") 4251 .property("thickness"); 4252 4253 //Public function load 4254 //Loads the chart inside the given HTML element 4255 wso2vis.s.chart.protovis.Sunburst.prototype.load = function (w) { 4256 if ( w !== undefined ) { 4257 this.width(w); 4258 } 4259 /*if ( h !== undefined ) { //not using height for the Wedge 4260 this.height(h); 4261 }*/ 4262 var r = this.width() / 2.5; 4263 4264 var thisObject = this; 4265 4266 //this.sunburst = pv.Layout.sunburst(this.data).size(Number); 4267 4268 this.vis = new pv.Panel() 4269 //.def("i", -1) 4270 .canvas(function() { return thisObject.divEl(); }) 4271 .width(function() { return thisObject.width(); }) 4272 .height(function() { return thisObject.height(); }); 4273 4274 this.wedge = this.vis.add(pv.Wedge) 4275 .extend(pv.Layout.sunburst(this.formattedData).size(function(n) { return parseInt(n); })) 4276 .fillStyle(pv.Colors.category10() 4277 .by(function(n) { return n.children ? n.keys : n.keys.slice(0, -1); })) 4278 .strokeStyle("#222") 4279 .lineWidth(1) 4280 //.visible(function(n) { return n.depth < 3; }) 4281 .title(function(n) { return /*thisObject.traverseToDataField(thisObject.data, n.keys)*/ n.keys.join(".") + ": " + n.size; }); 4282 //.anchor("center").add(pv.Label) 4283 //.visible(function(n) { return n.angle * n.depth > .05; }) 4284 //.text(function(n) { return n.keys[n.keys.length - 1]; }); 4285 4286 this.vis.add(pv.Label) 4287 .left(this.width() / 2) 4288 .visible(function() { return !(thisObject.title() === ""); }) 4289 .top(16) 4290 .textAlign("center") 4291 .text(function() { return thisObject.title(); }) 4292 .font(function() { return thisObject.titleFont(); }); 4293 }; 4294 4295 /** 4296 * @private 4297 */ 4298 wso2vis.s.chart.protovis.Sunburst.prototype.titleSpacing = function () { 4299 if(this.title() === "") { 4300 return 1; 4301 } 4302 else { 4303 return 0.9; 4304 } 4305 }; 4306 4307 /** 4308 * @private 4309 */ 4310 wso2vis.s.chart.protovis.Sunburst.prototype.populateData = function (thisObject) { 4311 4312 rec(this.data); 4313 //console.log(this.data); 4314 this.formattedData = this.data; 4315 4316 function rec(d) { 4317 for( i in d ) { 4318 if( typeof(d[i]) == "string" && isNaN(d[i]) ) { 4319 d[i] = 0; 4320 } 4321 rec(d[i]); 4322 } 4323 } 4324 }; 4325 4326 wso2vis.s.chart.protovis.Sunburst.prototype.getData = function (thisObject) { 4327 4328 return thisObject.formattedData; 4329 }; 4330 4331 wso2vis.s.chart.protovis.Sunburst.prototype.update = function () { 4332 4333 this.populateData(this); 4334 this.wedge.extend(pv.Layout.sunburst(this.formattedData).size(function(n) { return parseInt(n); })); 4335 //this.sunburst.size(Number);//console.log(JSON.stringify(this.data)); 4336 this.vis.render(); 4337 if(this.tooltip() === true) { 4338 tooltip.init(); 4339 } 4340 }; 4341 4342 wso2vis.s.chart.protovis.Sunburst.prototype.getDataLable = function (i) { 4343 4344 if (this.data !== null){ 4345 4346 var rootObj = this.traverseToDataField(this.data, this.dataField()); 4347 if( rootObj instanceof Array ) { 4348 return this.traverseToDataField(rootObj[i], this.dataLabel()); 4349 } 4350 else { 4351 return this.traverseToDataField(rootObj, this.dataLabel()); 4352 } 4353 } 4354 4355 return i; 4356 }; 4357 4358 wso2vis.s.chart.raphael.FunnelChart = function(canvas, chartTitle, chartDesc) { 4359 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 4360 4361 this.colscheme(20) 4362 .gap(4) 4363 .labelRelief(15) 4364 .labelSpan(1) 4365 .showPercent(true) 4366 .showValue(true); 4367 } 4368 4369 // inherits from Chart 4370 wso2vis.extend(wso2vis.s.chart.raphael.FunnelChart, wso2vis.s.chart.Chart); 4371 4372 wso2vis.s.chart.raphael.FunnelChart.prototype 4373 .property("colscheme") 4374 .property("dataField") 4375 .property("dataValue") 4376 .property("dataLabel") 4377 .property("gap") 4378 .property("showPercent") 4379 .property("showValue") 4380 .property("labelRelief") 4381 .property("labelSpan"); 4382 4383 4384 wso2vis.s.chart.raphael.FunnelChart.prototype.load = function (w, h) { 4385 if (w !== undefined) { 4386 this.width(w); 4387 } 4388 if (h !== undefined) { 4389 this.height(h); 4390 } 4391 4392 this.r = Raphael(this.divEl(), this.width(), this.height()); 4393 4394 this.wf = this.width() / 406.01; 4395 this.hf = this.height() / 325.01; 4396 this.eh = 1007.9 * this.hf; 4397 this.ew = 663 * this.wf; 4398 this.e1x = -560 * this.wf + 5; 4399 this.e2x = 173 * this.wf + 5; 4400 this.ey = -136 * this.hf; 4401 this.fc = 139 * this.wf + 5; 4402 4403 return this; 4404 }; 4405 4406 wso2vis.s.chart.raphael.FunnelChart.prototype.update = function () { 4407 this.convertData(this); 4408 4409 var total = 0; 4410 4411 for (var i = 0; i < this.formattedData.length; i++) { 4412 total += this.formattedData[i]["value"]; 4413 } 4414 4415 var funnelHeightRatio = (this.height() - this.gap() * (this.formattedData.length - 1) - this.labelRelief() * this.formattedData.length) / total; 4416 4417 var colors = wso2vis.util.generateColors(this.formattedData.length, this.colscheme()); 4418 4419 var is_label_visible = false, 4420 leave_timer; 4421 4422 var currY = 0; 4423 var df = this.traverseToDataField(this.data, this.dataField()); 4424 if (df instanceof Array) { 4425 df = df; 4426 } 4427 else { 4428 df = [df]; 4429 } 4430 4431 var first; 4432 4433 for (i = 0; i < this.formattedData.length; i++) { 4434 var crect; 4435 if (i != 0) { 4436 this.r.rect(0, currY, this.width(), this.gap()).attr({fill:"#fff", stroke:"#fff"}); 4437 crect = this.r.rect(0, currY + this.gap(), this.width(), funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief()).attr({fill:colors[i], stroke:"#fff"}); 4438 currY += this.gap() + funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(); 4439 } 4440 else { 4441 crect = this.r.rect(0, 0, this.width(), funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief()).attr({fill:colors[i], stroke:"#fff"}); 4442 currY += funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(); 4443 first = this.formattedData[i]["value"]; 4444 } 4445 4446 if (this.tooltip()) { 4447 (function (data, lbl, func, org) { 4448 $(crect.node).hover(function (e) { 4449 clearTimeout(leave_timer); 4450 var tip = func({label:lbl, value:data, total:total, first:first, raw:org}); 4451 wso2vis.environment.tooltip.show(e.pageX, e.pageY, tip); 4452 is_label_visible = true; 4453 }, function () { 4454 leave_timer = setTimeout(function () { 4455 wso2vis.environment.tooltip.hide(); 4456 is_label_visible = false; 4457 }, 2); 4458 }); 4459 })(this.formattedData[i]["value"], this.formattedData[i]["label"], this.onTooltip, df[i]);//(this.fc - frame.attrs.width/2 , crect.attrs.y + crect.attrs.height, this.formattedData[i]["value"], this.formattedData[i]["label"]); 4460 4461 (function (data, lbl, func, org) { 4462 $(crect.node).mousemove(function (e) { 4463 if (is_label_visible) { 4464 clearTimeout(leave_timer); 4465 var tip = func({label:lbl, value:data, total:total, first:first, raw:org}); 4466 wso2vis.environment.tooltip.show(e.pageX, e.pageY, tip); 4467 } 4468 }); 4469 })(this.formattedData[i]["value"], this.formattedData[i]["label"], this.onTooltip, df[i]);//(this.fc - frame.attrs.width/2 , crect.attrs.y + crect.attrs.height, this.formattedData[i]["value"], this.formattedData[i]["label"]); 4470 } 4471 } 4472 4473 var el1 = this.r.ellipse(-560 * this.wf + 5 + 663 * this.wf / 2, -136 * this.hf + 1007.9 * this.hf / 2, 663 * this.wf / 2, 1007.9 * this.hf / 2); 4474 var el2 = this.r.ellipse(173 * this.wf + 5 + 663 * this.wf / 2, -136 * this.hf + 1007.9 * this.hf / 2, 663 * this.wf / 2, 1007.9 * this.hf / 2); 4475 4476 el1.attr({fill:"#fff", opacity:0.9, stroke:"#fff"}); 4477 el2.attr({fill:"#fff", opacity:0.8, stroke:"#fff"}); 4478 4479 currY = 0; 4480 for (i = 0; i < this.formattedData.length; i++) { 4481 var t2; 4482 if (i != 0) { 4483 var t = this.r.text(this.width(), currY + this.gap() + funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(), this.formattedData[i]["label"]).attr({fill:colors[i]}); 4484 t.attr({"font-size":12}); 4485 var bbox = t.getBBox(); 4486 t.translate(-bbox.width/2 - 2 * this.labelSpan(), -bbox.height/2 - this.labelSpan()); 4487 var str = this.showValue()?this.formattedData[i]["value"]:""; 4488 if ((this.formattedData[0]["value"] != 0) && this.showPercent()) { 4489 str += "(" + (this.formattedData[i]["value"] * 100/ this.formattedData[0]["value"]).toFixed() + "%)"; 4490 } 4491 t2 = this.r.text(this.fc, currY + this.gap() + funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(), str).attr({fill:"#fff"}); 4492 t2.attr({"font-size":10}); 4493 bbox = t2.getBBox(); 4494 t2.translate(0, -bbox.height/2 - this.labelSpan()); 4495 currY += this.gap() + funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(); 4496 } 4497 else { 4498 var t = this.r.text(this.width(), funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(), this.formattedData[i]["label"]).attr({fill:colors[i]}); 4499 t.attr({"font-size":12}); 4500 var bbox = t.getBBox(); 4501 t.translate(-bbox.width/2 - 2 * this.labelSpan(), -bbox.height/2 - this.labelSpan()); 4502 var str = this.showValue()?this.formattedData[i]["value"]:""; 4503 if ((this.formattedData[0]["value"] != 0) && this.showPercent()) { 4504 str += "(" + (this.formattedData[i]["value"] * 100/ this.formattedData[0]["value"]).toFixed() + "%)"; 4505 } 4506 t2 = this.r.text(this.fc, funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(), str).attr({fill:"#fff"}); 4507 t2.attr({"font-size":10}); 4508 bbox = t2.getBBox(); 4509 t2.translate(0, -bbox.height/2 - this.labelSpan()); 4510 currY += funnelHeightRatio * this.formattedData[i]["value"] + this.labelRelief(); 4511 } 4512 } 4513 this.r.rect(0, 0, this.width()-1, this.height()-1); 4514 }; 4515 4516 wso2vis.s.chart.raphael.FunnelChart.prototype.convertData = function (that) { 4517 var df = that.traverseToDataField(that.data, that.dataField()); 4518 var dcount = 1; 4519 if (df instanceof Array) { 4520 dcount = df.length; 4521 } 4522 4523 that.formattedData = []; 4524 4525 for (var i = 0; i < dcount; i++) { 4526 that.formattedData.push({"label":getLbl(i), "value":getVal(i)}); 4527 } 4528 4529 function getVal(x) { 4530 var r; 4531 if (df instanceof Array) { 4532 r = df[x]; 4533 } 4534 else { 4535 r = df; 4536 } 4537 return parseInt(that.traverseToDataField(r, that.dataValue())); 4538 } 4539 4540 function getLbl(x) { 4541 var r; 4542 if (df instanceof Array) { 4543 r = df[x]; 4544 } 4545 else { 4546 r = df; 4547 } 4548 return that.traverseToDataField(r, that.dataLabel()); 4549 } 4550 }; 4551 4552 wso2vis.s.chart.raphael.FunnelChart.prototype.onTooltip = function (data) { 4553 return data.label + ":" + data.value; 4554 }; 4555 4556 4557 4558 4559 //Class c.infovis.SpaceTree : Chart 4560 //This is the custom wrapper class for protovis bar charts 4561 4562 //Constructor 4563 wso2vis.s.chart.infovis.SpaceTree = function(divElementLog, canvas, chartTitle, chartDesc) { 4564 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 4565 4566 /* @private */ 4567 this.divElementLog = divElementLog; 4568 this.canvas = canvas; 4569 this.st = null; 4570 this.y = null; 4571 this.x = null; 4572 this.tip = new wso2vis.c.Tooltip(); 4573 this.testLabel = null; 4574 this.edgeLabelArray = null; 4575 }; 4576 4577 //this makes c.infovis.SpaceTree.prototype inherits 4578 //from Chart.prototype 4579 wso2vis.extend(wso2vis.s.chart.infovis.SpaceTree, wso2vis.s.chart.Chart); 4580 4581 wso2vis.s.chart.infovis.SpaceTree.prototype 4582 .property("dataField") 4583 .property("dataValue") 4584 .property("dataLabel") 4585 .property("ySuffix") 4586 .property("xSuffix"); 4587 4588 4589 ST.Plot.EdgeTypes.implement({ 4590 'custom-line': function(adj, canvas) { 4591 //plot arrow edge 4592 this.edgeTypes.arrow.call(this, adj, canvas); 4593 //get nodes cartesian coordinates 4594 var pos = adj.nodeFrom.pos.getc(true); 4595 var posChild = adj.nodeTo.pos.getc(true); 4596 //check for edge label in data 4597 var data = adj.nodeTo.data; 4598 if(data.labelid && data.labeltext) { 4599 var domlabel = document.getElementById(data.labelid); 4600 //if the label doesn't exist create it and append it 4601 //to the label container 4602 if(!domlabel) { 4603 var domlabel= document.createElement('div'); 4604 domlabel.id = data.labelid; 4605 domlabel.innerHTML = data.labeltext; 4606 //add some custom style 4607 var style = domlabel.style; 4608 style.position = 'absolute'; 4609 style.color = '#00f'; 4610 style.fontSize = '9px'; 4611 //append the label to the labelcontainer 4612 this.getLabelContainer().appendChild(domlabel); 4613 4614 } 4615 4616 //now adjust the label placement 4617 var radius = this.viz.canvas.getSize(); 4618 domlabel.style.left = parseInt((pos.x + posChild.x + radius.width - domlabel.offsetWidth) /2) + 'px'; 4619 domlabel.style.top = parseInt((pos.y + posChild.y + radius.height) /2) + 'px'; 4620 } 4621 } 4622 }); 4623 4624 4625 //Public function loadChart 4626 //Loads the chart inside the given HTML element 4627 wso2vis.s.chart.infovis.SpaceTree.prototype.load = function (w, h) { 4628 4629 if (w !== undefined) { 4630 this.width(w); 4631 } 4632 if (h !== undefined) { 4633 this.height(h); 4634 } 4635 4636 that = this; 4637 var Log = { 4638 elem: false, 4639 write: function(text){ 4640 if (!this.elem) 4641 this.elem = that.divElementLog; 4642 this.elem.innerHTML = text; 4643 this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; 4644 } 4645 }; 4646 //init canvas 4647 //Create a new canvas instance. 4648 var canvas = new Canvas('mycanvas', { 4649 'injectInto': that.canvas, 4650 'width': that.width(), 4651 'height': that.height(), 4652 'backgroundColor': '#1a1a1a' 4653 }); 4654 //end 4655 4656 //init st 4657 //Create a new ST instance 4658 this.st = new ST(canvas, { 4659 //set duration for the animation 4660 orientation: "top", 4661 duration: 400, 4662 //set animation transition type 4663 transition: Trans.Quart.easeInOut, 4664 //set distance between node and its children 4665 levelDistance: 60, 4666 //set node and edge styles 4667 //set overridable=true for styling individual 4668 //nodes or edges 4669 Node: { 4670 width:20, 4671 type: 'none', 4672 color: '#aaa', 4673 overridable: true 4674 }, 4675 4676 Edge: { 4677 type: 'arrow', 4678 overridable: true 4679 4680 4681 }, 4682 4683 onBeforeCompute: function(node){ 4684 4685 // Log.write("loading " + node.name); 4686 }, 4687 4688 onAfterCompute: function(){ 4689 //Log.write("done"); 4690 }, 4691 4692 //This method is called on DOM label creation. 4693 //Use this method to add event handlers and styles to 4694 //your node. 4695 onCreateLabel: function(label, node){ 4696 label.id = node.id; 4697 label.innerHTML = node.name; 4698 label.onclick = function(){ 4699 that.st.onClick(node.id); 4700 4701 // Log.write("Done"); 4702 }; 4703 label.onmouseover = function(e){ 4704 that.tip.show(e.pageX, e.pageY, node.name); 4705 // Log.write("mouse is over the" + node.name + "label, triggering mouse event : " + e.toString()); 4706 }; 4707 label.onmouseout = function () { 4708 that.tip.hide(); 4709 }; 4710 //set label styles 4711 var style = label.style; 4712 style.width = 10 + 'px'; 4713 style.height = 17 + 'px'; 4714 style.cursor = 'pointer'; 4715 style.color = '#333'; 4716 style.fontSize = '0.8em'; 4717 style.textAlign= 'center'; 4718 style.paddingTop = '4px'; 4719 style.paddingLeft = '3px'; 4720 }, 4721 4722 //This method is called right before plotting 4723 //a node. It's useful for changing an individual node 4724 //style properties before plotting it. 4725 //The data properties prefixed with a dollar 4726 //sign will override the global node style properties. 4727 onBeforePlotNode: function(node){ 4728 //add some color to the nodes in the path between the 4729 //root node and the selected node. 4730 4731 if (node.selected) { 4732 node.data.$color = "#ff7"; 4733 } 4734 else { 4735 delete node.data.$color; 4736 var GUtil = Graph.Util; 4737 //if the node belongs to the last plotted level 4738 if(!GUtil.anySubnode(node, "exist")) { 4739 //count children number 4740 var count = 0; 4741 GUtil.eachSubnode(node, function(n) { count++; }); 4742 //assign a node color based on 4743 //how many children it has 4744 node.data.$color = ['#aaa', '#baa', '#caa', '#daa', '#eaa', '#faa'][count]; 4745 } 4746 } 4747 }, 4748 4749 //This method is called right before plotting 4750 //an edge. It's useful for changing an individual edge 4751 //style properties before plotting it. 4752 //Edge data proprties prefixed with a dollar sign will 4753 //override the Edge global style properties. 4754 onBeforePlotLine: function(adj){ 4755 if (adj.nodeFrom.selected && adj.nodeTo.selected) { 4756 adj.data.$color = "#eed"; 4757 adj.data.$lineWidth = 3; 4758 } 4759 else { 4760 delete adj.data.$color; 4761 delete adj.data.$lineWidth; 4762 } 4763 } 4764 }); 4765 4766 }; 4767 4768 4769 wso2vis.s.chart.infovis.SpaceTree.prototype.populateData = function (thisObject) { 4770 // Space Tree can only be drawn with a JSON Tree i.e. with JSON nodes 4771 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 4772 if ((_dataField instanceof Array) && (_dataField.length < 1)) { 4773 return false; 4774 } 4775 var st = thisObject.st; 4776 var lbs = st.fx.labels; 4777 4778 for (label in lbs) { 4779 if (lbs[label]) { 4780 lbs[label].parentNode.removeChild(lbs[label]); 4781 } 4782 } 4783 // for (edge in edges) { 4784 // if (edges(edge)) { 4785 // edges[edge] 4786 // } 4787 st.fx.labels = {}; 4788 // thisObject.adjustWidth(_dataField[0]); 4789 thisObject.st.loadJSON(_dataField[0]); 4790 return true; 4791 4792 }; 4793 4794 wso2vis.s.chart.infovis.SpaceTree.prototype.trim = function (txt) { 4795 if (txt.length > 20) { 4796 var str = txt.substr(0,18); 4797 str += "..."; 4798 } else { 4799 var str = txt; 4800 } 4801 return str; 4802 } 4803 4804 4805 wso2vis.s.chart.infovis.SpaceTree.prototype.getNodeDiv = function () { 4806 if (this.testLabel == null) { 4807 4808 var testLabel = this.testLabel = document.createElement('div'); 4809 testLabel.id = "mytestlabel"; 4810 testLabel.style.visibility = "hidden"; 4811 testLabel.style.position = "absolute"; 4812 testLabel.style.height = 20 + 'px'; 4813 document.body.appendChild(testLabel); 4814 return this.testLabel; 4815 } 4816 } 4817 4818 4819 4820 wso2vis.s.chart.infovis.SpaceTree.prototype.adjustWidth = function(tree) { 4821 var elem = this.getNodeDiv(); 4822 TreeUtil.each(tree, function(node) { 4823 elem.innerHTML = that.trim(node.name); 4824 node.data.$width = elem.offsetWidth; 4825 }); 4826 } 4827 4828 wso2vis.s.chart.infovis.SpaceTree.prototype.update = function () { 4829 var st = this.st; 4830 if (this.populateData(this)) { 4831 //compute node positions and layout 4832 st.compute(); 4833 //optional: make a translation of the tree 4834 st.geom.translate(new Complex(-200, 0), "startPos"); 4835 //emulate a click on the root node. 4836 st.onClick(st.root); 4837 4838 if(this.tooltip() === true) { 4839 tooltip.init(); 4840 } 4841 } 4842 }; 4843 //Class c.infovis.HyperTree : Chart 4844 //This is the custom wrapper class for protovis bar charts 4845 4846 //Constructor 4847 wso2vis.s.chart.infovis.HyperTree = function(divElementLog, canvas, chartTitle, chartDesc) { 4848 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 4849 4850 /* @private */ 4851 this.divElementLog = divElementLog; 4852 this.canvas = canvas; 4853 this.ht = null; 4854 this.y = null; 4855 this.x = null; 4856 } 4857 4858 // this makes c.infovis.HyperTree.prototype inherits 4859 // from Chart.prototype 4860 wso2vis.extend(wso2vis.s.chart.infovis.HyperTree, wso2vis.s.chart.Chart); 4861 4862 wso2vis.s.chart.infovis.HyperTree.prototype 4863 .property("dataField") 4864 .property("dataValue") 4865 .property("dataLabel") 4866 .property("ySuffix") 4867 .property("xSuffix"); 4868 4869 4870 function addEvent(obj, type, fn) { 4871 if (obj.addEventListener) obj.addEventListener(type, fn, false); 4872 else obj.attachEvent('on' + type, fn); 4873 }; 4874 4875 //Public function loadChart 4876 //Loads the chart inside the given HTML element 4877 4878 wso2vis.s.chart.infovis.HyperTree.prototype.load = function (w, h) { 4879 4880 if (w !== undefined) { 4881 this.width(w); 4882 } 4883 if (h !== undefined) { 4884 this.height(h); 4885 } 4886 4887 that = this; 4888 var Log = { 4889 elem: false, 4890 write: function(text){ 4891 if (!this.elem) 4892 this.elem = that.divElementLog; 4893 this.elem.innerHTML = text; 4894 this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; 4895 } 4896 }; 4897 4898 var canvas = new Canvas('mycanvas', { 4899 'injectInto': that.canvas, 4900 'width': that.width(), 4901 'height': that.height(), 4902 'backgroundColor': '#1a1a1a' 4903 }); 4904 4905 //end 4906 var style = document.getElementById('mycanvas').style; 4907 style.marginLeft = style.marginTop = "25px"; 4908 //init Hypertree 4909 this.ht = new Hypertree(canvas, { 4910 //Change node and edge styles such as 4911 //color, width and dimensions. 4912 Node: { 4913 dim: 9, 4914 color: "#f00" 4915 }, 4916 4917 Edge: { 4918 lineWidth: 2, 4919 color: "#024" 4920 }, 4921 4922 onBeforeCompute: function(node){ 4923 //Log.write("centering"); 4924 }, 4925 //Attach event handlers and add text to the 4926 //labels. This method is only triggered on label 4927 //creation 4928 onCreateLabel: function(domElement, node){ 4929 domElement.innerHTML = node.name; 4930 addEvent(domElement, 'click', function () { 4931 that.ht.onClick(node.id); 4932 }); 4933 }, 4934 //Change node styles when labels are placed 4935 //or moved. 4936 onPlaceLabel: function(domElement, node){ 4937 var style = domElement.style; 4938 style.display = ''; 4939 style.cursor = 'pointer'; 4940 if (node._depth <= 1) { 4941 style.fontSize = "0.8em"; 4942 style.color = "#000"; 4943 4944 } else if(node._depth == 2){ 4945 style.fontSize = "0.7em"; 4946 style.color = "#011"; 4947 4948 } else { 4949 style.display = 'none'; 4950 } 4951 4952 var left = parseInt(style.left); 4953 var w = domElement.offsetWidth; 4954 style.left = (left - w / 2) + 'px'; 4955 }, 4956 4957 onAfterCompute: function(){ 4958 // Log.write("done"); 4959 } 4960 }); 4961 4962 }; 4963 4964 4965 wso2vis.s.chart.infovis.HyperTree.prototype.populateData = function (thisObject) { 4966 // Space Tree can only be drawn with a JSON Tree i.e. with JSON nodes 4967 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 4968 if ((_dataField instanceof Array) && (_dataField.length < 1)) { 4969 return false; 4970 } 4971 var ht = thisObject.ht 4972 var lbs = ht.fx.labels; 4973 for (label in lbs) { 4974 if (lbs[label]) { 4975 lbs[label].parentNode.removeChild(lbs[label]); 4976 } 4977 } 4978 ht.fx.labels = {}; 4979 thisObject.ht.loadJSON(_dataField[0]); 4980 return true; 4981 4982 }; 4983 4984 4985 4986 wso2vis.s.chart.infovis.HyperTree.prototype.update = function () { 4987 var ht = this.ht; 4988 if (this.populateData(this)) { 4989 ht.refresh(); 4990 ht.controller.onAfterCompute(); 4991 4992 if(this.tooltip() === true) { 4993 tooltip.init(); 4994 } 4995 } 4996 }; 4997 4998 //Class s.chart.composite.CompositeChart1 : Chart 4999 //This is the custom wrapper class for protovis bar charts 5000 5001 //Constructor 5002 wso2vis.s.chart.composite.CompositeChart1 = function(canvas, chartTitle, chartDesc) { 5003 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 5004 5005 /* @private */ 5006 this.vis = null; 5007 this.y = null; 5008 this.x = null; 5009 this.chart = null; 5010 this.chartType(0); 5011 5012 5013 //this.legendText("Data 1"); 5014 } 5015 5016 // this makes s.chart.composite.CompositeChart1.prototype inherits 5017 // from Chart.prototype 5018 wso2vis.extend(wso2vis.s.chart.composite.CompositeChart1, wso2vis.s.chart.Chart); 5019 5020 wso2vis.s.chart.composite.CompositeChart1.prototype 5021 .property("dataField") 5022 .property("dataValue") 5023 .property("dataLabel") 5024 .property("ySuffix") 5025 .property("xSuffix") 5026 .property("titleTop") 5027 .property("titleLeft") 5028 .property("titleRight") 5029 .property("titleBottom") 5030 .property("xTitle") 5031 .property("yTitle") 5032 .property("legendText") 5033 .property("segmentBorderColor") 5034 .property("labelLength") 5035 .property("thickness") 5036 .property("chartType"); 5037 5038 wso2vis.s.chart.composite.CompositeChart1.prototype.load = function (w, h) { 5039 if (this.chartType() == 0) { 5040 this.chart = new wso2vis.s.chart.protovis.BarChart(this.divEl(), this.title(), this.description()); 5041 } 5042 else if (this.chartType() == 1) { 5043 this.chart = new wso2vis.s.chart.protovis.ColumnChart(this.divEl(), this.title(), this.description()); 5044 } 5045 else if (this.chartType() == 2) { 5046 this.chart = new wso2vis.s.chart.protovis.WedgeChart(this.divEl(), this.title(), this.description()); 5047 } 5048 else if (this.chartType() == 3) { 5049 this.chart = new wso2vis.s.chart.protovis.PieChart(this.divEl(), this.title(), this.description()); 5050 } 5051 5052 this.chart.dataField(this.dataField()); 5053 this.chart.dataValue(this.dataValue()); 5054 this.chart.dataLabel(this.dataLabel()); 5055 this.chart.ySuffix(this.ySuffix()); 5056 this.chart.xSuffix(this.xSuffix()); 5057 this.chart.tooltip(this.tooltip()); 5058 this.chart.legend(this.legend()); 5059 this.chart.marks(this.marks()); 5060 this.chart.width(this.width()); 5061 this.chart.height(this.height()); 5062 this.chart.titleFont(this.titleFont()); 5063 this.chart.labelFont(this.labelFont()); 5064 this.chart.legendX(this.legendX()); 5065 this.chart.legendY(this.legendY()); 5066 this.chart.paddingTop(this.paddingTop()); 5067 this.chart.paddingLeft(this.paddingLeft()); 5068 this.chart.paddingRight(this.paddingRight()); 5069 this.chart.paddingBottom(this.paddingBottom()); 5070 5071 this.chart.load(w, h); 5072 }; 5073 5074 /** 5075 * @private 5076 */ 5077 wso2vis.s.chart.composite.CompositeChart1.prototype.populateData = function (thisObject) { 5078 this.chart.populateData(thisObject.chart); 5079 }; 5080 5081 wso2vis.s.chart.composite.CompositeChart1.prototype.update = function () { 5082 this.chart.update(); 5083 }; 5084 5085 wso2vis.s.chart.composite.CompositeChart1.prototype.getDataLabel = function (i) { 5086 if (this.data !== null){ 5087 var rootObj = this.traverseToDataField(this.data, this.dataField()); 5088 if( rootObj instanceof Array ) { 5089 return this.traverseToDataField(rootObj[i], this.dataLabel()); 5090 } 5091 else { 5092 return this.traverseToDataField(rootObj, this.dataLabel()); 5093 } 5094 } 5095 5096 return i; 5097 }; 5098 5099 wso2vis.s.chart.composite.CompositeChart1.prototype.pushData = function (d) { 5100 if( this.validateData(d) ){ 5101 this.chart.data = d; 5102 this.chart.update(); 5103 } else { 5104 this.updateMessageDiv(this.messageInterceptFunction()); 5105 } 5106 }; 5107 /** 5108 * @class TreeView 5109 * @extends Subscriber 5110 */ 5111 wso2vis.s.form.TreeView = function() { 5112 wso2vis.s.Subscriber.call(this); 5113 5114 /* @private */ 5115 this.tree = null; 5116 this.data = null; 5117 }; 5118 5119 wso2vis.extend(wso2vis.s.form.TreeView, wso2vis.s.Subscriber); 5120 5121 wso2vis.s.form.TreeView.prototype 5122 .property("canvas") 5123 .property("nodeLabel") 5124 .property("nodeValue") 5125 .property("nodeChildren") 5126 .property("dataField"); 5127 5128 wso2vis.s.form.TreeView.prototype.create = function() { 5129 5130 var that = this; 5131 5132 //instantiate the TreeView control: 5133 this.tree = new YAHOO.widget.TreeView(this.canvas()); 5134 var rootNode = this.tree.getRoot(); 5135 5136 if( this.data !== null ){ 5137 //begin adding children 5138 rec(rootNode, this.data); 5139 } 5140 5141 function rec(node, data) { 5142 var children; 5143 if( data === undefined || data === null ) { 5144 return; 5145 } 5146 5147 var dataField = that.traverseToDataField(data, that.dataField()); 5148 5149 if (dataField instanceof Array) { 5150 children = dataField.length; 5151 } 5152 else { 5153 children = 1; 5154 } 5155 5156 for (var i=0; i<children; i++) { 5157 var dataObj; 5158 if ( dataField instanceof Array ){ 5159 dataObj = dataField[i]; 5160 } 5161 else { 5162 dataObj = dataField; 5163 } 5164 var nodeLabel = that.traverseToDataField(dataObj, that.nodeLabel()); 5165 var nodeValue = that.traverseToDataField(dataObj, that.nodeValue()); 5166 var nodeChildren = that.traverseToDataField(dataObj, that.nodeChildren()); 5167 5168 var dataNode = {}; 5169 dataNode.label = nodeLabel; 5170 dataNode.value = nodeValue; 5171 5172 var childNode = new YAHOO.widget.TextNode(dataNode, node, true); 5173 rec(childNode, nodeChildren); 5174 } 5175 } 5176 5177 // Expand and collapse happen prior to the actual expand/collapse, 5178 // and can be used to cancel the operation 5179 this.tree.subscribe("expand", this.onExpand); 5180 this.tree.subscribe("collapse", this.onCollapse); 5181 this.tree.subscribe("labelClick", this.onLabelClick); 5182 5183 this.tree.draw(); 5184 }; 5185 5186 wso2vis.s.form.TreeView.prototype.update = function() { var canvas = document.getElementById(this.canvas()); canvas.innerHTML = ""; 5187 5188 this.create(); }; 5189 5190 wso2vis.s.form.TreeView.prototype.onExpand = function(node) { 5191 console.log(node.index + " - " + node.label + " was expanded"); 5192 }; 5193 5194 wso2vis.s.form.TreeView.prototype.onCollapse = function(node) { 5195 console.log(node.index + " - " + node.label + " was collapsed"); 5196 }; 5197 5198 wso2vis.s.form.TreeView.prototype.onLabelClick = function(node) { 5199 console.log(node.index + " - " + node.label + " label was clicked"); 5200 }; 5201 5202 wso2vis.s.form.TreeView.prototype.pushData = function(data) { 5203 this.data = data;//console.log(data); 5204 this.update(); 5205 }; 5206 5207 wso2vis.s.form.TreeView.prototype.traverseToDataField = function (object, dataFieldArray) { 5208 var a = object; 5209 for (var i = 0; i < dataFieldArray.length; i++) { 5210 a = a[dataFieldArray[i]]; 5211 } 5212 return a; 5213 }; 5214 5215 /** 5216 * @class 5217 * Base class for all gauges 5218 */ 5219 wso2vis.s.gauge.Gauge = function (canvas, ttle, desc) { 5220 wso2vis.s.Subscriber.call(this); 5221 /* @private */ 5222 this.title(ttle) 5223 .description(desc) 5224 .divEl(canvas) 5225 .tooltip(true) 5226 //.legend(true) 5227 //.marks(false) 5228 .width(600) 5229 .height(500) 5230 //.titleFont("10px sans-serif") 5231 //.labelFont("10px sans-serif") 5232 //.legendX(0) 5233 //.legendY(0) 5234 .paddingTop(25) 5235 .paddingLeft(10) 5236 .paddingRight(60) 5237 .paddingBottom(10); 5238 5239 /* @private */ 5240 this.data = null; 5241 //this.formattedData = null; 5242 5243 wso2vis.environment.gauges.push(this); 5244 id = wso2vis.environment.gauges.length - 1; 5245 this.getID = function() { 5246 return id; 5247 }; 5248 }; 5249 5250 wso2vis.extend(wso2vis.s.gauge.Gauge, wso2vis.s.Subscriber); 5251 5252 wso2vis.s.gauge.Gauge.prototype 5253 .property("title") 5254 .property("description") 5255 .property("divEl") 5256 .property("msgDiv") 5257 .property("tooltip") 5258 //.property("legend") 5259 .property("x") 5260 .property("y") 5261 .property("width") 5262 .property("height") 5263 .property("paddingTop") 5264 .property("paddingLeft") 5265 .property("paddingRight") 5266 .property("paddingBottom") 5267 .property("anchorTop") 5268 .property("anchorLeft") 5269 .property("anchorRight") 5270 .property("anchorBottom") 5271 //.property("legendX") 5272 //.property("legendY") 5273 .property("titleFont"); 5274 //.property("labelFont") 5275 //.property("marks"); 5276 5277 wso2vis.s.gauge.Gauge.prototype.pushData = function (d) { 5278 if( this.validateData(d) ){ 5279 this.data = d; 5280 this.update(); 5281 } else { 5282 this.updateMessageDiv(this.messageInterceptFunction()); 5283 } 5284 }; 5285 5286 wso2vis.s.gauge.Gauge.prototype.validateData = function (d) { 5287 //Check whether we have valid data or not. 5288 if( d === null || d === undefined ) { 5289 return false; 5290 } 5291 else { 5292 return true; 5293 } 5294 }; 5295 5296 wso2vis.s.gauge.Gauge.prototype.update = function () { 5297 }; 5298 5299 wso2vis.s.gauge.Gauge.prototype.updateMessageDiv = function (s) { 5300 if( this.msgDiv() !== undefined ) { 5301 var msgdiv = document.getElementById(this.msgDiv()); 5302 if( msgdiv !== undefined ) { 5303 msgdiv.innerHTML = s; 5304 msgdiv.style.display = "block"; 5305 } 5306 } 5307 }; 5308 5309 wso2vis.s.gauge.Gauge.prototype.messageInterceptFunction = function () { 5310 return "Invalid Data"; 5311 }; 5312 5313 wso2vis.s.gauge.Gauge.prototype.onClick = function () { 5314 }; 5315 5316 wso2vis.s.gauge.Gauge.prototype.onTooltip = function (data) { 5317 return ""; 5318 }; 5319 5320 wso2vis.s.gauge.Gauge.prototype.onKey = function () { 5321 }; 5322 5323 wso2vis.s.gauge.Gauge.prototype.traverseToDataField = function (object, dataFieldArray) { 5324 var a = object; 5325 try { //Try catch outside the loop TODO 5326 for (var i = 0; i < dataFieldArray.length; i++) { 5327 a = a[dataFieldArray[i]]; 5328 } 5329 } 5330 catch (e) { 5331 this.updateMessageDiv(this.messageInterceptFunction()); 5332 } 5333 return a; 5334 }; 5335 5336 wso2vis.s.gauge.Gauge.prototype.getDataObject = function (dataObj, i) { 5337 if( dataObj instanceof Array ) { 5338 return dataObj[i]; 5339 } 5340 else { 5341 return dataObj; 5342 } 5343 }; 5344 5345 //Class c.raphael.Gauge1 : Gauge1 5346 //This is the custom wrapper class for protovis bar charts 5347 5348 //Constructor 5349 wso2vis.s.gauge.raphael.Gauge1 = function(canvas, chartTitle, chartDesc) { 5350 wso2vis.s.gauge.Gauge.call(this, canvas, chartTitle, chartDesc); 5351 5352 /* @private */ 5353 this.y = null; 5354 this.x = null; 5355 5356 this.r = null; // raphael page 5357 this.s = null; // needle set 5358 this.cx = 0; 5359 this.cy = 0; 5360 5361 this.minValue(0); 5362 this.maxValue(1000); 5363 this.largeTick(100); 5364 this.smallTick(10); 5365 this.minAngle(30); 5366 this.maxAngle(330); 5367 this.radius(60); 5368 5369 this.needleLength(55); 5370 this.smallTickLength(10); 5371 this.largeTickLength(15); 5372 //this.legendText("Data 1"); 5373 } 5374 5375 // this makes c.protovis.BarChart.prototype inherits 5376 // from Chart.prototype 5377 wso2vis.extend(wso2vis.s.gauge.raphael.Gauge1, wso2vis.s.gauge.Gauge); 5378 5379 wso2vis.s.gauge.raphael.Gauge1.prototype 5380 .property("dataField") 5381 .property("dataValue") 5382 .property("dataLabel") 5383 .property("ySuffix") 5384 .property("xSuffix") 5385 .property("titleTop") 5386 .property("titleLeft") 5387 .property("titleRight") 5388 .property("titleBottom") 5389 .property("xTitle") 5390 .property("yTitle") 5391 .property("legendText") 5392 .property("segmentBorderColor") 5393 5394 .property("minAngle") 5395 .property("maxAngle") 5396 .property("radius") 5397 5398 .property("minValue") 5399 .property("maxValue") 5400 .property("largeTick") 5401 .property("smallTick") 5402 .property("largeTickLength") 5403 .property("smallTickLength") 5404 .property("needleLength") 5405 5406 .property("needleColor") 5407 .property("needleBaseColor") 5408 .property("labelColor") 5409 .property("largeTickColor") 5410 .property("smallTickColor"); 5411 5412 5413 5414 //Public function load 5415 //Loads the chart inside the given HTML element 5416 wso2vis.s.gauge.raphael.Gauge1.prototype.load = function (w, h) { 5417 if ( w !== undefined ) { 5418 this.width(w); 5419 } 5420 if ( h !== undefined ) { 5421 this.height(h); 5422 } 5423 5424 this.cx = this.width() / 2; 5425 this.cy = this.height() / 2; 5426 5427 this.r = Raphael(this.divEl(), this.width(), this.height()); 5428 5429 this.drawDial(this.r, this.largeTick(), this.radius(), this.largeTickLength(), this.cx, this.cy, true); 5430 this.drawDial(this.r, this.smallTick(), this.radius(), this.smallTickLength(), this.cx, this.cy, false); 5431 5432 //drawBorder(this.r, this.radius(), this.cx, this.cy); 5433 5434 this.drawInitialNeedle(this.r, this.radius(), this.cx, this.cy); 5435 this.showTitle(); 5436 }; 5437 5438 5439 /** 5440 * @private 5441 */ 5442 wso2vis.s.gauge.raphael.Gauge1.prototype.showTitle = function() { 5443 this.r.text(this.cx, this.cy + this.radius() + 20, this.title()).attr({"stroke-width": 1, stroke: "#ccc"}); 5444 } 5445 5446 /** 5447 * @private 5448 */ 5449 wso2vis.s.gauge.raphael.Gauge1.prototype.drawDial = function(r, tick, radius, length, cx, cy, isLargeTick) { 5450 var maxValAlt = Math.floor(this.maxValue() / tick) * tick; 5451 var minValAlt = Math.ceil(this.minValue() / tick) * tick; 5452 5453 var n = Math.floor((maxValAlt - minValAlt) / tick); 5454 5455 var tickAngle = tick * (this.maxAngle() - this.minAngle()) / (this.maxValue() - this.minValue()); 5456 var startAngle = 0; 5457 if (this.minValue() >= 0) 5458 { 5459 startAngle = ((this.minValue() % tick) == 0)? 0 : (tick - this.minValue() % tick) * (this.maxAngle() - this.minAngle()) / (this.maxValue() - this.minValue()); 5460 } 5461 else 5462 { 5463 startAngle = (-this.minValue() % tick) * (this.maxAngle() - this.minAngle()) / (this.maxValue() - this.minValue()); 5464 } 5465 for (var i = 0; i <= n; i++) { 5466 var ang = (this.minAngle() + startAngle + i * tickAngle); 5467 r.path("M" + cx + " " + (cy + radius) + "L" + cx+ " " + (cy + radius - length)).attr({rotation: ang + " " + cx + " " + cy, "stroke-width": isLargeTick? 2 : 1, stroke: "#fff"}); 5468 if (isLargeTick) 5469 { 5470 /*if (minValAlt + i * tick == 0) 5471 r.text(cx, cy + radius + 10, "0").attr({rotation:ang + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5472 else 5473 r.text(cx, cy + radius + 10, minValAlt + i * tick).attr({rotation:ang + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5474 */ 5475 if (ang >= 90 && ang <= 270) { 5476 if (minValAlt + i * tick == 0) 5477 r.text(cx, cy - radius - 10, "0").attr({rotation:(ang-180) + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5478 else 5479 r.text(cx, cy - radius - 10, minValAlt + i * tick).attr({rotation:(ang-180) + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5480 } 5481 else { 5482 if (minValAlt + i * tick == 0) 5483 r.text(cx, cy + radius + 10, "0").attr({rotation:ang + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5484 else 5485 r.text(cx, cy + radius + 10, minValAlt + i * tick).attr({rotation:ang + " " + cx + " " + cy, "stroke-width": 1, stroke: "#fff"}); 5486 } 5487 5488 } 5489 5490 } 5491 } 5492 5493 /** 5494 * @private 5495 */ 5496 wso2vis.s.gauge.raphael.Gauge1.prototype.drawBorder = function(r, radius, cx, cy) { 5497 var alpha = (360 - (this.maxAngle() - this.minAngle())); 5498 var alphar = alpha * Math.PI / 180; 5499 var tx, ty; 5500 tx = cx + radius * Math.sin(alphar); 5501 ty = cy + radius * Math.cos(alphar); 5502 r.path("M320 " + (cy + radius) + " A " + radius + " " + radius + " 0 1 1 "+ tx + " " + ty).attr({rotation: this.minAngle(), "stroke-width": 1, stroke: "#fff"}); 5503 } 5504 5505 /** 5506 * @private 5507 */ 5508 wso2vis.s.gauge.raphael.Gauge1.prototype.drawInitialNeedle = function(r, radius, cx, cy) { 5509 this.s = r.set(); 5510 this.s.push(r.path("M" + cx + " " + (cy - 15) + " L" + cx + " " + (cy + this.needleLength())).attr({fill: "none", "stroke-width": 4, stroke: "#f00"})); 5511 this.s.push(r.circle(cx, cy, 5).attr({fill: "none", "stroke-width": 10, stroke: "#aaa"})); 5512 this.s.animate({rotation:this.minAngle() + " " + cx + " " + cy}, 0, "<>"); 5513 } 5514 5515 /** 5516 * @private 5517 */ 5518 wso2vis.s.gauge.raphael.Gauge1.prototype.updateNeedle = function(val) { 5519 var angle = (val - this.minValue()) * (this.maxAngle() - this.minAngle()) / (this.maxValue() - this.minValue()) + this.minAngle(); 5520 this.s.animate({rotation:angle + " " + this.cx + " " + this.cy}, 800, "<>"); 5521 } 5522 5523 /** 5524 * @private 5525 */ 5526 wso2vis.s.gauge.raphael.Gauge1.prototype.titleSpacing = function () { 5527 if(this.title() === "") { 5528 return 1; 5529 } 5530 else { 5531 return 0.9; 5532 } 5533 }; 5534 5535 /** 5536 * @private 5537 */ 5538 wso2vis.s.gauge.raphael.Gauge1.prototype.populateData = function (thisObject) { 5539 var _dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 5540 5541 var dataGrpCount = 1; 5542 if( _dataField instanceof Array ) { 5543 dataGrpCount = _dataField.length; 5544 } 5545 5546 var rootObj; 5547 if (_dataField instanceof Array ) { 5548 rootObj = _dataField[0]; 5549 } 5550 else { 5551 rootObj = _dataField; 5552 } 5553 5554 this.updateNeedle(parseInt(thisObject.traverseToDataField(rootObj, this.dataValue()))); 5555 5556 /*thisObject.formattedData = pv.range(dataGrpCount).map( genDataMap ); 5557 5558 5559 var maxVal = thisObject.formattedData.max(); 5560 if (maxVal < 5) maxVal = 5; // fixing value repeating issue. 5561 5562 thisObject.x.domain(0, maxVal).range(0, (thisObject.width() - thisObject.paddingLeft() - thisObject.paddingRight()) ); 5563 thisObject.y.domain(pv.range(dataGrpCount)).splitBanded(0, (thisObject.height() - thisObject.paddingTop() - thisObject.paddingBottom()), 4/5); 5564 5565 function genDataMap(x) { 5566 var rootObj; 5567 if( _dataField instanceof Array ) { 5568 rootObj = _dataField[x]; 5569 } 5570 else { 5571 rootObj = _dataField; 5572 } 5573 return parseInt(thisObject.traverseToDataField(rootObj, thisObject.dataValue())); 5574 }*/ 5575 }; 5576 5577 //wso2vis.s.gauge.raphael.Gauge1.prototype.getData = function (thisObject) { 5578 //return thisObject.formattedData; 5579 //}; 5580 5581 wso2vis.s.gauge.raphael.Gauge1.prototype.update = function () { 5582 this.populateData(this); 5583 //this.vis.render(); 5584 if(this.tooltip() === true) { 5585 tooltip.init(); 5586 } 5587 }; 5588 5589 wso2vis.s.gauge.raphael.Gauge1.prototype.getDataLabel = function (i) { 5590 if (this.data !== null){ 5591 5592 var rootObj = this.traverseToDataField(this.data, this.dataField()); 5593 if( rootObj instanceof Array ) { 5594 return this.traverseToDataField(rootObj[i], this.dataLabel()); 5595 } 5596 else { 5597 return this.traverseToDataField(rootObj, this.dataLabel()); 5598 } 5599 } 5600 5601 return i; 5602 }; 5603 wso2vis.s.chart.raphael.DependencyTree = function(canvas, chartTitle, chartDesc) { 5604 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 5605 this.div = canvas; 5606 this.nodelength(50) 5607 .nodeheight(20) 5608 .edgelength(20) 5609 .sx(30) // distance between 2 successive horizontal nodes 5610 .sy(40) // distance between 2 successive vertical nodes 5611 .arrowsize(5) 5612 .arrowpos("mid"); 5613 } 5614 5615 //inherits from Chart 5616 wso2vis.extend(wso2vis.s.chart.raphael.DependencyTree, wso2vis.s.chart.Chart); 5617 5618 wso2vis.s.chart.raphael.DependencyTree.prototype 5619 .property("dataField") 5620 .property("dataValue") 5621 .property("nodelength") 5622 .property("nodeheight") 5623 .property("edgelength") 5624 .property("sx") 5625 .property("sy") 5626 .property("arrowsize") 5627 .property("arrowpos"); 5628 5629 5630 5631 Raphael.fn.node = function(x, y, width, height, node_label, url) { 5632 var box = this.rect(x,y , width, height); 5633 5634 var mid_x = (x*2 + width)/2; 5635 var mid_y = (y*2 + height)/2; 5636 var box_label = this.text(mid_x, mid_y, node_label).attr({font:"Arial"}); 5637 if (url) { 5638 box_label.node.onclick = function() { 5639 window.location = url; 5640 } 5641 box_label.node.onmouseover = function() { 5642 // alert("mouse over"); 5643 box_label.attr({ 5644 fill: "#25B" 5645 5646 }); 5647 box_label.node.style.cursor = "pointer"; 5648 } 5649 box_label.node.onmouseout = function () { 5650 box_label.attr({fill: "#000"}); 5651 } 5652 } 5653 return [box, box_label]; 5654 } 5655 5656 Raphael.fn.edge = function (x1, y1, x2, y2, size, arrow_position, edge_label) { 5657 var angle = Math.atan2(y2-y1,x2-x1) * 180 / Math.PI ; 5658 var arrow_x = x2; 5659 var arrow_y = y2; 5660 var mid_x = (x1+x2)/2; 5661 var mid_y = (y1+y2)/2; 5662 5663 if (arrow_position == "start") { 5664 arrow_x = x1; 5665 arrow_y = y1; 5666 } else if (arrow_position == "mid") { 5667 arrow_x = mid_x; 5668 arrow_y = mid_y; 5669 } else if (arrow_position == "end") { 5670 arrow_x = x2; 5671 arrow_y = y2; 5672 } 5673 5674 var arrow_path = this.path("M"+arrow_x+" "+arrow_y+"l"+0+" "+-(size/2)+"l"+size+" "+(size/2)+"l"+-size+" "+(size/2) +"z").attr("fill","black").rotate(angle, arrow_x, arrow_y); 5675 var line_path = this.path("M"+x1+" "+y1+"L"+x2+" "+y2); 5676 var label; 5677 if (edge_label) { 5678 label = this.text(mid_x, mid_y-(size+2), edge_label).rotate(angle, mid_x, mid_y).attr({font: "Arial"}); 5679 } 5680 return [arrow_path, line_path, label]; 5681 } 5682 5683 5684 5685 Raphael.fn.node_edge = function ( x, y, px, py, node_length, node_height, node_label, edge_length, edge_label, size, arrow_position, url) { 5686 var _node = this.node(x,y - (node_height/2),node_length, node_height, node_label, url); 5687 _node[0].attr({fill: '#4AE', 5688 stroke: '#3b4449', 5689 'stroke-width': 3, 5690 'stroke-linejoin': 'round'}); 5691 var _edge = null; 5692 if (px != null || py != null) { 5693 var _edge = this.edge(px, py, x , y , size, arrow_position, edge_label); 5694 _edge[0].attr({ stroke: '#3b4449', 5695 'stroke-width': 3, 5696 'stroke-linejoin': 'round'}); 5697 _edge[1].attr({ stroke: '#3b4449', 5698 'stroke-width': 3, 5699 'stroke-linejoin': 'round'}); 5700 } 5701 return [_node, _edge]; 5702 } 5703 5704 //public function 5705 wso2vis.s.chart.raphael.DependencyTree.prototype.load = function (w, h) { 5706 if (w !== undefined) { 5707 this.width(w); 5708 } 5709 if (h !== undefined) { 5710 this.height(h); 5711 } 5712 5713 this.paper = Raphael(this.divEl(), this.width(), this.height()); 5714 5715 return this; 5716 }; 5717 5718 5719 wso2vis.s.chart.raphael.DependencyTree.prototype.draw_tree_node_edge = function (paper, px, py ,x,y, node_label, edge_label, url) { 5720 var node_length = this.nodelength(); 5721 var edge_length = this.edgelength(); 5722 var node_height = this.nodeheight(); 5723 var size = this.arrowsize(); 5724 var arrow_position = this.arrowpos(); 5725 paper.node_edge(x, y, px, py, node_length, node_height, node_label, edge_length, edge_label, size, arrow_position, url); 5726 return [x + node_length, y]; 5727 } 5728 5729 5730 wso2vis.s.chart.raphael.DependencyTree.prototype.draw_json_node = function (paper, jsonObj, px, py, pid, x, y) { 5731 var edge_label = null; 5732 if (jsonObj.data.edges) { 5733 var edge_array = jsonObj.data.edges; 5734 for (var j = 0;j < edge_array.length; j++) { 5735 var edge_ids = edge_array[j].id.split("-"); 5736 if (edge_ids != null && edge_ids.length > 1) { 5737 if (edge_ids[0] == pid && edge_ids[1] == jsonObj.id) { 5738 edge_label = edge_array[j].name; 5739 } 5740 } 5741 } 5742 } 5743 var url = null; 5744 if (jsonObj.data.url) { 5745 url = jsonObj.data.url; 5746 } 5747 return this.draw_tree_node_edge(paper, px, py, x, y, jsonObj.name, edge_label, url ); 5748 5749 } 5750 5751 // Node class 5752 function Node (_json) { 5753 this.json = _json; 5754 this.visited; 5755 this.level; 5756 this.px; 5757 this.py; 5758 this.pid; 5759 this.i; 5760 this.scount; 5761 Node.prototype.getChildren = function () { 5762 var childArray = new Array(); 5763 var child; 5764 var children = this.json.children; 5765 for (var i = 0; i < children.length; i++) { 5766 childArray.push(new Node(children[i])); 5767 } 5768 return childArray; 5769 } 5770 } 5771 5772 function coYCalc() { 5773 var sy = 5; 5774 var h = 8; 5775 cy = jNode.py; 5776 cy += -((sCount * h) + (sCount-1) * sy) 5777 // 5778 } 5779 5780 5781 wso2vis.s.chart.raphael.DependencyTree.prototype.calc_draw_single_node = function (paper, jNode) { 5782 var initX = 10; 5783 var initY = paper.height /2; 5784 var d = 30; 5785 var sx = this.sx(); 5786 5787 var h = 10; 5788 if (jNode.level == 0) { 5789 return this.draw_json_node(paper, jNode.json, null, null, null, initX, initY); 5790 } else { 5791 var sy = this.sy(); //200/(2*jNode.level); 5792 cx = jNode.px + sx; //+ (jNode.pLevel - (json.level + 1)) * (d + sx) ; 5793 var sCount = jNode.sCount; 5794 var addConst = (sCount == 0) ? 0 : (sCount - 1) ; 5795 cy = jNode.py + (h + sy) * (jNode.i - ((sCount-1)/2))/Math.pow(3, jNode.level); //((jNode.i * (h + sy)) - (((sCount - 1) * (sy + h)) / 2)); 5796 return this.draw_json_node(paper, jNode.json, jNode.px, jNode.py, jNode.pid, cx, cy); 5797 } 5798 5799 } 5800 5801 wso2vis.s.chart.raphael.DependencyTree.prototype.DrawTreeBFS = function (paper, jNode) { 5802 var queue = new Array(); 5803 jNode.visited = true; 5804 queue.push(jNode); 5805 var level = 0; 5806 var px, py; 5807 while (queue.length > 0) { 5808 var pNode = queue.shift(); 5809 level = pNode.level; 5810 var coArr = this.calc_draw_single_node(paper, pNode); 5811 px = coArr[0]; 5812 py = coArr[1]; 5813 pid = pNode.json.id; 5814 //document.write(pNode.level + "," +pNode.json.id+" | "); 5815 var children = pNode.getChildren(); 5816 var lInc = false; 5817 for (var i = 0; i < children.length; i++) { 5818 if (i == 0) { 5819 level++; 5820 } 5821 if (!children[i].visited) { 5822 children[i].visited = true; 5823 children[i].level = level; 5824 children[i].pid = pid; 5825 children[i].px = px; 5826 children[i].py = py; 5827 children[i].i = i; 5828 children[i].sCount = children.length; 5829 queue.push(children[i]); 5830 5831 } 5832 } 5833 } 5834 5835 } 5836 5837 wso2vis.s.chart.raphael.DependencyTree.prototype.populateData = function (thisObject) { 5838 // Space Tree can only be drawn with a JSON Tree i.e. with JSON nodes 5839 this._dataField = thisObject.traverseToDataField(thisObject.data, thisObject.dataField()); 5840 if ((this._dataField instanceof Array) && (this._dataField.length < 1)) { 5841 return false; 5842 } 5843 5844 return true; 5845 5846 }; 5847 5848 5849 wso2vis.s.chart.raphael.DependencyTree.prototype.update = function () { 5850 if (this.populateData(this)) { 5851 this.paper.clear(); 5852 var root = new Node(this._dataField[0]); 5853 root.level = 0; 5854 this.DrawTreeBFS(this.paper, root); 5855 } 5856 5857 } 5858 5859 5860 wso2vis.s.chart.raphael.PieChart = function(canvas, chartTitle, chartDesc) { 5861 wso2vis.s.chart.Chart.call(this, canvas, chartTitle, chartDesc); 5862 5863 this.colscheme(20) 5864 .width(300) 5865 .height(300) 5866 .showPercent(true) 5867 .showValue(true) 5868 .padding(5) 5869 .fontFamily('Fontin-Sans, Arial') 5870 .fontSize('10px') 5871 .raphaelPaper(null); 5872 } 5873 5874 // inherits from Chart 5875 wso2vis.extend(wso2vis.s.chart.raphael.PieChart, wso2vis.s.chart.Chart); 5876 5877 wso2vis.s.chart.raphael.PieChart.prototype 5878 .property("colscheme") 5879 .property("dataField") 5880 .property("dataValue") 5881 .property("dataLabel") 5882 .property("showPercent") 5883 .property("showValue") 5884 .property("padding") 5885 .property("fontFamily") 5886 .property("fontSize") 5887 .property("raphaelPaper"); 5888 5889 5890 wso2vis.s.chart.raphael.PieChart.prototype.load = function (w) { 5891 if (w !== undefined) { 5892 this.width(w); 5893 } 5894 5895 if (this.raphaelPaper() == null) { 5896 this.raphaelPaper(Raphael(this.divEl(), this.width(), this.width())); //Create a new Raphael paper. 5897 } 5898 return this; 5899 }; 5900 5901 wso2vis.s.chart.raphael.PieChart.prototype.update = function () { 5902 this.convertData(this); 5903 var parent = this; 5904 5905 var colors = wso2vis.util.generateColors(this.formattedData.length, this.colscheme()); 5906 5907 var is_label_visible = false, 5908 leave_timer; 5909 5910 var currY = 0; 5911 var df = this.traverseToDataField(this.data, this.dataField()); 5912 if (df instanceof Array) { 5913 df = df; 5914 } 5915 else { 5916 df = [df]; 5917 } 5918 5919 var first; 5920 5921 var paper = this.raphaelPaper(), 5922 rad = Math.PI / 180, 5923 chart = paper.set(), 5924 cx = this.width()/2, 5925 cy = this.width()/2, 5926 radius = (this.width()/2) - this.padding(), 5927 data = this.formattedData; 5928 5929 paper.clear(); //wso2vis.environment.tooltip.show(10, 10, "tip"); 5930 5931 function sector(cx, cy, radius, startAngle, endAngle, params) { 5932 var x1 = cx + radius * Math.cos(-startAngle * rad), 5933 x2 = cx + radius * Math.cos(-endAngle * rad), 5934 y1 = cy + radius * Math.sin(-startAngle * rad), 5935 y2 = cy + radius * Math.sin(-endAngle * rad); 5936 return paper.path(["M", cx, cy, "L", x1, y1, "A", radius, radius, 0, +(endAngle - startAngle > 180), 0, x2, y2, "z"]).attr(params); 5937 } 5938 5939 var angle = 0, 5940 total = 0, 5941 start = 0, 5942 process = function (j) { 5943 var value = data[j]["value"], 5944 perc = Math.round((value / total) * 100), 5945 angleplus = 360 * (value / total), 5946 popangle = angle + (angleplus / 2), 5947 color = "hsb(" + start + ", 1, 0.8)", 5948 ms = 500, 5949 delta = 30, 5950 bcolor = colors[j], 5951 p = sector(cx, cy, radius, angle, angle + angleplus, {fill: bcolor, stroke: "none", "stroke-width": 1}), 5952 opac = 1, 5953 labelValue = (parent.showValue()) ? data[j]["value"] : "", 5954 labelPercent = (parent.showPercent()) ? " ("+perc+"%)" : "", 5955 txt = paper.text(cx + (radius - delta) * Math.cos(-popangle * rad), cy + (radius - delta) * Math.sin(-popangle * rad), labelValue + labelPercent ).attr({fill: "#fff", stroke: "none", opacity: opac, "font-family": parent.fontFamily(), "font-size": parent.fontSize()}); 5956 angle += angleplus; 5957 chart.push(p); 5958 chart.push(txt); 5959 start += .1; 5960 5961 if (parent.tooltip()) { 5962 (function (data, lbl, func, org) { 5963 $(p.node).hover(function (e) { 5964 clearTimeout(leave_timer); 5965 var tip = func({label:lbl, value:data, total:total, first:first, raw:org}); 5966 wso2vis.environment.tooltip.show(e.pageX, e.pageY, tip); 5967 is_label_visible = true; 5968 }, function () { 5969 leave_timer = setTimeout(function () { 5970 wso2vis.environment.tooltip.hide(); 5971 is_label_visible = false; 5972 }, 2); 5973 }); 5974 })(parent.formattedData[i]["value"], parent.formattedData[i]["label"], parent.onTooltip, df[i]); 5975 5976 (function (data, lbl, func, org) { 5977 $(p.node).mousemove(function (e) { 5978 if (is_label_visible) { 5979 clearTimeout(leave_timer); 5980 var tip = func({label:lbl, value:data, total:total, first:first, raw:org}); 5981 wso2vis.environment.tooltip.show(e.pageX, e.pageY, tip); 5982 } 5983 }); 5984 })(parent.formattedData[i]["value"], parent.formattedData[i]["label"], parent.onTooltip, df[i]); 5985 } 5986 }; 5987 5988 for (var i = 0, ii = data.length; i < ii; i++) { 5989 total += data[i]["value"]; 5990 } 5991 5992 for (var i = 0; i < ii; i++) { 5993 process(i); 5994 } 5995 }; 5996 5997 wso2vis.s.chart.raphael.PieChart.prototype.convertData = function (that) { 5998 var df = that.traverseToDataField(that.data, that.dataField()); 5999 var dcount = 1; 6000 if (df instanceof Array) { 6001 dcount = df.length; 6002 } 6003 6004 that.formattedData = []; 6005 6006 for (var i = 0; i < dcount; i++) { 6007 that.formattedData.push({"label":getLbl(i), "value":getVal(i)}); 6008 } 6009 6010 function getVal(x) { 6011 var r; 6012 if (df instanceof Array) { 6013 r = df[x]; 6014 } 6015 else { 6016 r = df; 6017 } 6018 return parseInt(that.traverseToDataField(r, that.dataValue())); 6019 } 6020 6021 function getLbl(x) { 6022 var r; 6023 if (df instanceof Array) { 6024 r = df[x]; 6025 } 6026 else { 6027 r = df; 6028 } 6029 return that.traverseToDataField(r, that.dataLabel()); 6030 } 6031 }; 6032 6033 wso2vis.s.chart.raphael.PieChart.prototype.onTooltip = function (data) { 6034 return data.label + ":" + data.value; 6035 }; 6036 6037 /** 6038 * wso2vis.ctrls.TrafficLight 6039 */ 6040 wso2vis.ctrls.TrafficLight = function(canvas) { 6041 this.attr = []; 6042 6043 this.divEl(canvas); 6044 6045 /* @private */ 6046 this.lights = []; 6047 this.back = []; 6048 6049 this.stat = []; 6050 this.stat["top"] = false; 6051 this.stat["middle"] = false; 6052 this.stat["bottom"] = false; 6053 6054 this.color = []; 6055 this.color["top_on"] = "r#f00-#f00-#89070D"; 6056 this.color["top_off"] = "r#900-#560101-#350305"; 6057 this.color["middle_on"] = "r#FFD52E-#FFEB14-#9E4500"; 6058 this.color["middle_off"] = "r#BD5F00-#6B2F00-#473A00"; 6059 this.color["bottom_on"] = "r#0f0-#0e0-#07890D"; 6060 this.color["bottom_off"] = "r#090-#015601-#033505"; 6061 6062 this.radius(35) 6063 .xspace(15) 6064 .yspace(20) 6065 .gap(10) 6066 .paper(null); 6067 6068 this.dia = this.radius()*2; 6069 this.backh = (this.dia*3)+(this.gap()*2)+(this.yspace()*2); 6070 this.backw = this.dia+(this.xspace()*2); 6071 6072 this.startX = this.radius() + this.xspace(); 6073 this.startY = this.radius() + this.yspace(); 6074 }; 6075 6076 wso2vis.ctrls.TrafficLight.prototype.property = function(name) { 6077 /* 6078 * Define the setter-getter globally 6079 */ 6080 wso2vis.ctrls.TrafficLight.prototype[name] = function(v) { 6081 if (arguments.length) { 6082 this.attr[name] = v; 6083 return this; 6084 } 6085 return this.attr[name]; 6086 }; 6087 6088 return this; 6089 }; 6090 6091 wso2vis.ctrls.TrafficLight.prototype 6092 .property("title") 6093 .property("divEl") 6094 .property("radius") 6095 .property("gap") 6096 .property("paper") 6097 .property("xspace") 6098 .property("yspace"); 6099 6100 wso2vis.ctrls.TrafficLight.prototype.load = function (p) { 6101 6102 if( (p != null) && (p != undefined) && (p != "") ) { 6103 this.paper(p); 6104 } 6105 else { 6106 this.paper(Raphael(this.divEl())); 6107 } 6108 6109 /* Init */ 6110 this.paper().clear(); 6111 this.back[0] = this.paper().rect(0, 0, this.backw, this.backh, 8).attr({"stroke-width": 1, stroke: "#000", fill: "#ccc"}); 6112 this.back[1] = this.paper().rect(5, 5, this.backw-10, this.backh-10, 8).attr({stroke: "none", fill: "#000"}); 6113 6114 //Lights 6115 this.lights["top"] = this.paper().circle(this.startX, this.startY, this.radius()).attr({fill: this.color["top_off"], stroke: "#333"}); 6116 this.lights["middle"] = this.paper().circle(this.startX, (this.startY + this.dia + this.gap()), this.radius()).attr({fill: this.color["middle_off"], stroke: "#333"}); 6117 this.lights["bottom"] = this.paper().circle(this.startX, this.startY + (this.dia*2) + (this.gap()*2), this.radius()).attr({fill: this.color["bottom_off"], stroke: "#333"}); 6118 6119 }; 6120 6121 wso2vis.ctrls.TrafficLight.prototype.on = function (light) { 6122 this.lights[light].animate({fill: this.color[light+"_on"]}, 100); 6123 this.stat[light] = true; 6124 }; 6125 6126 wso2vis.ctrls.TrafficLight.prototype.off = function (light) { 6127 this.lights[light].animate({fill: this.color[light+"_off"]}, 100); 6128 this.stat[light] = false; 6129 }; 6130 6131 wso2vis.ctrls.TrafficLight.prototype.toggle = function (light) { 6132 if( this.stat[light] ) { 6133 this.off(light); 6134 } 6135 else { 6136 this.on(light); 6137 } 6138 }; 6139 6140 wso2vis.ctrls.TrafficLight.prototype.horizontal = function () { 6141 /** 6142 * Horizontal Layout 6143 **/ 6144 this.back[0].attr({width: this.backh, height: this.backw}); 6145 this.back[1].attr({width: this.backh-10, height: this.backw-10}); 6146 6147 this.lights["top"].attr({cx: this.startY, cy: this.startX}); 6148 this.lights["middle"].attr({cx: this.startY + this.dia + this.gap(), cy: this.startX}); 6149 this.lights["bottom"].attr({cx: this.startY + (this.dia*2) + (this.gap()*2), cy: this.startX}); 6150 }; 6151 6152 wso2vis.ctrls.TrafficLight.prototype.vertical = function () { 6153 /** 6154 * Vertical Layout 6155 **/ 6156 this.back[0].attr({width: this.backw, height: this.backh}); 6157 this.back[1].attr({width: this.backw-10, height: this.backh-10}); 6158 6159 this.lights["top"].attr({cx: this.startX, cy: this.startY}); 6160 this.lights["middle"].attr({cx: this.startX, cy: this.startY + this.dia + this.gap()}); 6161 this.lights["bottom"].attr({cx: this.startX, cy: this.startY + (this.dia*2) + (this.gap()*2)}); 6162 }; 6163 6164 /* 6165 * @class Adapter 6166 * 6167 */ 6168 wso2vis.a.Adapter = function() { 6169 this.dp = null; 6170 this.drList = []; 6171 wso2vis.environment.adapters.push(this); 6172 id = wso2vis.environment.adapters.length - 1; 6173 this.getID = function() { 6174 return id; 6175 } 6176 }; 6177 6178 wso2vis.a.Adapter.prototype.dataProvider = function(dp) { 6179 this.dp = dp; 6180 this.dp.addDataReceiver(this); 6181 return; 6182 }; 6183 6184 wso2vis.a.Adapter.prototype.addDataReceiver = function(dr) { 6185 this.drList.push(dr); 6186 }; 6187 6188 wso2vis.a.Adapter.prototype.pushData = function(data) { 6189 var filteredData = this.convertData(data); 6190 for (i = 0; i < this.drList.length; i++) { 6191 (this.drList[i]).pushData(filteredData); 6192 } 6193 }; 6194 6195 wso2vis.a.Adapter.prototype.pullData = function() { 6196 this.dp.pullData(); 6197 }; 6198 6199 wso2vis.a.Adapter.prototype.convertData = function(data) { 6200 return data; 6201 }; 6202 6203 /** 6204 * Control 6205 */ 6206 wso2vis.c.Control = function(canvas) { 6207 this.attr = []; 6208 this.canvas(canvas); 6209 6210 this.dp = null; 6211 wso2vis.environment.controls.push(this); 6212 6213 id = wso2vis.environment.controls.length - 1; 6214 this.getID = function() {return id;} 6215 }; 6216 6217 wso2vis.c.Control.prototype.property = function(name) { 6218 wso2vis.c.Control.prototype[name] = function(v) { 6219 if (arguments.length) { 6220 this.attr[name] = v; 6221 return this; 6222 } 6223 return this.attr[name]; 6224 }; 6225 6226 return this; 6227 }; 6228 6229 wso2vis.c.Control.prototype.property("canvas"); 6230 6231 wso2vis.c.Control.prototype.create = function() { 6232 }; 6233 6234 wso2vis.c.Control.prototype.load = function() { 6235 var divEl = document.getElementById(this.canvas()); 6236 divEl.innerHTML = this.create(); 6237 }; 6238 6239 wso2vis.c.Control.prototype.unload = function() { 6240 var divEl = document.getElementById(this.canvas()); 6241 divEl.innerHTML = ""; 6242 }; 6243 6244 wso2vis.c.Tooltip = function () { 6245 this.el = document.createElement('div'); 6246 this.el.setAttribute('id', 'ttipRRR'); // a random name to avoid conflicts. 6247 this.el.style.display = 'none'; 6248 this.el.style.width = 'auto'; 6249 this.el.style.height = 'auto'; 6250 this.el.style.margin = '0'; 6251 this.el.style.padding = '5px'; 6252 this.el.style.backgroundColor = '#ffffff'; 6253 this.el.style.borderStyle = 'solid'; 6254 this.el.style.borderWidth = '1px'; 6255 this.el.style.borderColor = '#444444'; 6256 this.el.style.opacity = 0.85; 6257 6258 this.el.style.fontFamily = 'Fontin-Sans, Arial'; 6259 this.el.style.fontSize = '12px'; 6260 6261 this.el.innerHTML = "<b>wso2vis</b> tooltip demo <br/> works damn fine!"; 6262 document.body.appendChild(this.el); 6263 }; 6264 6265 wso2vis.c.Tooltip.prototype.style = function() { 6266 return this.el.style; 6267 }; 6268 6269 wso2vis.c.Tooltip.prototype.show = function(x, y, content) { 6270 var w = this.el.style.width; 6271 var h = this.el.style.height; 6272 var deltaX = 15; 6273 var deltaY = 15; 6274 6275 if ((w + x) >= (this.getWindowWidth() - deltaX)) { 6276 x = x - w; 6277 x = x - deltaX; 6278 } 6279 else { 6280 x = x + deltaX; 6281 } 6282 6283 if ((h + y) >= (this.getWindowHeight() - deltaY)) { 6284 y = y - h; 6285 y = y - deltaY; 6286 } 6287 else { 6288 y = y + deltaY; 6289 } 6290 6291 this.el.style.position = 'absolute'; 6292 this.el.style.top = y + 'px'; 6293 this.el.style.left = x + 'px'; 6294 if (content != undefined) 6295 this.el.innerHTML = content; 6296 this.el.style.display = 'block'; 6297 this.el.style.zindex = 1000; 6298 }; 6299 6300 wso2vis.c.Tooltip.prototype.hide = function() { 6301 this.el.style.display = 'none'; 6302 }; 6303 6304 wso2vis.c.Tooltip.prototype.getWindowHeight = function(){ 6305 var innerHeight; 6306 if (navigator.appVersion.indexOf('MSIE')>0) { 6307 innerHeight = document.body.clientHeight; 6308 } 6309 else { 6310 innerHeight = window.innerHeight; 6311 } 6312 return innerHeight; 6313 }; 6314 6315 wso2vis.c.Tooltip.prototype.getWindowWidth = function(){ 6316 var innerWidth; 6317 if (navigator.appVersion.indexOf('MSIE')>0) { 6318 innerWidth = document.body.clientWidth; 6319 } 6320 else { 6321 innerWidth = window.innerWidth; 6322 } 6323 return innerWidth; 6324 }; 6325 6326 6327 wso2vis.c.DateRange = function() { 6328 this.currentTimestamp = 0; 6329 this.firstStart = true; // user to hide the date selection box in the first start 6330 this.startHr; 6331 this.endHr = 0; 6332 this.startEndHrState = "init"; 6333 this.pageMode = 'hour'; //This is a flag set to keep the page mode (hour,day,or month); 6334 6335 wso2vis.c.Control.call(this); 6336 6337 this.showHours(true); 6338 this.showDays(true); 6339 this.showMonths(true); 6340 } 6341 6342 wso2vis.extend(wso2vis.c.DateRange, wso2vis.c.Control); 6343 6344 wso2vis.c.DateRange.prototype.property("showHours"); 6345 wso2vis.c.DateRange.prototype.property("showDays"); 6346 wso2vis.c.DateRange.prototype.property("showMonths"); 6347 6348 wso2vis.c.DateRange.prototype.onApplyClicked = function(mode, date1, date2) { 6349 } 6350 6351 wso2vis.c.DateRange.prototype.create = function() { 6352 /*YAHOO.util.Event.onDOMReady(function() {*/ 6353 //variables to keep the date interval start and end 6354 var styleTabMonthDisplay = ''; 6355 var styleTabDayDisplay = ''; 6356 var styleTabHourDisplay = ''; 6357 var styleMonthDisplay = ''; 6358 var styleDayDisplay = ''; 6359 var styleHourDisplay = ''; 6360 6361 this.pageMode = 'none'; 6362 6363 if (this.showMonths()) { 6364 this.pageMode = 'month'; 6365 styleMonthDisplay = ''; 6366 styleDayDisplay = 'style="display:none"'; 6367 styleHourDisplay = 'style="display:none"'; 6368 } 6369 else { 6370 styleTabMonthDisplay = 'style="display:none"'; 6371 styleMonthDisplay = 'style="display:none"'; 6372 } 6373 6374 if (this.showDays()) { 6375 this.pageMode = 'day'; 6376 styleMonthDisplay = 'style="display:none"'; 6377 styleDayDisplay = ''; 6378 styleHourDisplay = 'style="display:none"'; 6379 } 6380 else { 6381 styleTabDayDisplay = 'style="display:none"'; 6382 styleDayDisplay = 'style="display:none"'; 6383 } 6384 6385 if (this.showHours()) { 6386 this.pageMode = 'hour'; 6387 styleMonthDisplay = 'style="display:none"'; 6388 styleDayDisplay = 'style="display:none"'; 6389 styleHourDisplay = ''; 6390 } 6391 else { 6392 styleTabHourDisplay = 'style="display:none"'; 6393 styleHourDisplay = 'style="display:none"'; 6394 } 6395 6396 if (this.pageMode == 'none') 6397 return; 6398 6399 var canvas = YAHOO.util.Dom.get(this.canvas()); 6400 canvas.innerHTML = '<div style="height:40px;"><a style="cursor:pointer;" onClick="wso2vis.fn.toggleDateSelector('+this.getID()+')"> \ 6401 <table class="time-header"> \ 6402 <tr> \ 6403 <td><span id="dateDisplay'+this.getID()+'"></span><img src="../images/down.png" alt="calendar" align="middle" style="margin-bottom: 4px;margin-left:5px;margin-right:5px" id="imgObj'+this.getID()+'"/></td> \ 6404 </tr> \ 6405 </table> \ 6406 </a></div> \ 6407 <div class="dates-selection-Box yui-skin-sam" style="display:none" id="datesSelectionBox'+this.getID()+'"> \ 6408 <div class="dates" style="float:left"> \ 6409 <table> \ 6410 <tr> \ 6411 <td>Range</td> \ 6412 <td><input type="text" name="in" id="in'+this.getID()+'" class="in"></td> \ 6413 <td> -</td> \ 6414 <td><input type="text" name="out" id="out'+this.getID()+'" class="out"></td> \ 6415 </tr> \ 6416 </table> \ 6417 </div> \ 6418 <ul class="dates-types" id="datesTypes'+this.getID()+'"> \ 6419 <li><a class="nor-right" id="datesSelectionBox'+this.getID()+'MonthTab" onClick="wso2vis.fn.setPageMode(\'month\',this,'+this.getID()+')" '+ styleTabMonthDisplay+'>Month</a></li> \ 6420 <li><a class="nor-rep" id="datesSelectionBox'+this.getID()+'DayTab" onClick="wso2vis.fn.setPageMode(\'day\',this,'+this.getID()+')" '+ styleTabDayDisplay+'>Day</a></li> \ 6421 <li><a class="sel-left" id="datesSelectionBox'+this.getID()+'HourTab" onClick="wso2vis.fn.setPageMode(\'hour\',this,'+this.getID()+')" ' + styleTabHourDisplay+'>Hour</a></li> \ 6422 </ul> \ 6423 <div class="dateBox-main" id="dateBox-main'+this.getID()+'"><div id="cal1Container'+this.getID()+'" '+ styleDayDisplay+'></div></div> \ 6424 <div class="timeBox-main" id="timeBox-main'+this.getID()+'" '+ styleHourDisplay+'></div> \ 6425 <div class="monthBox-main" id="monthBox-main'+this.getID()+'" '+ styleMonthDisplay+'></div> \ 6426 <div style="clear:both;padding-top:5px;"><input type="button" value="Apply" onClick="wso2vis.fn.updatePage('+this.getID()+', true);wso2vis.fn.toggleDateSelector('+this.getID()+')" class="button"/></div> \ 6427 </div> \ 6428 <div style="clear:both"></div>'; 6429 6430 var d = new Date(); 6431 var dateDisplay = YAHOO.util.Dom.get("dateDisplay"+this.getID()); 6432 var inTxtTop = getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 6433 var outTxtTop = ""; 6434 var inTxt = YAHOO.util.Dom.get("in"+this.getID()), 6435 outTxt = YAHOO.util.Dom.get("out"+this.getID()), 6436 inDate, outDate, interval; 6437 6438 inTxt.value = ""; 6439 outTxt.value = ""; 6440 6441 var d = new Date(); 6442 this.currentTimestamp = d.getTime(); 6443 6444 var cal = new YAHOO.example.calendar.IntervalCalendar("cal1Container"+this.getID(), {pages:3,width:60}); 6445 var copyOfID = this.getID(); 6446 6447 cal.selectEvent.subscribe(function() { 6448 interval = this.getInterval(); 6449 if (interval.length == 2) { 6450 inDate = interval[0]; 6451 inTxt.value = (inDate.getMonth() + 1) + "/" + inDate.getDate() + "/" + inDate.getFullYear(); 6452 inTxtTop = getStringMonth(inDate.getMonth()) + ' ' + inDate.getDate() + ',' + inDate.getFullYear(); 6453 wso2vis.fn.getControlFromID(copyOfID).startHr = inDate.getTime(); 6454 if (interval[0].getTime() != interval[1].getTime()) { 6455 outDate = interval[1]; 6456 outTxt.value = (outDate.getMonth() + 1) + "/" + outDate.getDate() + "/" + outDate.getFullYear(); 6457 outTxtTop = getStringMonth(outDate.getMonth()) + ' ' + outDate.getDate() + ',' + outDate.getFullYear(); 6458 wso2vis.fn.getControlFromID(copyOfID).endHr = outDate.getTime(); 6459 } else { 6460 outTxt.value = ""; 6461 outTxtTop = ""; 6462 } 6463 } 6464 dateDisplay.innerHTML = inTxtTop + " - " + outTxtTop; 6465 }, cal, true); 6466 6467 cal.render(); 6468 genTimeHours(this.getID()); 6469 genTimeMonths(this.getID()); 6470 6471 //Set the time ranges 6472 var tmpString; 6473 if (this.showMonths()) { 6474 var twoMonthLate = new Date(getPrevMonth(getPrevMonth(d.getTime()))); //Get the prev month 6475 tmpString = getStringMonth(twoMonthLate.getMonth()) + ' ' + twoMonthLate.getDate() + ',' + twoMonthLate.getFullYear(); 6476 tmpString += ' -> ' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 6477 wso2vis.fn.getControlFromID(this.getID()).startHr = twoMonthLate.getTime(); 6478 wso2vis.fn.getControlFromID(this.getID()).endHr = d.getTime(); 6479 } 6480 6481 if (this.showDays()) { 6482 var sevenDayLate = new Date(d.getTime() - 7*oneDay); //Get the yesterdays midnight 6483 tmpString = getStringMonth(sevenDayLate.getMonth()) + ' ' + sevenDayLate.getDate() + ',' + sevenDayLate.getFullYear(); 6484 tmpString += ' -> ' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 6485 wso2vis.fn.getControlFromID(this.getID()).startHr = sevenDayLate.getTime(); 6486 wso2vis.fn.getControlFromID(this.getID()).endHr = d.getTime(); 6487 } 6488 6489 if (this.showHours()) { 6490 wso2vis.fn.setPageMode('hour', document.getElementById('datesSelectionBox'+this.getID()+'HourTab'), this.getID()); 6491 } 6492 else if (this.showDays()) { 6493 wso2vis.fn.setPageMode('day', document.getElementById('datesSelectionBox'+this.getID()+'DayTab'), this.getID()); 6494 } 6495 else if (this.showMonths()) { 6496 wso2vis.fn.setPageMode('month', document.getElementById('datesSelectionBox'+this.getID()+'MonthTab'), this.getID()); 6497 } 6498 6499 wso2vis.fn.updatePage(this.getID()); 6500 }; 6501 6502 6503 function genHourTable(timestamp, id) { 6504 var timeBoxMain = document.getElementById('timeBox-main'+id); 6505 var d = new Date(timestamp); 6506 var externDiv = document.createElement("DIV"); 6507 YAHOO.util.Dom.addClass(externDiv, 'timeBox-sub'); 6508 var insideStr = '<div class="date-title">' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear() + '</div>' + 6509 '<div class="timeBox-Wrapper">' + 6510 '<ul>'; 6511 for (var i = 0; i <= 23; i++) { 6512 insideStr += '<li title="' + (timestamp + i * oneHour) + '" onclick="wso2vis.fn.setHourRange(this, '+id+')">' + i + '</li>'; 6513 } 6514 insideStr += '</ul></div>'; 6515 externDiv.innerHTML = insideStr; 6516 6517 timeBoxMain.appendChild(externDiv); 6518 } 6519 6520 function genTimeHours(id) { 6521 var clearToday = getClearTimestamp(wso2vis.fn.getControlFromID(id).currentTimestamp); 6522 6523 6524 //set the buttons 6525 var timeBoxMain = document.getElementById('timeBox-main'+id); 6526 var navButtons = '<div class="navButtons"><a class="left" onclick="wso2vis.fn.navHour(\'left\','+id+')"><<</a><a class="right" onclick="wso2vis.fn.navHour(\'right\','+id+')">>></a></div>'; 6527 var navButtonDiv = document.createElement("DIV"); 6528 navButtonDiv.innerHTML = navButtons; 6529 timeBoxMain.innerHTML = ""; 6530 timeBoxMain.appendChild(navButtonDiv); 6531 6532 genHourTable(clearToday - oneDay * 2, id); 6533 genHourTable(clearToday - oneDay, id); 6534 genHourTable(clearToday, id); 6535 } 6536 6537 /* --------------------------------------------------------*/ 6538 /*Create Monthe range selector*/ 6539 function genMonthTable(timestamp, id) { 6540 var timeBoxMain = document.getElementById('monthBox-main'+id); 6541 var d = new Date(timestamp); 6542 var externDiv = document.createElement("DIV"); 6543 YAHOO.util.Dom.addClass(externDiv, 'monthBox-sub'); 6544 var insideStr = '<div class="date-title">' + d.getFullYear() + '</div>' + 6545 '<div class="monthBox-Wrapper">' + 6546 '<ul>'; 6547 var iTime = timestamp; 6548 for (var i = 0; i < m_names.length; i++) { 6549 insideStr += '<li title="' + iTime + '" onclick="wso2vis.fn.setMonthRange(this, '+id+')">' + m_names[i] + '</li>'; 6550 iTime = getNextMonth(iTime); 6551 } 6552 insideStr += '</ul></div>'; 6553 externDiv.innerHTML = insideStr; 6554 6555 timeBoxMain.appendChild(externDiv); 6556 } 6557 6558 function genTimeMonths(id) { 6559 //set the buttons 6560 var timeBoxMain = document.getElementById('monthBox-main'+id); 6561 var navButtons = '<div class="navButtons"><a class="left" onclick="wso2vis.fn.navMonth(\'left\','+id+')"><<</a><a class="right" onclick="wso2vis.fn.navMonth(\'right\', '+id+')">>></a></div>'; 6562 var navButtonDiv = document.createElement("DIV"); 6563 navButtonDiv.innerHTML = navButtons; 6564 timeBoxMain.innerHTML = ""; 6565 timeBoxMain.appendChild(navButtonDiv); 6566 var jan1st = new Date((new Date(wso2vis.fn.getControlFromID(id).currentTimestamp)).getFullYear(),0,1); 6567 genMonthTable(getPrevYear(wso2vis.fn.getControlFromID(id).currentTimestamp), id); 6568 genMonthTable(jan1st.getTime(), id); 6569 } 6570 6571 function getNextYear(timestamp){ 6572 now = new Date(timestamp); 6573 var current; 6574 current = new Date(now.getFullYear() + 1, 0, 1); 6575 return current.getTime(); 6576 } 6577 6578 function getPrevYear(timestamp){ 6579 now = new Date(timestamp); 6580 var current; 6581 current = new Date(now.getFullYear() - 1, 0, 1); 6582 return current.getTime(); 6583 } 6584 6585 //util function 6586 function getStringMonth(num) { 6587 var m_names = new Array("January", "February", "March", 6588 "April", "May", "June", "July", "August", "September", 6589 "October", "November", "December"); 6590 6591 return m_names[num]; 6592 } 6593 6594 function getClearTimestamp(timestamp) { 6595 var d = new Date(timestamp); 6596 var dateClear = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); 6597 return (dateClear.getTime()+d.getTimezoneOffset()*1000 * 60); 6598 } 6599 6600 function formatDate(inDate) { 6601 var year = inDate.split(" ")[0].split("-")[0]; 6602 var month = inDate.split(" ")[0].split("-")[1]; 6603 var day = inDate.split(" ")[0].split("-")[2]; 6604 var hour = inDate.split(" ")[1].split(":")[0]; 6605 6606 return m_names[month - 1] + " " + day + "-" + hour +":00"; 6607 } 6608 6609 6610 6611 6612 /************************** YAHOO IntervalCalender ********************************/ 6613 6614 function IntervalCalendar(container, cfg) { 6615 this._iState = 0; 6616 cfg = cfg || {}; 6617 cfg.multi_select = true; 6618 IntervalCalendar.superclass.constructor.call(this, container, cfg); 6619 6620 this.beforeSelectEvent.subscribe(this._intervalOnBeforeSelect, this, true); 6621 this.selectEvent.subscribe(this._intervalOnSelect, this, true); 6622 this.beforeDeselectEvent.subscribe(this._intervalOnBeforeDeselect, this, true); 6623 this.deselectEvent.subscribe(this._intervalOnDeselect, this, true); 6624 } 6625 6626 IntervalCalendar._DEFAULT_CONFIG = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG; 6627 6628 YAHOO.lang.extend(IntervalCalendar, YAHOO.widget.CalendarGroup, { 6629 _dateString : function(d) { 6630 var a = []; 6631 a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_MONTH_POSITION.key) - 1] = (d.getMonth() + 1); 6632 a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_DAY_POSITION.key) - 1] = d.getDate(); 6633 a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_YEAR_POSITION.key) - 1] = d.getFullYear(); 6634 var s = this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_FIELD_DELIMITER.key); 6635 return a.join(s); 6636 }, 6637 6638 _dateIntervalString : function(l, u) { 6639 var s = this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_RANGE_DELIMITER.key); 6640 return (this._dateString(l) 6641 + s + this._dateString(u)); 6642 }, 6643 6644 getInterval : function() { 6645 // Get selected dates 6646 var dates = this.getSelectedDates(); 6647 if (dates.length > 0) { 6648 // Return lower and upper date in array 6649 var l = dates[0]; 6650 var u = dates[dates.length - 1]; 6651 return [l, u]; 6652 } 6653 else { 6654 // No dates selected, return empty array 6655 return []; 6656 } 6657 }, 6658 6659 setInterval : function(d1, d2) { 6660 // Determine lower and upper dates 6661 var b = (d1 <= d2); 6662 var l = b ? d1 : d2; 6663 var u = b ? d2 : d1; 6664 // Update configuration 6665 this.cfg.setProperty('selected', this._dateIntervalString(l, u), false); 6666 this._iState = 2; 6667 }, 6668 6669 resetInterval : function() { 6670 // Update configuration 6671 this.cfg.setProperty('selected', [], false); 6672 this._iState = 0; 6673 }, 6674 6675 _intervalOnBeforeSelect : function(t, a, o) { 6676 // Update interval state 6677 this._iState = (this._iState + 1) % 3; 6678 if (this._iState == 0) { 6679 // If starting over with upcoming selection, first deselect all 6680 this.deselectAll(); 6681 this._iState++; 6682 } 6683 }, 6684 6685 _intervalOnSelect : function(t, a, o) { 6686 // Get selected dates 6687 var dates = this.getSelectedDates(); 6688 if (dates.length > 1) { 6689 /* If more than one date is selected, ensure that the entire interval 6690 between and including them is selected */ 6691 var l = dates[0]; 6692 var u = dates[dates.length - 1]; 6693 this.cfg.setProperty('selected', this._dateIntervalString(l, u), false); 6694 } 6695 // Render changes 6696 this.render(); 6697 }, 6698 6699 _intervalOnBeforeDeselect : function(t, a, o) { 6700 if (this._iState != 0) { 6701 /* If part of an interval is already selected, then swallow up 6702 this event because it is superfluous (see _intervalOnDeselect) */ 6703 return false; 6704 } 6705 }, 6706 6707 _intervalOnDeselect : function(t, a, o) { 6708 if (this._iState != 0) { 6709 // If part of an interval is already selected, then first deselect all 6710 this._iState = 0; 6711 this.deselectAll(); 6712 6713 // Get individual date deselected and page containing it 6714 var d = a[0][0]; 6715 var date = YAHOO.widget.DateMath.getDate(d[0], d[1] - 1, d[2]); 6716 var page = this.getCalendarPage(date); 6717 if (page) { 6718 // Now (re)select the individual date 6719 page.beforeSelectEvent.fire(); 6720 this.cfg.setProperty('selected', this._dateString(date), false); 6721 page.selectEvent.fire([d]); 6722 } 6723 // Swallow up since we called deselectAll above 6724 return false; 6725 } 6726 } 6727 }); 6728 6729 YAHOO.namespace("example.calendar"); 6730 YAHOO.example.calendar.IntervalCalendar = IntervalCalendar; 6731 6732 /************************** <end> YAHOO IntervalCalender ********************************/ 6733 6734 6735 6736 function gotoInitMode(id){ 6737 var allDivs1 = document.getElementById("timeBox-main"+id).getElementsByTagName("*"); 6738 var allDivs2 = document.getElementById("monthBox-main"+id).getElementsByTagName("*"); 6739 6740 for (i = 0; i < allDivs1.length; i++) { 6741 YAHOO.util.Dom.removeClass(allDivs1[i], 'selected'); 6742 } 6743 for (i = 0; i < allDivs2.length; i++) { 6744 YAHOO.util.Dom.removeClass(allDivs2[i], 'selected'); 6745 } 6746 wso2vis.fn.getControlFromID(id).startEndHrState = "init"; 6747 } 6748 6749 function getNextMonth(timestamp){ 6750 now = new Date(timestamp); 6751 var current; 6752 if (now.getMonth() == 11) { 6753 current = new Date(now.getFullYear() + 1, 0, 1); 6754 } else { 6755 current = new Date(now.getFullYear(), now.getMonth() + 1, 1); 6756 } 6757 return current.getTime(); 6758 } 6759 6760 function getPrevMonth(timestamp){ 6761 now = new Date(timestamp); 6762 var current; 6763 if (now.getMonth() == 0) { 6764 current = new Date(now.getFullYear() - 1, 11, 1); 6765 } else { 6766 current = new Date(now.getFullYear(), now.getMonth() - 1, 1); 6767 } 6768 return current.getTime(); 6769 } 6770 6771 var oneDay = 1000 * 60 * 60 * 24; 6772 var oneHour = 1000 * 60 * 60; 6773 var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); 6774 6775 wso2vis.fn.setPageMode = function(mode, clickedObj, id) { 6776 var d = new Date(); 6777 wso2vis.fn.getControlFromID(id).pageMode = mode; 6778 var dateDisplay = YAHOO.util.Dom.get("dateDisplay"+id); 6779 var allObjs = document.getElementById("datesTypes"+id).getElementsByTagName("*"); 6780 for (var i = 0; i < allObjs.length; i++) { 6781 if (YAHOO.util.Dom.hasClass(allObjs[i], "sel-left")) { 6782 YAHOO.util.Dom.removeClass(allObjs[i], "sel-left"); 6783 YAHOO.util.Dom.addClass(allObjs[i], "nor-left"); 6784 } 6785 if (YAHOO.util.Dom.hasClass(allObjs[i], "sel-right")) { 6786 YAHOO.util.Dom.removeClass(allObjs[i], "sel-right"); 6787 YAHOO.util.Dom.addClass(allObjs[i], "nor-right"); 6788 } 6789 if (YAHOO.util.Dom.hasClass(allObjs[i], "sel-rep")) { 6790 YAHOO.util.Dom.removeClass(allObjs[i], "sel-rep"); 6791 YAHOO.util.Dom.addClass(allObjs[i], "nor-rep"); 6792 } 6793 } 6794 var timeBoxMain = document.getElementById('timeBox-main'+id); 6795 var cal1Container = document.getElementById('cal1Container'+id); 6796 var monthBoxMain = document.getElementById('monthBox-main'+id); 6797 gotoInitMode(id); 6798 if (wso2vis.fn.getControlFromID(id).pageMode == 'hour') { 6799 timeBoxMain.style.display = ''; 6800 cal1Container.style.display = 'none'; 6801 monthBoxMain.style.display = 'none'; 6802 YAHOO.util.Dom.removeClass(clickedObj, "nor-left"); 6803 YAHOO.util.Dom.addClass(clickedObj, "sel-left"); 6804 if (wso2vis.fn.getControlFromID(id).startEndHrState == 'init') { 6805 var hourLate = new Date(d.getTime() - oneHour*8); 6806 var tmpString = getStringMonth(hourLate.getMonth()) + ' ' + hourLate.getDate() + ',' + hourLate.getFullYear() + ' - <span class="hourStrong">' + hourLate.getHours() + ':00</span>'; 6807 tmpString += ' -> ' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear() + ' - <span class="hourStrong">' + d.getHours() + ':00</span>'; 6808 dateDisplay.innerHTML = tmpString; 6809 } 6810 wso2vis.fn.updatePage(id); 6811 } 6812 if (wso2vis.fn.getControlFromID(id).pageMode == 'day') { 6813 d = new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0); 6814 timeBoxMain.style.display = 'none'; 6815 monthBoxMain.style.display = 'none'; 6816 cal1Container.style.display = ''; 6817 YAHOO.util.Dom.removeClass(clickedObj, "nor-rep"); 6818 YAHOO.util.Dom.addClass(clickedObj, "sel-rep"); 6819 if (wso2vis.fn.getControlFromID(id).startEndHrState == 'init') { 6820 var sevenDayLate = new Date(d.getTime() - 7*oneDay); //Get the yesterdays midnight 6821 var tmpString = getStringMonth(sevenDayLate.getMonth()) + ' ' + sevenDayLate.getDate() + ',' + sevenDayLate.getFullYear(); 6822 tmpString += ' -> ' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 6823 dateDisplay.innerHTML = tmpString; 6824 wso2vis.fn.getControlFromID(id).startHr = sevenDayLate.getTime(); 6825 wso2vis.fn.getControlFromID(id).endHr = d.getTime(); 6826 } 6827 wso2vis.fn.updatePage(id); 6828 } 6829 if (wso2vis.fn.getControlFromID(id).pageMode == 'month') { 6830 d = new Date(d.getFullYear(),d.getMonth(),1,0,0,0); 6831 timeBoxMain.style.display = 'none'; 6832 monthBoxMain.style.display = ''; 6833 cal1Container.style.display = 'none'; 6834 YAHOO.util.Dom.removeClass(clickedObj, "nor-right"); 6835 YAHOO.util.Dom.addClass(clickedObj, "sel-right"); 6836 if (wso2vis.fn.getControlFromID(id).startEndHrState == 'init') { 6837 var twoMonthLate = new Date(getPrevMonth(getPrevMonth(d.getTime()))); //Get the prev month 6838 var tmpString = getStringMonth(twoMonthLate.getMonth()) + ' ' + twoMonthLate.getDate() + ',' + twoMonthLate.getFullYear(); 6839 tmpString += ' -> ' + getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 6840 dateDisplay.innerHTML = tmpString; 6841 wso2vis.fn.getControlFromID(id).startHr = twoMonthLate.getTime(); 6842 wso2vis.fn.getControlFromID(id).endHr = d.getTime(); 6843 } 6844 wso2vis.fn.updatePage(id); 6845 } 6846 } 6847 6848 wso2vis.fn.updatePage = function(id, butt){ 6849 if (butt !== undefined) 6850 (wso2vis.fn.getControlFromID(id)).onApplyClicked(wso2vis.fn.getControlFromID(id).pageMode, wso2vis.fn.getControlFromID(id).startHr, wso2vis.fn.getControlFromID(id).endHr); 6851 6852 if (!wso2vis.fn.getControlFromID(id).firstStart) { 6853 var now = new Date(); 6854 if (wso2vis.fn.getControlFromID(id).startEndHrState == "init") { 6855 if (wso2vis.fn.getControlFromID(id).pageMode == "hour") { 6856 now = getClearTimestamp(now.getTime()); 6857 wso2vis.fn.getControlFromID(id).startHr = now - 8 * oneHour; 6858 wso2vis.fn.getControlFromID(id).endHr = now; 6859 } else if (wso2vis.fn.getControlFromID(id).pageMode == "day") { 6860 now = new Date(now.getFullYear(), now.getMonth(), now.getDate()); 6861 wso2vis.fn.getControlFromID(id).startHr = now.getTime() - oneDay * 7; 6862 wso2vis.fn.getControlFromID(id).endHr = now.getTime(); 6863 } else if (wso2vis.fn.getControlFromID(id).pageMode == "month") { 6864 now = new Date(now.getFullYear(), now.getMonth(), 1); 6865 wso2vis.fn.getControlFromID(id).startHr = getPrevMonth(getPrevMonth(now.getTime())); 6866 wso2vis.fn.getControlFromID(id).endHr = now.getTime(); 6867 } 6868 }else if(wso2vis.fn.getControlFromID(id).startEndHrState == "startSet") { 6869 wso2vis.fn.getControlFromID(id).endHr = wso2vis.fn.getControlFromID(id).startHr; 6870 if (wso2vis.fn.getControlFromID(id).pageMode == "hour") { 6871 wso2vis.fn.getControlFromID(id).startHr = wso2vis.fn.getControlFromID(id).startHr - 8 * oneHour; 6872 } else if (wso2vis.fn.getControlFromID(id).pageMode == "day") { 6873 wso2vis.fn.getControlFromID(id).startHr = wso2vis.fn.getControlFromID(id).startHr - oneDay * 7; 6874 } else if (wso2vis.fn.getControlFromID(id).pageMode == "month") { 6875 wso2vis.fn.getControlFromID(id).startHr = getPrevMonth(getPrevMonth(wso2vis.fn.getControlFromID(id).startHr)); 6876 } 6877 } else if(wso2vis.fn.getControlFromID(id).startEndHrState == "endSet") { 6878 } 6879 } 6880 wso2vis.fn.getControlFromID(id).firstStart = false; 6881 //var startHrToSend = wso2vis.fn.getControlFromID(id).startHr-oneHour*1/2; 6882 //var endHrToSend = wso2vis.fn.getControlFromID(id).endHr-oneHour*1/2; 6883 }; 6884 6885 wso2vis.fn.setHourRange = function(theli, id) { 6886 var inTxt = YAHOO.util.Dom.get("in"+id),outTxt = YAHOO.util.Dom.get("out"+id),dateDisplay=YAHOO.util.Dom.get("dateDisplay"+id); 6887 var timestamp = theli.title; 6888 timestamp = parseInt(timestamp); 6889 var allDivs = document.getElementById("timeBox-main"+id).getElementsByTagName("*"); 6890 6891 if (wso2vis.fn.getControlFromID(id).startEndHrState == "init") { 6892 wso2vis.fn.getControlFromID(id).startHr = timestamp; 6893 for (var i = 0; i < allDivs.length; i++) { 6894 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 6895 } 6896 YAHOO.util.Dom.addClass(theli, 'selected'); 6897 wso2vis.fn.getControlFromID(id).startEndHrState = "startSet"; 6898 //set the headers and the text boxes 6899 var d = new Date(timestamp); 6900 inTxt.value = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() + " - " + d.getHours()+":00"; 6901 outTxt.value = ''; 6902 var tmpString = getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear() + ' - <span class="hourStrong">' + d.getHours() + ':00</span>'; 6903 dateDisplay.innerHTML = tmpString; 6904 6905 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "endSet") { 6906 wso2vis.fn.getControlFromID(id).startHr = timestamp; 6907 for (var i = 0; i < allDivs.length; i++) { 6908 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 6909 } 6910 YAHOO.util.Dom.addClass(theli, 'selected'); 6911 wso2vis.fn.getControlFromID(id).startEndHrState = "startSet"; 6912 6913 //set the headers and the text boxes 6914 var d = new Date(timestamp); 6915 inTxt.value = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() + " - " + d.getHours()+":00"; 6916 outTxt.value = ''; 6917 var tmpString = getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear() + ' - <span class="hourStrong">' + d.getHours() + ':00</span>'; 6918 dateDisplay.innerHTML = tmpString; 6919 6920 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "startSet") { 6921 wso2vis.fn.getControlFromID(id).endHr = timestamp; 6922 if (wso2vis.fn.getControlFromID(id).startHr > wso2vis.fn.getControlFromID(id).endHr) {//Swap if the end time is smaller than start time 6923 var tmp = wso2vis.fn.getControlFromID(id).endHr; 6924 wso2vis.fn.getControlFromID(id).endHr = wso2vis.fn.getControlFromID(id).startHr; 6925 wso2vis.fn.getControlFromID(id).startHr = tmp; 6926 } 6927 for (var i = 0; i < allDivs.length; i++) { 6928 if (allDivs[i].title <= wso2vis.fn.getControlFromID(id).endHr && allDivs[i].title >= wso2vis.fn.getControlFromID(id).startHr) { 6929 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 6930 } 6931 else { 6932 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 6933 } 6934 } 6935 wso2vis.fn.getControlFromID(id).startEndHrState = "endSet"; 6936 6937 //set the headers and the text boxes 6938 var dStart = new Date(wso2vis.fn.getControlFromID(id).startHr); 6939 var dEnd = new Date(wso2vis.fn.getControlFromID(id).endHr); 6940 inTxt.value = (dStart.getMonth() + 1) + "/" + dStart.getDate() + "/" + dStart.getFullYear() + " - " + dStart.getHours()+":00"; 6941 outTxt.value = (dEnd.getMonth() + 1) + "/" + dEnd.getDate() + "/" + dEnd.getFullYear() + " - " + dEnd.getHours()+":00"; 6942 var tmpString = getStringMonth(dStart.getMonth()) + ' ' + dStart.getDate() + ',' + dStart.getFullYear() + ' - <span class="hourStrong">' + dStart.getHours() + ':00</span>' +' -> ' +getStringMonth(dEnd.getMonth()) + ' ' + dEnd.getDate() + ',' + dEnd.getFullYear() + ' - <span class="hourStrong">' + dEnd.getHours() + ':00</span>'; 6943 dateDisplay.innerHTML = tmpString; 6944 } 6945 }; 6946 6947 wso2vis.fn.navHour = function(direction, id) { 6948 if (direction == "left") { 6949 wso2vis.fn.getControlFromID(id).currentTimestamp -= oneDay; 6950 } else if (direction == "right") { 6951 wso2vis.fn.getControlFromID(id).currentTimestamp += oneDay; 6952 } 6953 genTimeHours(id); 6954 var allDivs = document.getElementById("timeBox-main"+id).getElementsByTagName("*"); 6955 if (wso2vis.fn.getControlFromID(id).startEndHrState == "startSet") { 6956 for (var i = 0; i < allDivs.length; i++) { 6957 if (allDivs[i].title == wso2vis.fn.getControlFromID(id).startHr) { 6958 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 6959 } 6960 } 6961 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "endSet") { 6962 for (var i = 0; i < allDivs.length; i++) { 6963 if (allDivs[i].title <= wso2vis.fn.getControlFromID(id).endHr && allDivs[i].title >= wso2vis.fn.getControlFromID(id).startHr) { 6964 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 6965 } 6966 else { 6967 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 6968 } 6969 } 6970 } 6971 }; 6972 6973 wso2vis.fn.navMonth = function(direction, id){ 6974 if (direction == "left") { 6975 wso2vis.fn.getControlFromID(id).currentTimestamp = getPrevYear(wso2vis.fn.getControlFromID(id).currentTimestamp); 6976 } else if (direction == "right") { 6977 wso2vis.fn.getControlFromID(id).currentTimestamp = getNextYear(wso2vis.fn.getControlFromID(id).currentTimestamp); 6978 } 6979 genTimeMonths(id); 6980 var allDivs = document.getElementById("monthBox-main"+id).getElementsByTagName("*"); 6981 if (wso2vis.fn.getControlFromID(id).startEndHrState == "startSet") { 6982 for (var i = 0; i < allDivs.length; i++) { 6983 if (allDivs[i].title == wso2vis.fn.getControlFromID(id).startHr) { 6984 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 6985 } 6986 } 6987 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "endSet") { 6988 for (var i = 0; i < allDivs.length; i++) { 6989 if (allDivs[i].title <= wso2vis.fn.getControlFromID(id).endHr && allDivs[i].title >= wso2vis.fn.getControlFromID(id).startHr) { 6990 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 6991 } 6992 else { 6993 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 6994 } 6995 } 6996 } 6997 }; 6998 6999 wso2vis.fn.setMonthRange = function(theli, id){ 7000 var inTxt = YAHOO.util.Dom.get("in"+id),outTxt = YAHOO.util.Dom.get("out"+id),dateDisplay=YAHOO.util.Dom.get("dateDisplay"+id); 7001 var timestamp = theli.title; 7002 timestamp = parseInt(timestamp); 7003 var allDivs = document.getElementById("monthBox-main"+id).getElementsByTagName("*"); 7004 7005 if (wso2vis.fn.getControlFromID(id).startEndHrState == "init") { 7006 wso2vis.fn.getControlFromID(id).startHr = timestamp; 7007 for (var i = 0; i < allDivs.length; i++) { 7008 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 7009 } 7010 YAHOO.util.Dom.addClass(theli, 'selected'); 7011 wso2vis.fn.getControlFromID(id).startEndHrState = "startSet"; 7012 //set the headers and the text boxes 7013 var d = new Date(timestamp); 7014 inTxt.value = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear(); 7015 outTxt.value = ''; 7016 var tmpString = getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear(); 7017 dateDisplay.innerHTML = tmpString; 7018 7019 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "endSet") { 7020 wso2vis.fn.getControlFromID(id).startHr = timestamp; 7021 for (var i = 0; i < allDivs.length; i++) { 7022 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 7023 } 7024 YAHOO.util.Dom.addClass(theli, 'selected'); 7025 wso2vis.fn.getControlFromID(id).startEndHrState = "startSet"; 7026 7027 //set the headers and the text boxes 7028 var d = new Date(timestamp); 7029 inTxt.value = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear(); 7030 outTxt.value = ''; 7031 var tmpString = getStringMonth(d.getMonth()) + ' ' + d.getDate() + ',' + d.getFullYear() ; 7032 dateDisplay.innerHTML = tmpString; 7033 7034 } else if (wso2vis.fn.getControlFromID(id).startEndHrState == "startSet") { 7035 wso2vis.fn.getControlFromID(id).endHr = timestamp; 7036 if (wso2vis.fn.getControlFromID(id).startHr > wso2vis.fn.getControlFromID(id).endHr) {//Swap if the end time is smaller than start time 7037 var tmp = wso2vis.fn.getControlFromID(id).endHr; 7038 wso2vis.fn.getControlFromID(id).endHr = wso2vis.fn.getControlFromID(id).startHr; 7039 wso2vis.fn.getControlFromID(id).startHr = tmp; 7040 } 7041 for (var i = 0; i < allDivs.length; i++) { 7042 if (allDivs[i].title <= wso2vis.fn.getControlFromID(id).endHr && allDivs[i].title >= wso2vis.fn.getControlFromID(id).startHr) { 7043 YAHOO.util.Dom.addClass(allDivs[i], 'selected'); 7044 } 7045 else { 7046 YAHOO.util.Dom.removeClass(allDivs[i], 'selected'); 7047 } 7048 } 7049 wso2vis.fn.getControlFromID(id).startEndHrState = "endSet"; 7050 7051 //set the headers and the text boxes 7052 var dStart = new Date(wso2vis.fn.getControlFromID(id).startHr); 7053 var dEnd = new Date(wso2vis.fn.getControlFromID(id).endHr); 7054 inTxt.value = (dStart.getMonth() + 1) + "/" + dStart.getDate() + "/" + dStart.getFullYear(); 7055 outTxt.value = (dEnd.getMonth() + 1) + "/" + dEnd.getDate() + "/" + dEnd.getFullYear(); 7056 var tmpString = getStringMonth(dStart.getMonth()) + ' ' + dStart.getDate() + ',' + dStart.getFullYear() + ' -> ' + getStringMonth(dEnd.getMonth()) + ' ' + dEnd.getDate() + ',' + dEnd.getFullYear(); 7057 dateDisplay.innerHTML = tmpString; 7058 } 7059 }; 7060 7061 wso2vis.fn.toggleDateSelector = function(id) { 7062 var anim = ""; 7063 var attributes = ""; 7064 var datesSelectionBox = document.getElementById('datesSelectionBox' + id); 7065 var imgObj = document.getElementById('imgObj'+id); 7066 if (datesSelectionBox.style.display == "none") { 7067 attributes = { 7068 opacity: { to: 1 }, 7069 height: { to: 230 } 7070 }; 7071 anim = new YAHOO.util.Anim('datesSelectionBox' + id, attributes); 7072 datesSelectionBox.style.display = ""; 7073 imgObj.src = "../images/up.png"; 7074 } else { 7075 attributes = { 7076 opacity: { to: 0 }, 7077 height: { to: 0 } 7078 }; 7079 anim = new YAHOO.util.Anim('datesSelectionBox' + id, attributes); 7080 7081 anim.onComplete.subscribe(function() { 7082 datesSelectionBox.style.display = "none"; 7083 }, datesSelectionBox); 7084 imgObj.src = "../images/down.png"; 7085 } 7086 7087 anim.duration = 0.3; 7088 anim.animate(); 7089 } 7090 7091 7092 7093