changeset 83:e0dadfad3dc4 laserkard

going to try a pure raphael solution
author Robert McIntyre <rlm@mit.edu>
date Sun, 25 Jul 2010 21:46:00 -0400
parents da3028a52ac1
children 49d553c19407
files access.log buy2.html buy2.js buy3.js js-lib/raphael.js
diffstat 5 files changed, 3696 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/access.log	Sun Jul 25 10:14:05 2010 -0400
     1.2 +++ b/access.log	Sun Jul 25 21:46:00 2010 -0400
     1.3 @@ -2070,3 +2070,95 @@
     1.4  127.0.0.1 laserkard.localhost - [25/Jul/2010:10:13:12 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     1.5  127.0.0.1 laserkard.localhost - [25/Jul/2010:10:13:13 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     1.6  127.0.0.1 laserkard.localhost - [25/Jul/2010:10:13:23 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     1.7 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:47 -0400] "GET /buy2.html HTTP/1.1" 200 433 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     1.8 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     1.9 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.10 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.11 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.12 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /buy2.js HTTP/1.1" 200 2127 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.13 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:48 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.14 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:49 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.15 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:49 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.16 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:49 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.17 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:49 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.18 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:50 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.19 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:50 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.20 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:14:53 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.21 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:49 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.22 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:50 -0400] "GET /buy2.html HTTP/1.1" 200 433 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.23 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:50 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.24 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.25 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.26 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.27 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy2.js HTTP/1.1" 200 2140 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.28 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.29 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.30 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.31 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.32 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:51 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.33 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:52 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.34 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:53 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.35 +127.0.0.1 laserkard.localhost - [25/Jul/2010:10:16:56 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.36 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:03:02 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.37 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:03:03 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.38 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:03:04 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.39 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:40 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.40 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:40 -0400] "GET /buy2.html HTTP/1.1" 200 445 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.41 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.42 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.43 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.44 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.45 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy2.js HTTP/1.1" 200 2158 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.46 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.47 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.48 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.49 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.50 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:41 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.51 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:42 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.52 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:43 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.53 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:12:44 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.54 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /buy2.html HTTP/1.1" 200 445 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.55 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.56 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.57 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.58 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.59 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /buy2.js HTTP/1.1" 200 2296 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.60 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:36 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.61 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:37 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.62 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:37 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.63 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:37 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.64 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:37 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.65 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:39 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.66 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:40 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.67 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:17:41 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.68 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:19:38 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.69 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:19:40 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.70 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:19:43 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.71 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:41 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.72 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:41 -0400] "GET /buy2.html HTTP/1.1" 200 445 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.73 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.74 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.75 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.76 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.77 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy2.js HTTP/1.1" 200 2347 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.78 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.79 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.80 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.81 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.82 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:42 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.83 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:43 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.84 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:21:44 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.85 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:11 -0400] "GET /buy2.html HTTP/1.1" 200 438 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.86 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:11 -0400] "GET /css/buy2.css HTTP/1.1" 200 33 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.87 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /awesome_js/raphael.js HTTP/1.1" 200 133580 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.88 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /awesome_js/cufon-yui.js HTTP/1.1" 200 18257 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.89 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /js-lib/HeleveticaNeue.font.js HTTP/1.1" 200 72503 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.90 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy2.js HTTP/1.1" 200 2347 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.91 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy-images/display-black.png HTTP/1.1" 200 1637 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.92 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy-images/select-green.png HTTP/1.1" 200 1087 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.93 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy-images/select-red.png HTTP/1.1" 200 1097 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.94 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy-images/select-blue.png HTTP/1.1" 200 992 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.95 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:12 -0400] "GET /buy-images/select-black.png HTTP/1.1" 200 744 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.96 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:13 -0400] "GET /buy-images/display-green.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.97 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:16 -0400] "GET /buy-images/display-red.png HTTP/1.1" 200 1641 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
    1.98 +127.0.0.1 laserkard.localhost - [25/Jul/2010:21:22:19 -0400] "GET /buy-images/display-blue.png HTTP/1.1" 200 1643 "http://laserkard.localhost/buy2.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7"
     2.1 --- a/buy2.html	Sun Jul 25 10:14:05 2010 -0400
     2.2 +++ b/buy2.html	Sun Jul 25 21:46:00 2010 -0400
     2.3 @@ -3,19 +3,14 @@
     2.4    <head>
     2.5      <link href="./css/buy2.css" rel="stylesheet" type="text/css"></link>
     2.6    
     2.7 -    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" 
     2.8 -	  rel="stylesheet" type="text/css"/>
     2.9 -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    2.10 -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    2.11 -  
    2.12 -<!--  <script type="text/javascript" src="/js-lib/jquery.js"></script> -->
    2.13 -    <script type="text/javascript" src="./awesome_js/raphael.js"></script>
    2.14 +    <script type="text/javascript" src="/js-lib/jquery.js"></script>
    2.15 +    <script type="text/javascript" src="./js-lib/raphael.js"></script>
    2.16      <script type="text/javascript" src="./awesome_js/cufon-yui.js"></script>
    2.17      <script type="text/javascript" src="./js-lib/HeleveticaNeue.font.js"></script>
    2.18      <script type="text/javascript" src="/buy2.js"></script>
    2.19   </head>
    2.20    <body>
    2.21 -    
    2.22 +    <div id="debug"></div>
    2.23      <div id="color-select">
    2.24        <ul>
    2.25  	<li class="select-green"><img src="buy-images/select-green.png"></img></li>
    2.26 @@ -24,7 +19,16 @@
    2.27  	<li class="select-black"><img src="buy-images/select-black.png"></img></li>
    2.28        </ul>
    2.29      </div>
    2.30 -    <div id="debug"></div>
    2.31 +    <div id="style-select">
    2.32 +      <ul>
    2.33 +	<li class="select-green"><img src="buy-images/select-green.png"></img></li>
    2.34 +	<li class="select-red"><img src="buy-images/select-red.png"></img></li>
    2.35 +	<li class="select-blue"><img src="buy-images/select-blue.png"></img></li>
    2.36 +	<li class="select-black"><img src="buy-images/select-black.png"></img></li>
    2.37 +      </ul>
    2.38 +    </div>
    2.39 +    
    2.40 +    <div id="pokedex"></div>
    2.41      <div id="card-display">
    2.42        <img src="buy-images/display-black.png"> </img>
    2.43      </div>
     3.1 --- a/buy2.js	Sun Jul 25 10:14:05 2010 -0400
     3.2 +++ b/buy2.js	Sun Jul 25 21:46:00 2010 -0400
     3.3 @@ -1,18 +1,20 @@
     3.4 +//expects: Raphael.js, jQuery.js
     3.5 +
     3.6  
     3.7  var Buy = 
     3.8      /* main LaserKard function.  Deals with updating the order. 
     3.9         expects the following:
    3.10         
    3.11 -       classes:
    3.12 +       class:
    3.13         select-green
    3.14         select-red
    3.15         select-blue
    3.16         select-black
    3.17         
    3.18 -       ids:
    3.19 +       id:
    3.20         card-display
    3.21         color-select
    3.22 -       
    3.23 +       pokedex
    3.24       */
    3.25  
    3.26  (function (){ 
    3.27 @@ -23,6 +25,12 @@
    3.28       quantity: 30,
    3.29       content: undefined,
    3.30       info: undefined};
    3.31 +    
    3.32 +    var display = 
    3.33 +    {green: "buy-images/display-green.png",
    3.34 +     red:   "buy-images/display-red.png",
    3.35 +     blue:  "buy-images/display-blue.png",
    3.36 +     black: "buy-images/display-black.png"};
    3.37  
    3.38      var raphe = undefined;
    3.39      
    3.40 @@ -35,42 +43,46 @@
    3.41  	    });
    3.42      
    3.43      var drawRect = (function (){raphe.rect(0,0,337,212);});
    3.44 +
    3.45 +    var update_style = (function (){
    3.46 +    	    var info = undefined;
    3.47 +    	    return (function () {
    3.48 +		    if (order.info === info){}
    3.49 +		    else {
    3.50 +			info = order.info;
    3.51 +			$("#pokedex").html(order.info);
    3.52 +		    }});})();
    3.53 +
    3.54 +    var update_pokedex = (function (){
    3.55 +    	    var info = undefined;
    3.56 +    	    return (function () {
    3.57 +		    if (order.info === info){}
    3.58 +		    else {
    3.59 +			info = order.info;
    3.60 +			$("#pokedex").html(order.info);
    3.61 +		    }});})();
    3.62      
    3.63 -    var display = 
    3.64 -    {green: "buy-images/display-green.png",
    3.65 -     red:   "buy-images/display-red.png",
    3.66 -     blue:  "buy-images/display-blue.png",
    3.67 -     black: "buy-images/display-black.png"};
    3.68 -
    3.69      var update_color = (function (){
    3.70      	    var color = undefined;
    3.71      	    return (function () {
    3.72 -		    if (order.color === color){$("#debug").html("REPEAT!");}
    3.73 +		    if (order.color === color){}
    3.74  		    else {
    3.75  			color = order.color;
    3.76 -			
    3.77 +			$("#debug").append("color change");
    3.78 +			$("#card-display > img").attr("src", display[(order.color)]);	
    3.79  			$(".selected").removeClass("selected");
    3.80  			$(".select-"+order.color).addClass("selected");
    3.81  		    }});})();
    3.82      
    3.83 -    var update_display = (function (){
    3.84 -    	    var color = undefined;
    3.85 -    	    return (function () {
    3.86 -		    if (order.color === color){}
    3.87 -		    else {
    3.88 -			$("#debug").html("make displayings!!! Sexy Time!!!");
    3.89 -			color = order.color;
    3.90 -			$("#card-display > img").attr("src", display[(order.color)]);
    3.91 -						
    3.92 -		    }});})();
    3.93 -    
    3.94      var update_info = (function (){});
    3.95 -    
    3.96 -    
    3.97 +       
    3.98      var update = (function (){
    3.99 -    	    update_color();
   3.100 -	    update_display();
   3.101 -    	    update_info();});
   3.102 +    	    update_style();
   3.103 +	    update_pokedex();
   3.104 +	    update_color();
   3.105 +	    
   3.106 +    	    update_info();
   3.107 +	});
   3.108  	    
   3.109      return {init : init,
   3.110  	    draw : drawRect,
   3.111 @@ -81,7 +93,6 @@
   3.112  
   3.113  
   3.114  $(document).ready(function() {
   3.115 -	//	$("#color-select").html("Hello World");
   3.116  	Buy.init();
   3.117  	Buy.draw();
   3.118  	$("#radio1").buttonset();
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/buy3.js	Sun Jul 25 21:46:00 2010 -0400
     4.3 @@ -0,0 +1,37 @@
     4.4 +<!doctype html>
     4.5 +<html>
     4.6 +  <head>
     4.7 +    <link href="./css/buy2.css" rel="stylesheet" type="text/css"></link>
     4.8 +  
     4.9 +    <script type="text/javascript" src="/js-lib/jquery.js"></script>
    4.10 +    <script type="text/javascript" src="./js-lib/raphael.js"></script>
    4.11 +    <script type="text/javascript" src="./awesome_js/cufon-yui.js"></script>
    4.12 +    <script type="text/javascript" src="./js-lib/HeleveticaNeue.font.js"></script>
    4.13 +    <script type="text/javascript" src="/buy2.js"></script>
    4.14 + </head>
    4.15 +  <body>
    4.16 +    <div id="debug"></div>
    4.17 +    <div id="color-select">
    4.18 +      <ul>
    4.19 +	<li class="select-green"><img src="buy-images/select-green.png"></img></li>
    4.20 +	<li class="select-red"><img src="buy-images/select-red.png"></img></li>
    4.21 +	<li class="select-blue"><img src="buy-images/select-blue.png"></img></li>
    4.22 +	<li class="select-black"><img src="buy-images/select-black.png"></img></li>
    4.23 +      </ul>
    4.24 +    </div>
    4.25 +    <div id="style-select">
    4.26 +      <ul>
    4.27 +	<li class="select-green"><img src="buy-images/select-green.png"></img></li>
    4.28 +	<li class="select-red"><img src="buy-images/select-red.png"></img></li>
    4.29 +	<li class="select-blue"><img src="buy-images/select-blue.png"></img></li>
    4.30 +	<li class="select-black"><img src="buy-images/select-black.png"></img></li>
    4.31 +      </ul>
    4.32 +    </div>
    4.33 +    
    4.34 +    <div id="pokedex"></div>
    4.35 +    <div id="card-display">
    4.36 +      <img src="buy-images/display-black.png"> </img>
    4.37 +    </div>
    4.38 +
    4.39 +  </body>
    4.40 +</html>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/js-lib/raphael.js	Sun Jul 25 21:46:00 2010 -0400
     5.3 @@ -0,0 +1,3515 @@
     5.4 +/*!
     5.5 + * Raphael 1.4.7 - JavaScript Vector Library
     5.6 + *
     5.7 + * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
     5.8 + * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
     5.9 + */
    5.10 + 
    5.11 +Raphael = (function () {
    5.12 +    function R() {
    5.13 +        if (R.is(arguments[0], array)) {
    5.14 +            var a = arguments[0],
    5.15 +                cnv = create[apply](R, a.splice(0, 3 + R.is(a[0], nu))),
    5.16 +                res = cnv.set();
    5.17 +            for (var i = 0, ii = a[length]; i < ii; i++) {
    5.18 +                var j = a[i] || {};
    5.19 +                elements.test(j.type) && res[push](cnv[j.type]().attr(j));
    5.20 +            }
    5.21 +            return res;
    5.22 +        }
    5.23 +        return create[apply](R, arguments);
    5.24 +    }
    5.25 +    R.version = "1.4.7";
    5.26 +    var separator = /[, ]+/,
    5.27 +        elements = /^(circle|rect|path|ellipse|text|image)$/,
    5.28 +        proto = "prototype",
    5.29 +        has = "hasOwnProperty",
    5.30 +        doc = document,
    5.31 +        win = window,
    5.32 +        oldRaphael = {
    5.33 +            was: Object[proto][has].call(win, "Raphael"),
    5.34 +            is: win.Raphael
    5.35 +        },
    5.36 +        Paper = function () {},
    5.37 +        appendChild = "appendChild",
    5.38 +        apply = "apply",
    5.39 +        concat = "concat",
    5.40 +        supportsTouch = "createTouch" in doc,
    5.41 +        E = "",
    5.42 +        S = " ",
    5.43 +        Str = String,
    5.44 +        split = "split",
    5.45 +        events = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[split](S),
    5.46 +        touchMap = {
    5.47 +            mousedown: "touchstart",
    5.48 +            mousemove: "touchmove",
    5.49 +            mouseup: "touchend"
    5.50 +        },
    5.51 +        join = "join",
    5.52 +        length = "length",
    5.53 +        lowerCase = String[proto].toLowerCase,
    5.54 +        math = Math,
    5.55 +        mmax = math.max,
    5.56 +        mmin = math.min,
    5.57 +        nu = "number",
    5.58 +        string = "string",
    5.59 +        array = "array",
    5.60 +        toString = "toString",
    5.61 +        fillString = "fill",
    5.62 +        objectToString = Object[proto][toString],
    5.63 +        paper = {},
    5.64 +        pow = math.pow,
    5.65 +        push = "push",
    5.66 +        rg = /^(?=[\da-f]$)/,
    5.67 +        ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
    5.68 +        colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
    5.69 +        round = math.round,
    5.70 +        setAttribute = "setAttribute",
    5.71 +        toFloat = parseFloat,
    5.72 +        toInt = parseInt,
    5.73 +        ms = " progid:DXImageTransform.Microsoft",
    5.74 +        upperCase = String[proto].toUpperCase,
    5.75 +        availableAttrs = {blur: 0, "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},
    5.76 +        availableAnimAttrs = {along: "along", blur: nu, "clip-rect": "csv", cx: nu, cy: nu, fill: "colour", "fill-opacity": nu, "font-size": nu, height: nu, opacity: nu, path: "path", r: nu, rotation: "csv", rx: nu, ry: nu, scale: "csv", stroke: "colour", "stroke-opacity": nu, "stroke-width": nu, translation: "csv", width: nu, x: nu, y: nu},
    5.77 +        rp = "replace";
    5.78 +    R.type = (win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
    5.79 +    if (R.type == "VML") {
    5.80 +        var d = doc.createElement("div"),
    5.81 +            b;
    5.82 +        d.innerHTML = '<v:shape adj="1"/>';
    5.83 +        b = d.firstChild;
    5.84 +        b.style.behavior = "url(#default#VML)";
    5.85 +        if (!(b && typeof b.adj == "object")) {
    5.86 +            return R.type = null;
    5.87 +        }
    5.88 +        d = null;
    5.89 +    }
    5.90 +    R.svg = !(R.vml = R.type == "VML");
    5.91 +    Paper[proto] = R[proto];
    5.92 +    R._id = 0;
    5.93 +    R._oid = 0;
    5.94 +    R.fn = {};
    5.95 +    R.is = function (o, type) {
    5.96 +        type = lowerCase.call(type);
    5.97 +        return  (type == "object" && o === Object(o)) ||
    5.98 +                (type == "undefined" && typeof o == type) ||
    5.99 +                (type == "null" && o == null) ||
   5.100 +                (type == "array" && Array.isArray && Array.isArray(o)) ||
   5.101 +                lowerCase.call(objectToString.call(o).slice(8, -1)) == type;
   5.102 +    };
   5.103 +
   5.104 +    R.setWindow = function (newwin) {
   5.105 +        win = newwin;
   5.106 +        doc = win.document;
   5.107 +    };
   5.108 +    // colour utilities
   5.109 +    var toHex = function (color) {
   5.110 +        if (R.vml) {
   5.111 +            // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/
   5.112 +            var trim = /^\s+|\s+$/g;
   5.113 +            toHex = cacher(function (color) {
   5.114 +                var bod;
   5.115 +                color = Str(color)[rp](trim, E);
   5.116 +                try {
   5.117 +                    var docum = new win.ActiveXObject("htmlfile");
   5.118 +                    docum.write("<body>");
   5.119 +                    docum.close();
   5.120 +                    bod = docum.body;
   5.121 +                } catch(e) {
   5.122 +                    bod = win.createPopup().document.body;
   5.123 +                }
   5.124 +                var range = bod.createTextRange();
   5.125 +                try {
   5.126 +                    bod.style.color = color;
   5.127 +                    var value = range.queryCommandValue("ForeColor");
   5.128 +                    value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16);
   5.129 +                    return "#" + ("000000" + value[toString](16)).slice(-6);
   5.130 +                } catch(e) {
   5.131 +                    return "none";
   5.132 +                }
   5.133 +            });
   5.134 +        } else {
   5.135 +            var i = doc.createElement("i");
   5.136 +            i.title = "Rapha\xebl Colour Picker";
   5.137 +            i.style.display = "none";
   5.138 +            doc.body[appendChild](i);
   5.139 +            toHex = cacher(function (color) {
   5.140 +                i.style.color = color;
   5.141 +                return doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
   5.142 +            });
   5.143 +        }
   5.144 +        return toHex(color);
   5.145 +    },
   5.146 +    hsbtoString = function () {
   5.147 +        return "hsb(" + [this.h, this.s, this.b] + ")";
   5.148 +    },
   5.149 +    hsltoString = function () {
   5.150 +        return "hsl(" + [this.h, this.s, this.l] + ")";
   5.151 +    },
   5.152 +    rgbtoString = function () {
   5.153 +        return this.hex;
   5.154 +    };
   5.155 +    R.hsb2rgb = function (h, s, b) {
   5.156 +        if (R.is(h, "object") && "h" in h && "s" in h && "b" in h) {
   5.157 +            b = h.b;
   5.158 +            s = h.s;
   5.159 +            h = h.h;
   5.160 +        }
   5.161 +        return R.hsl2rgb(h, s, b / 2);
   5.162 +    };
   5.163 +    R.hsl2rgb = function (h, s, l) {
   5.164 +        if (R.is(h, "object") && "h" in h && "s" in h && "l" in h) {
   5.165 +            l = h.l;
   5.166 +            s = h.s;
   5.167 +            h = h.h;
   5.168 +        }
   5.169 +        if (h > 1 || s > 1 || l > 1) {
   5.170 +            h /= 255;
   5.171 +            s /= 255;
   5.172 +            l /= 255;
   5.173 +        }
   5.174 +        var rgb = {},
   5.175 +            channels = ["r", "g", "b"],
   5.176 +            t2, t1, t3, r, g, b;
   5.177 +        if (!s) {
   5.178 +            rgb = {
   5.179 +                r: l,
   5.180 +                g: l,
   5.181 +                b: l
   5.182 +            };
   5.183 +        } else {
   5.184 +            if (l < .5) {
   5.185 +                t2 = l * (1 + s);
   5.186 +            } else {
   5.187 +                t2 = l + s - l * s;
   5.188 +            }
   5.189 +            t1 = 2 * l - t2;
   5.190 +            for (var i = 0, ii = channels.length; i < ii; i++) {
   5.191 +                t3 = h + 1 / 3 * -(i - 1);
   5.192 +                t3 < 0 && t3++;
   5.193 +                t3 > 1 && t3--;
   5.194 +                if (t3 * 6 < 1) {
   5.195 +                    rgb[channels[i]] = t1 + (t2 - t1) * 6 * t3;
   5.196 +                } else if (t3 * 2 < 1) {
   5.197 +                    rgb[channels[i]] = t2;
   5.198 +                } else if (t3 * 3 < 2) {
   5.199 +                    rgb[channels[i]] = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
   5.200 +                } else {
   5.201 +                    rgb[channels[i]] = t1;
   5.202 +                }
   5.203 +            }
   5.204 +        }
   5.205 +        rgb.r *= 255;
   5.206 +        rgb.g *= 255;
   5.207 +        rgb.b *= 255;
   5.208 +        r = (~~rgb.r)[toString](16);
   5.209 +        g = (~~rgb.g)[toString](16);
   5.210 +        b = (~~rgb.b)[toString](16);
   5.211 +        r = r[rp](rg, "0");
   5.212 +        g = g[rp](rg, "0");
   5.213 +        b = b[rp](rg, "0");
   5.214 +        rgb.hex = "#" + r + g + b;
   5.215 +        rgb.toString = rgbtoString;
   5.216 +        return rgb;
   5.217 +    };
   5.218 +    R.rgb2hsb = function (red, green, blue) {
   5.219 +        if (green == null && R.is(red, "object") && "r" in red && "g" in red && "b" in red) {
   5.220 +            blue = red.b;
   5.221 +            green = red.g;
   5.222 +            red = red.r;
   5.223 +        }
   5.224 +        if (green == null && R.is(red, string)) {
   5.225 +            var clr = R.getRGB(red);
   5.226 +            red = clr.r;
   5.227 +            green = clr.g;
   5.228 +            blue = clr.b;
   5.229 +        }
   5.230 +        if (red > 1 || green > 1 || blue > 1) {
   5.231 +            red /= 255;
   5.232 +            green /= 255;
   5.233 +            blue /= 255;
   5.234 +        }
   5.235 +        var max = mmax(red, green, blue),
   5.236 +            min = mmin(red, green, blue),
   5.237 +            hue,
   5.238 +            saturation,
   5.239 +            brightness = max;
   5.240 +        if (min == max) {
   5.241 +            return {h: 0, s: 0, b: max, toString: hsbtoString};
   5.242 +        } else {
   5.243 +            var delta = (max - min);
   5.244 +            saturation = delta / max;
   5.245 +            if (red == max) {
   5.246 +                hue = (green - blue) / delta;
   5.247 +            } else if (green == max) {
   5.248 +                hue = 2 + ((blue - red) / delta);
   5.249 +            } else {
   5.250 +                hue = 4 + ((red - green) / delta);
   5.251 +            }
   5.252 +            hue /= 6;
   5.253 +            hue < 0 && hue++;
   5.254 +            hue > 1 && hue--;
   5.255 +        }
   5.256 +        return {h: hue, s: saturation, b: brightness, toString: hsbtoString};
   5.257 +    };
   5.258 +    R.rgb2hsl = function (red, green, blue) {
   5.259 +        if (green == null && R.is(red, "object") && "r" in red && "g" in red && "b" in red) {
   5.260 +            blue = red.b;
   5.261 +            green = red.g;
   5.262 +            red = red.r;
   5.263 +        }
   5.264 +        if (green == null && R.is(red, string)) {
   5.265 +            var clr = R.getRGB(red);
   5.266 +            red = clr.r;
   5.267 +            green = clr.g;
   5.268 +            blue = clr.b;
   5.269 +        }
   5.270 +        if (red > 1 || green > 1 || blue > 1) {
   5.271 +            red /= 255;
   5.272 +            green /= 255;
   5.273 +            blue /= 255;
   5.274 +        }
   5.275 +        var max = mmax(red, green, blue),
   5.276 +            min = mmin(red, green, blue),
   5.277 +            h,
   5.278 +            s,
   5.279 +            l = (max + min) / 2,
   5.280 +            hsl;
   5.281 +        if (min == max) {
   5.282 +            hsl =  {h: 0, s: 0, l: l};
   5.283 +        } else {
   5.284 +            var delta = max - min;
   5.285 +            s = l < .5 ? delta / (max + min) : delta / (2 - max - min);
   5.286 +            if (red == max) {
   5.287 +                h = (green - blue) / delta;
   5.288 +            } else if (green == max) {
   5.289 +                h = 2 + (blue - red) / delta;
   5.290 +            } else {
   5.291 +                h = 4 + (red - green) / delta;
   5.292 +            }
   5.293 +            h /= 6;
   5.294 +            h < 0 && h++;
   5.295 +            h > 1 && h--;
   5.296 +            hsl = {h: h, s: s, l: l};
   5.297 +        }
   5.298 +        hsl.toString = hsltoString;
   5.299 +        return hsl;
   5.300 +    };
   5.301 +    var p2s = /,?([achlmqrstvxz]),?/gi,
   5.302 +        commaSpaces = /\s*,\s*/,
   5.303 +        hsrg = {hs: 1, rg: 1};
   5.304 +    R._path2string = function () {
   5.305 +        return this.join(",")[rp](p2s, "$1");
   5.306 +    };
   5.307 +    function cacher(f, scope, postprocessor) {
   5.308 +        function newf() {
   5.309 +            var arg = Array[proto].slice.call(arguments, 0),
   5.310 +                args = arg[join]("\u25ba"),
   5.311 +                cache = newf.cache = newf.cache || {},
   5.312 +                count = newf.count = newf.count || [];
   5.313 +            if (cache[has](args)) {
   5.314 +                return postprocessor ? postprocessor(cache[args]) : cache[args];
   5.315 +            }
   5.316 +            count[length] >= 1e3 && delete cache[count.shift()];
   5.317 +            count[push](args);
   5.318 +            cache[args] = f[apply](scope, arg);
   5.319 +            return postprocessor ? postprocessor(cache[args]) : cache[args];
   5.320 +        }
   5.321 +        return newf;
   5.322 +    }
   5.323 + 
   5.324 +    R.getRGB = cacher(function (colour) {
   5.325 +        if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
   5.326 +            return {r: -1, g: -1, b: -1, hex: "none", error: 1};
   5.327 +        }
   5.328 +        if (colour == "none") {
   5.329 +            return {r: -1, g: -1, b: -1, hex: "none"};
   5.330 +        }
   5.331 +        !(hsrg[has](colour.substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
   5.332 +        var res,
   5.333 +            red,
   5.334 +            green,
   5.335 +            blue,
   5.336 +            opacity,
   5.337 +            t,
   5.338 +            rgb = colour.match(colourRegExp);
   5.339 +        if (rgb) {
   5.340 +            if (rgb[2]) {
   5.341 +                blue = toInt(rgb[2].substring(5), 16);
   5.342 +                green = toInt(rgb[2].substring(3, 5), 16);
   5.343 +                red = toInt(rgb[2].substring(1, 3), 16);
   5.344 +            }
   5.345 +            if (rgb[3]) {
   5.346 +                blue = toInt((t = rgb[3].charAt(3)) + t, 16);
   5.347 +                green = toInt((t = rgb[3].charAt(2)) + t, 16);
   5.348 +                red = toInt((t = rgb[3].charAt(1)) + t, 16);
   5.349 +            }
   5.350 +            if (rgb[4]) {
   5.351 +                rgb = rgb[4][split](commaSpaces);
   5.352 +                red = toFloat(rgb[0]);
   5.353 +                green = toFloat(rgb[1]);
   5.354 +                blue = toFloat(rgb[2]);
   5.355 +                opacity = toFloat(rgb[3]);
   5.356 +            }
   5.357 +            if (rgb[5]) {
   5.358 +                rgb = rgb[5][split](commaSpaces);
   5.359 +                red = toFloat(rgb[0]) * 2.55;
   5.360 +                green = toFloat(rgb[1]) * 2.55;
   5.361 +                blue = toFloat(rgb[2]) * 2.55;
   5.362 +                opacity = toFloat(rgb[3]);
   5.363 +            }
   5.364 +            if (rgb[6]) {
   5.365 +                rgb = rgb[6][split](commaSpaces);
   5.366 +                red = toFloat(rgb[0]);
   5.367 +                green = toFloat(rgb[1]);
   5.368 +                blue = toFloat(rgb[2]);
   5.369 +                (rgb[0].slice(-3) == "deg" || rgb[0].slice(-1) == "\xb0") && (red /= 360);
   5.370 +                return R.hsb2rgb(red, green, blue);
   5.371 +            }
   5.372 +            if (rgb[7]) {
   5.373 +                rgb = rgb[7][split](commaSpaces);
   5.374 +                red = toFloat(rgb[0]) * 2.55;
   5.375 +                green = toFloat(rgb[1]) * 2.55;
   5.376 +                blue = toFloat(rgb[2]) * 2.55;
   5.377 +                (rgb[0].slice(-3) == "deg" || rgb[0].slice(-1) == "\xb0") && (red /= 360 * 2.55);
   5.378 +                return R.hsb2rgb(red, green, blue);
   5.379 +            }
   5.380 +            if (rgb[8]) {
   5.381 +                rgb = rgb[8][split](commaSpaces);
   5.382 +                red = toFloat(rgb[0]);
   5.383 +                green = toFloat(rgb[1]);
   5.384 +                blue = toFloat(rgb[2]);
   5.385 +                (rgb[0].slice(-3) == "deg" || rgb[0].slice(-1) == "\xb0") && (red /= 360);
   5.386 +                return R.hsl2rgb(red, green, blue);
   5.387 +            }
   5.388 +            if (rgb[9]) {
   5.389 +                rgb = rgb[9][split](commaSpaces);
   5.390 +                red = toFloat(rgb[0]) * 2.55;
   5.391 +                green = toFloat(rgb[1]) * 2.55;
   5.392 +                blue = toFloat(rgb[2]) * 2.55;
   5.393 +                (rgb[0].slice(-3) == "deg" || rgb[0].slice(-1) == "\xb0") && (red /= 360 * 2.55);
   5.394 +                return R.hsl2rgb(red, green, blue);
   5.395 +            }
   5.396 +            rgb = {r: red, g: green, b: blue};
   5.397 +            var r = (~~red)[toString](16),
   5.398 +                g = (~~green)[toString](16),
   5.399 +                b = (~~blue)[toString](16);
   5.400 +            r = r[rp](rg, "0");
   5.401 +            g = g[rp](rg, "0");
   5.402 +            b = b[rp](rg, "0");
   5.403 +            rgb.hex = "#" + r + g + b;
   5.404 +            isFinite(toFloat(opacity)) && (rgb.o = opacity);
   5.405 +            return rgb;
   5.406 +        }
   5.407 +        return {r: -1, g: -1, b: -1, hex: "none", error: 1};
   5.408 +    }, R);
   5.409 +    R.getColor = function (value) {
   5.410 +        var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75},
   5.411 +            rgb = this.hsb2rgb(start.h, start.s, start.b);
   5.412 +        start.h += .075;
   5.413 +        if (start.h > 1) {
   5.414 +            start.h = 0;
   5.415 +            start.s -= .2;
   5.416 +            start.s <= 0 && (this.getColor.start = {h: 0, s: 1, b: start.b});
   5.417 +        }
   5.418 +        return rgb.hex;
   5.419 +    };
   5.420 +    R.getColor.reset = function () {
   5.421 +        delete this.start;
   5.422 +    };
   5.423 +    // path utilities
   5.424 +    var pathCommand = /([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
   5.425 +        pathValues = /(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;
   5.426 +    R.parsePathString = cacher(function (pathString) {
   5.427 +        if (!pathString) {
   5.428 +            return null;
   5.429 +        }
   5.430 +        var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0},
   5.431 +            data = [];
   5.432 +        if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption
   5.433 +            data = pathClone(pathString);
   5.434 +        }
   5.435 +        if (!data[length]) {
   5.436 +            Str(pathString)[rp](pathCommand, function (a, b, c) {
   5.437 +                var params = [],
   5.438 +                    name = lowerCase.call(b);
   5.439 +                c[rp](pathValues, function (a, b) {
   5.440 +                    b && params[push](+b);
   5.441 +                });
   5.442 +                if (name == "m" && params[length] > 2) {
   5.443 +                    data[push]([b][concat](params.splice(0, 2)));
   5.444 +                    name = "l";
   5.445 +                    b = b == "m" ? "l" : "L";
   5.446 +                }
   5.447 +                while (params[length] >= paramCounts[name]) {
   5.448 +                    data[push]([b][concat](params.splice(0, paramCounts[name])));
   5.449 +                    if (!paramCounts[name]) {
   5.450 +                        break;
   5.451 +                    }
   5.452 +                }
   5.453 +            });
   5.454 +        }
   5.455 +        data[toString] = R._path2string;
   5.456 +        return data;
   5.457 +    });
   5.458 +    R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
   5.459 +        var t1 = 1 - t,
   5.460 +            x = pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
   5.461 +            y = pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y,
   5.462 +            mx = p1x + 2 * t * (c1x - p1x) + t * t * (c2x - 2 * c1x + p1x),
   5.463 +            my = p1y + 2 * t * (c1y - p1y) + t * t * (c2y - 2 * c1y + p1y),
   5.464 +            nx = c1x + 2 * t * (c2x - c1x) + t * t * (p2x - 2 * c2x + c1x),
   5.465 +            ny = c1y + 2 * t * (c2y - c1y) + t * t * (p2y - 2 * c2y + c1y),
   5.466 +            ax = (1 - t) * p1x + t * c1x,
   5.467 +            ay = (1 - t) * p1y + t * c1y,
   5.468 +            cx = (1 - t) * c2x + t * p2x,
   5.469 +            cy = (1 - t) * c2y + t * p2y,
   5.470 +            alpha = (90 - math.atan((mx - nx) / (my - ny)) * 180 / math.PI);
   5.471 +        (mx > nx || my < ny) && (alpha += 180);
   5.472 +        return {x: x, y: y, m: {x: mx, y: my}, n: {x: nx, y: ny}, start: {x: ax, y: ay}, end: {x: cx, y: cy}, alpha: alpha};
   5.473 +    };
   5.474 +    var pathDimensions = cacher(function (path) {
   5.475 +        if (!path) {
   5.476 +            return {x: 0, y: 0, width: 0, height: 0};
   5.477 +        }
   5.478 +        path = path2curve(path);
   5.479 +        var x = 0, 
   5.480 +            y = 0,
   5.481 +            X = [],
   5.482 +            Y = [],
   5.483 +            p;
   5.484 +        for (var i = 0, ii = path[length]; i < ii; i++) {
   5.485 +            p = path[i];
   5.486 +            if (p[0] == "M") {
   5.487 +                x = p[1];
   5.488 +                y = p[2];
   5.489 +                X[push](x);
   5.490 +                Y[push](y);
   5.491 +            } else {
   5.492 +                var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
   5.493 +                X = X[concat](dim.min.x, dim.max.x);
   5.494 +                Y = Y[concat](dim.min.y, dim.max.y);
   5.495 +                x = p[5];
   5.496 +                y = p[6];
   5.497 +            }
   5.498 +        }
   5.499 +        var xmin = mmin[apply](0, X),
   5.500 +            ymin = mmin[apply](0, Y);
   5.501 +        return {
   5.502 +            x: xmin,
   5.503 +            y: ymin,
   5.504 +            width: mmax[apply](0, X) - xmin,
   5.505 +            height: mmax[apply](0, Y) - ymin
   5.506 +        };
   5.507 +    }),
   5.508 +        pathClone = function (pathArray) {
   5.509 +            var res = [];
   5.510 +            if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
   5.511 +                pathArray = R.parsePathString(pathArray);
   5.512 +            }
   5.513 +            for (var i = 0, ii = pathArray[length]; i < ii; i++) {
   5.514 +                res[i] = [];
   5.515 +                for (var j = 0, jj = pathArray[i][length]; j < jj; j++) {
   5.516 +                    res[i][j] = pathArray[i][j];
   5.517 +                }
   5.518 +            }
   5.519 +            res[toString] = R._path2string;
   5.520 +            return res;
   5.521 +        },
   5.522 +        pathToRelative = cacher(function (pathArray) {
   5.523 +            if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
   5.524 +                pathArray = R.parsePathString(pathArray);
   5.525 +            }
   5.526 +            var res = [],
   5.527 +                x = 0,
   5.528 +                y = 0,
   5.529 +                mx = 0,
   5.530 +                my = 0,
   5.531 +                start = 0;
   5.532 +            if (pathArray[0][0] == "M") {
   5.533 +                x = pathArray[0][1];
   5.534 +                y = pathArray[0][2];
   5.535 +                mx = x;
   5.536 +                my = y;
   5.537 +                start++;
   5.538 +                res[push](["M", x, y]);
   5.539 +            }
   5.540 +            for (var i = start, ii = pathArray[length]; i < ii; i++) {
   5.541 +                var r = res[i] = [],
   5.542 +                    pa = pathArray[i];
   5.543 +                if (pa[0] != lowerCase.call(pa[0])) {
   5.544 +                    r[0] = lowerCase.call(pa[0]);
   5.545 +                    switch (r[0]) {
   5.546 +                        case "a":
   5.547 +                            r[1] = pa[1];
   5.548 +                            r[2] = pa[2];
   5.549 +                            r[3] = pa[3];
   5.550 +                            r[4] = pa[4];
   5.551 +                            r[5] = pa[5];
   5.552 +                            r[6] = +(pa[6] - x).toFixed(3);
   5.553 +                            r[7] = +(pa[7] - y).toFixed(3);
   5.554 +                            break;
   5.555 +                        case "v":
   5.556 +                            r[1] = +(pa[1] - y).toFixed(3);
   5.557 +                            break;
   5.558 +                        case "m":
   5.559 +                            mx = pa[1];
   5.560 +                            my = pa[2];
   5.561 +                        default:
   5.562 +                            for (var j = 1, jj = pa[length]; j < jj; j++) {
   5.563 +                                r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
   5.564 +                            }
   5.565 +                    }
   5.566 +                } else {
   5.567 +                    r = res[i] = [];
   5.568 +                    if (pa[0] == "m") {
   5.569 +                        mx = pa[1] + x;
   5.570 +                        my = pa[2] + y;
   5.571 +                    }
   5.572 +                    for (var k = 0, kk = pa[length]; k < kk; k++) {
   5.573 +                        res[i][k] = pa[k];
   5.574 +                    }
   5.575 +                }
   5.576 +                var len = res[i][length];
   5.577 +                switch (res[i][0]) {
   5.578 +                    case "z":
   5.579 +                        x = mx;
   5.580 +                        y = my;
   5.581 +                        break;
   5.582 +                    case "h":
   5.583 +                        x += +res[i][len - 1];
   5.584 +                        break;
   5.585 +                    case "v":
   5.586 +                        y += +res[i][len - 1];
   5.587 +                        break;
   5.588 +                    default:
   5.589 +                        x += +res[i][len - 2];
   5.590 +                        y += +res[i][len - 1];
   5.591 +                }
   5.592 +            }
   5.593 +            res[toString] = R._path2string;
   5.594 +            return res;
   5.595 +        }, 0, pathClone),
   5.596 +        pathToAbsolute = cacher(function (pathArray) {
   5.597 +            if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
   5.598 +                pathArray = R.parsePathString(pathArray);
   5.599 +            }
   5.600 +            var res = [],
   5.601 +                x = 0,
   5.602 +                y = 0,
   5.603 +                mx = 0,
   5.604 +                my = 0,
   5.605 +                start = 0;
   5.606 +            if (pathArray[0][0] == "M") {
   5.607 +                x = +pathArray[0][1];
   5.608 +                y = +pathArray[0][2];
   5.609 +                mx = x;
   5.610 +                my = y;
   5.611 +                start++;
   5.612 +                res[0] = ["M", x, y];
   5.613 +            }
   5.614 +            for (var i = start, ii = pathArray[length]; i < ii; i++) {
   5.615 +                var r = res[i] = [],
   5.616 +                    pa = pathArray[i];
   5.617 +                if (pa[0] != upperCase.call(pa[0])) {
   5.618 +                    r[0] = upperCase.call(pa[0]);
   5.619 +                    switch (r[0]) {
   5.620 +                        case "A":
   5.621 +                            r[1] = pa[1];
   5.622 +                            r[2] = pa[2];
   5.623 +                            r[3] = pa[3];
   5.624 +                            r[4] = pa[4];
   5.625 +                            r[5] = pa[5];
   5.626 +                            r[6] = +(pa[6] + x);
   5.627 +                            r[7] = +(pa[7] + y);
   5.628 +                            break;
   5.629 +                        case "V":
   5.630 +                            r[1] = +pa[1] + y;
   5.631 +                            break;
   5.632 +                        case "H":
   5.633 +                            r[1] = +pa[1] + x;
   5.634 +                            break;
   5.635 +                        case "M":
   5.636 +                            mx = +pa[1] + x;
   5.637 +                            my = +pa[2] + y;
   5.638 +                        default:
   5.639 +                            for (var j = 1, jj = pa[length]; j < jj; j++) {
   5.640 +                                r[j] = +pa[j] + ((j % 2) ? x : y);
   5.641 +                            }
   5.642 +                    }
   5.643 +                } else {
   5.644 +                    for (var k = 0, kk = pa[length]; k < kk; k++) {
   5.645 +                        res[i][k] = pa[k];
   5.646 +                    }
   5.647 +                }
   5.648 +                switch (r[0]) {
   5.649 +                    case "Z":
   5.650 +                        x = mx;
   5.651 +                        y = my;
   5.652 +                        break;
   5.653 +                    case "H":
   5.654 +                        x = r[1];
   5.655 +                        break;
   5.656 +                    case "V":
   5.657 +                        y = r[1];
   5.658 +                        break;
   5.659 +                    case "M":
   5.660 +                        mx = res[i][res[i][length] - 2];
   5.661 +                        my = res[i][res[i][length] - 1];
   5.662 +                    default:
   5.663 +                        x = res[i][res[i][length] - 2];
   5.664 +                        y = res[i][res[i][length] - 1];
   5.665 +                }
   5.666 +            }
   5.667 +            res[toString] = R._path2string;
   5.668 +            return res;
   5.669 +        }, null, pathClone),
   5.670 +        l2c = function (x1, y1, x2, y2) {
   5.671 +            return [x1, y1, x2, y2, x2, y2];
   5.672 +        },
   5.673 +        q2c = function (x1, y1, ax, ay, x2, y2) {
   5.674 +            var _13 = 1 / 3,
   5.675 +                _23 = 2 / 3;
   5.676 +            return [
   5.677 +                    _13 * x1 + _23 * ax,
   5.678 +                    _13 * y1 + _23 * ay,
   5.679 +                    _13 * x2 + _23 * ax,
   5.680 +                    _13 * y2 + _23 * ay,
   5.681 +                    x2,
   5.682 +                    y2
   5.683 +                ];
   5.684 +        },
   5.685 +        a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
   5.686 +            // for more information of where this math came from visit:
   5.687 +            // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
   5.688 +            var PI = math.PI,
   5.689 +                _120 = PI * 120 / 180,
   5.690 +                rad = PI / 180 * (+angle || 0),
   5.691 +                res = [],
   5.692 +                xy,
   5.693 +                rotate = cacher(function (x, y, rad) {
   5.694 +                    var X = x * math.cos(rad) - y * math.sin(rad),
   5.695 +                        Y = x * math.sin(rad) + y * math.cos(rad);
   5.696 +                    return {x: X, y: Y};
   5.697 +                });
   5.698 +            if (!recursive) {
   5.699 +                xy = rotate(x1, y1, -rad);
   5.700 +                x1 = xy.x;
   5.701 +                y1 = xy.y;
   5.702 +                xy = rotate(x2, y2, -rad);
   5.703 +                x2 = xy.x;
   5.704 +                y2 = xy.y;
   5.705 +                var cos = math.cos(PI / 180 * angle),
   5.706 +                    sin = math.sin(PI / 180 * angle),
   5.707 +                    x = (x1 - x2) / 2,
   5.708 +                    y = (y1 - y2) / 2;
   5.709 +                var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
   5.710 +                if (h > 1) {
   5.711 +                    h = math.sqrt(h);
   5.712 +                    rx = h * rx;
   5.713 +                    ry = h * ry;
   5.714 +                }
   5.715 +                var rx2 = rx * rx,
   5.716 +                    ry2 = ry * ry,
   5.717 +                    k = (large_arc_flag == sweep_flag ? -1 : 1) *
   5.718 +                        math.sqrt(math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
   5.719 +                    cx = k * rx * y / ry + (x1 + x2) / 2,
   5.720 +                    cy = k * -ry * x / rx + (y1 + y2) / 2,
   5.721 +                    f1 = math.asin(((y1 - cy) / ry).toFixed(7)),
   5.722 +                    f2 = math.asin(((y2 - cy) / ry).toFixed(7));
   5.723 +
   5.724 +                f1 = x1 < cx ? PI - f1 : f1;
   5.725 +                f2 = x2 < cx ? PI - f2 : f2;
   5.726 +                f1 < 0 && (f1 = PI * 2 + f1);
   5.727 +                f2 < 0 && (f2 = PI * 2 + f2);
   5.728 +                if (sweep_flag && f1 > f2) {
   5.729 +                    f1 = f1 - PI * 2;
   5.730 +                }
   5.731 +                if (!sweep_flag && f2 > f1) {
   5.732 +                    f2 = f2 - PI * 2;
   5.733 +                }
   5.734 +            } else {
   5.735 +                f1 = recursive[0];
   5.736 +                f2 = recursive[1];
   5.737 +                cx = recursive[2];
   5.738 +                cy = recursive[3];
   5.739 +            }
   5.740 +            var df = f2 - f1;
   5.741 +            if (math.abs(df) > _120) {
   5.742 +                var f2old = f2,
   5.743 +                    x2old = x2,
   5.744 +                    y2old = y2;
   5.745 +                f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
   5.746 +                x2 = cx + rx * math.cos(f2);
   5.747 +                y2 = cy + ry * math.sin(f2);
   5.748 +                res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
   5.749 +            }
   5.750 +            df = f2 - f1;
   5.751 +            var c1 = math.cos(f1),
   5.752 +                s1 = math.sin(f1),
   5.753 +                c2 = math.cos(f2),
   5.754 +                s2 = math.sin(f2),
   5.755 +                t = math.tan(df / 4),
   5.756 +                hx = 4 / 3 * rx * t,
   5.757 +                hy = 4 / 3 * ry * t,
   5.758 +                m1 = [x1, y1],
   5.759 +                m2 = [x1 + hx * s1, y1 - hy * c1],
   5.760 +                m3 = [x2 + hx * s2, y2 - hy * c2],
   5.761 +                m4 = [x2, y2];
   5.762 +            m2[0] = 2 * m1[0] - m2[0];
   5.763 +            m2[1] = 2 * m1[1] - m2[1];
   5.764 +            if (recursive) {
   5.765 +                return [m2, m3, m4][concat](res);
   5.766 +            } else {
   5.767 +                res = [m2, m3, m4][concat](res)[join]()[split](",");
   5.768 +                var newres = [];
   5.769 +                for (var i = 0, ii = res[length]; i < ii; i++) {
   5.770 +                    newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
   5.771 +                }
   5.772 +                return newres;
   5.773 +            }
   5.774 +        },
   5.775 +        findDotAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
   5.776 +            var t1 = 1 - t;
   5.777 +            return {
   5.778 +                x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
   5.779 +                y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
   5.780 +            };
   5.781 +        },
   5.782 +        curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
   5.783 +            var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
   5.784 +                b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
   5.785 +                c = p1x - c1x,
   5.786 +                t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a,
   5.787 +                t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a,
   5.788 +                y = [p1y, p2y],
   5.789 +                x = [p1x, p2x],
   5.790 +                dot;
   5.791 +            math.abs(t1) > 1e12 && (t1 = .5);
   5.792 +            math.abs(t2) > 1e12 && (t2 = .5);
   5.793 +            if (t1 > 0 && t1 < 1) {
   5.794 +                dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
   5.795 +                x[push](dot.x);
   5.796 +                y[push](dot.y);
   5.797 +            }
   5.798 +            if (t2 > 0 && t2 < 1) {
   5.799 +                dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
   5.800 +                x[push](dot.x);
   5.801 +                y[push](dot.y);
   5.802 +            }
   5.803 +            a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y);
   5.804 +            b = 2 * (c1y - p1y) - 2 * (c2y - c1y);
   5.805 +            c = p1y - c1y;
   5.806 +            t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a;
   5.807 +            t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a;
   5.808 +            math.abs(t1) > 1e12 && (t1 = .5);
   5.809 +            math.abs(t2) > 1e12 && (t2 = .5);
   5.810 +            if (t1 > 0 && t1 < 1) {
   5.811 +                dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
   5.812 +                x[push](dot.x);
   5.813 +                y[push](dot.y);
   5.814 +            }
   5.815 +            if (t2 > 0 && t2 < 1) {
   5.816 +                dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
   5.817 +                x[push](dot.x);
   5.818 +                y[push](dot.y);
   5.819 +            }
   5.820 +            return {
   5.821 +                min: {x: mmin[apply](0, x), y: mmin[apply](0, y)},
   5.822 +                max: {x: mmax[apply](0, x), y: mmax[apply](0, y)}
   5.823 +            };
   5.824 +        }),
   5.825 +        path2curve = cacher(function (path, path2) {
   5.826 +            var p = pathToAbsolute(path),
   5.827 +                p2 = path2 && pathToAbsolute(path2),
   5.828 +                attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
   5.829 +                attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
   5.830 +                processPath = function (path, d) {
   5.831 +                    var nx, ny;
   5.832 +                    if (!path) {
   5.833 +                        return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
   5.834 +                    }
   5.835 +                    !(path[0] in {T:1, Q:1}) && (d.qx = d.qy = null);
   5.836 +                    switch (path[0]) {
   5.837 +                        case "M":
   5.838 +                            d.X = path[1];
   5.839 +                            d.Y = path[2];
   5.840 +                            break;
   5.841 +                        case "A":
   5.842 +                            path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
   5.843 +                            break;
   5.844 +                        case "S":
   5.845 +                            nx = d.x + (d.x - (d.bx || d.x));
   5.846 +                            ny = d.y + (d.y - (d.by || d.y));
   5.847 +                            path = ["C", nx, ny][concat](path.slice(1));
   5.848 +                            break;
   5.849 +                        case "T":
   5.850 +                            d.qx = d.x + (d.x - (d.qx || d.x));
   5.851 +                            d.qy = d.y + (d.y - (d.qy || d.y));
   5.852 +                            path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
   5.853 +                            break;
   5.854 +                        case "Q":
   5.855 +                            d.qx = path[1];
   5.856 +                            d.qy = path[2];
   5.857 +                            path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
   5.858 +                            break;
   5.859 +                        case "L":
   5.860 +                            path = ["C"][concat](l2c(d.x, d.y, path[1], path[2]));
   5.861 +                            break;
   5.862 +                        case "H":
   5.863 +                            path = ["C"][concat](l2c(d.x, d.y, path[1], d.y));
   5.864 +                            break;
   5.865 +                        case "V":
   5.866 +                            path = ["C"][concat](l2c(d.x, d.y, d.x, path[1]));
   5.867 +                            break;
   5.868 +                        case "Z":
   5.869 +                            path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y));
   5.870 +                            break;
   5.871 +                    }
   5.872 +                    return path;
   5.873 +                },
   5.874 +                fixArc = function (pp, i) {
   5.875 +                    if (pp[i][length] > 7) {
   5.876 +                        pp[i].shift();
   5.877 +                        var pi = pp[i];
   5.878 +                        while (pi[length]) {
   5.879 +                            pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
   5.880 +                        }
   5.881 +                        pp.splice(i, 1);
   5.882 +                        ii = mmax(p[length], p2 && p2[length] || 0);
   5.883 +                    }
   5.884 +                },
   5.885 +                fixM = function (path1, path2, a1, a2, i) {
   5.886 +                    if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
   5.887 +                        path2.splice(i, 0, ["M", a2.x, a2.y]);
   5.888 +                        a1.bx = 0;
   5.889 +                        a1.by = 0;
   5.890 +                        a1.x = path1[i][1];
   5.891 +                        a1.y = path1[i][2];
   5.892 +                        ii = mmax(p[length], p2 && p2[length] || 0);
   5.893 +                    }
   5.894 +                };
   5.895 +            for (var i = 0, ii = mmax(p[length], p2 && p2[length] || 0); i < ii; i++) {
   5.896 +                p[i] = processPath(p[i], attrs);
   5.897 +                fixArc(p, i);
   5.898 +                p2 && (p2[i] = processPath(p2[i], attrs2));
   5.899 +                p2 && fixArc(p2, i);
   5.900 +                fixM(p, p2, attrs, attrs2, i);
   5.901 +                fixM(p2, p, attrs2, attrs, i);
   5.902 +                var seg = p[i],
   5.903 +                    seg2 = p2 && p2[i],
   5.904 +                    seglen = seg[length],
   5.905 +                    seg2len = p2 && seg2[length];
   5.906 +                attrs.x = seg[seglen - 2];
   5.907 +                attrs.y = seg[seglen - 1];
   5.908 +                attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
   5.909 +                attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
   5.910 +                attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
   5.911 +                attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
   5.912 +                attrs2.x = p2 && seg2[seg2len - 2];
   5.913 +                attrs2.y = p2 && seg2[seg2len - 1];
   5.914 +            }
   5.915 +            return p2 ? [p, p2] : p;
   5.916 +        }, null, pathClone),
   5.917 +        parseDots = cacher(function (gradient) {
   5.918 +            var dots = [];
   5.919 +            for (var i = 0, ii = gradient[length]; i < ii; i++) {
   5.920 +                var dot = {},
   5.921 +                    par = gradient[i].match(/^([^:]*):?([\d\.]*)/);
   5.922 +                dot.color = R.getRGB(par[1]);
   5.923 +                if (dot.color.error) {
   5.924 +                    return null;
   5.925 +                }
   5.926 +                dot.color = dot.color.hex;
   5.927 +                par[2] && (dot.offset = par[2] + "%");
   5.928 +                dots[push](dot);
   5.929 +            }
   5.930 +            for (i = 1, ii = dots[length] - 1; i < ii; i++) {
   5.931 +                if (!dots[i].offset) {
   5.932 +                    var start = toFloat(dots[i - 1].offset || 0),
   5.933 +                        end = 0;
   5.934 +                    for (var j = i + 1; j < ii; j++) {
   5.935 +                        if (dots[j].offset) {
   5.936 +                            end = dots[j].offset;
   5.937 +                            break;
   5.938 +                        }
   5.939 +                    }
   5.940 +                    if (!end) {
   5.941 +                        end = 100;
   5.942 +                        j = ii;
   5.943 +                    }
   5.944 +                    end = toFloat(end);
   5.945 +                    var d = (end - start) / (j - i + 1);
   5.946 +                    for (; i < j; i++) {
   5.947 +                        start += d;
   5.948 +                        dots[i].offset = start + "%";
   5.949 +                    }
   5.950 +                }
   5.951 +            }
   5.952 +            return dots;
   5.953 +        }),
   5.954 +        getContainer = function (x, y, w, h) {
   5.955 +            var container;
   5.956 +            if (R.is(x, string) || R.is(x, "object")) {
   5.957 +                container = R.is(x, string) ? doc.getElementById(x) : x;
   5.958 +                if (container.tagName) {
   5.959 +                    if (y == null) {
   5.960 +                        return {
   5.961 +                            container: container,
   5.962 +                            width: container.style.pixelWidth || container.offsetWidth,
   5.963 +                            height: container.style.pixelHeight || container.offsetHeight
   5.964 +                        };
   5.965 +                    } else {
   5.966 +                        return {container: container, width: y, height: w};
   5.967 +                    }
   5.968 +                }
   5.969 +            } else {
   5.970 +                return {container: 1, x: x, y: y, width: w, height: h};
   5.971 +            }
   5.972 +        },
   5.973 +        plugins = function (con, add) {
   5.974 +            var that = this;
   5.975 +            for (var prop in add) {
   5.976 +                if (add[has](prop) && !(prop in con)) {
   5.977 +                    switch (typeof add[prop]) {
   5.978 +                        case "function":
   5.979 +                            (function (f) {
   5.980 +                                con[prop] = con === that ? f : function () { return f[apply](that, arguments); };
   5.981 +                            })(add[prop]);
   5.982 +                        break;
   5.983 +                        case "object":
   5.984 +                            con[prop] = con[prop] || {};
   5.985 +                            plugins.call(this, con[prop], add[prop]);
   5.986 +                        break;
   5.987 +                        default:
   5.988 +                            con[prop] = add[prop];
   5.989 +                        break;
   5.990 +                    }
   5.991 +                }
   5.992 +            }
   5.993 +        },
   5.994 +        tear = function (el, paper) {
   5.995 +            el == paper.top && (paper.top = el.prev);
   5.996 +            el == paper.bottom && (paper.bottom = el.next);
   5.997 +            el.next && (el.next.prev = el.prev);
   5.998 +            el.prev && (el.prev.next = el.next);
   5.999 +        },
  5.1000 +        tofront = function (el, paper) {
  5.1001 +            if (paper.top === el) {
  5.1002 +                return;
  5.1003 +            }
  5.1004 +            tear(el, paper);
  5.1005 +            el.next = null;
  5.1006 +            el.prev = paper.top;
  5.1007 +            paper.top.next = el;
  5.1008 +            paper.top = el;
  5.1009 +        },
  5.1010 +        toback = function (el, paper) {
  5.1011 +            if (paper.bottom === el) {
  5.1012 +                return;
  5.1013 +            }
  5.1014 +            tear(el, paper);
  5.1015 +            el.next = paper.bottom;
  5.1016 +            el.prev = null;
  5.1017 +            paper.bottom.prev = el;
  5.1018 +            paper.bottom = el;
  5.1019 +        },
  5.1020 +        insertafter = function (el, el2, paper) {
  5.1021 +            tear(el, paper);
  5.1022 +            el2 == paper.top && (paper.top = el);
  5.1023 +            el2.next && (el2.next.prev = el);
  5.1024 +            el.next = el2.next;
  5.1025 +            el.prev = el2;
  5.1026 +            el2.next = el;
  5.1027 +        },
  5.1028 +        insertbefore = function (el, el2, paper) {
  5.1029 +            tear(el, paper);
  5.1030 +            el2 == paper.bottom && (paper.bottom = el);
  5.1031 +            el2.prev && (el2.prev.next = el);
  5.1032 +            el.prev = el2.prev;
  5.1033 +            el2.prev = el;
  5.1034 +            el.next = el2;
  5.1035 +        },
  5.1036 +        removed = function (methodname) {
  5.1037 +            return function () {
  5.1038 +                throw new Error("Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object");
  5.1039 +            };
  5.1040 +        },
  5.1041 +        radial_gradient = /^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;
  5.1042 +    R.pathToRelative = pathToRelative;
  5.1043 +    // SVG
  5.1044 +    if (R.svg) {
  5.1045 +        Paper[proto].svgns = "http://www.w3.org/2000/svg";
  5.1046 +        Paper[proto].xlink = "http://www.w3.org/1999/xlink";
  5.1047 +        round = function (num) {
  5.1048 +            return +num + (~~num === num) * .5;
  5.1049 +        };
  5.1050 +        var $ = function (el, attr) {
  5.1051 +            if (attr) {
  5.1052 +                for (var key in attr) {
  5.1053 +                    if (attr[has](key)) {
  5.1054 +                        el[setAttribute](key, Str(attr[key]));
  5.1055 +                    }
  5.1056 +                }
  5.1057 +            } else {
  5.1058 +                el = doc.createElementNS(Paper[proto].svgns, el);
  5.1059 +                el.style.webkitTapHighlightColor = "rgba(0,0,0,0)";
  5.1060 +                return el;
  5.1061 +            }
  5.1062 +        };
  5.1063 +        R[toString] = function () {
  5.1064 +            return  "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version;
  5.1065 +        };
  5.1066 +        var thePath = function (pathString, SVG) {
  5.1067 +            var el = $("path");
  5.1068 +            SVG.canvas && SVG.canvas[appendChild](el);
  5.1069 +            var p = new Element(el, SVG);
  5.1070 +            p.type = "path";
  5.1071 +            setFillAndStroke(p, {fill: "none", stroke: "#000", path: pathString});
  5.1072 +            return p;
  5.1073 +        };
  5.1074 +        var addGradientFill = function (o, gradient, SVG) {
  5.1075 +            var type = "linear",
  5.1076 +                fx = .5, fy = .5,
  5.1077 +                s = o.style;
  5.1078 +            gradient = Str(gradient)[rp](radial_gradient, function (all, _fx, _fy) {
  5.1079 +                type = "radial";
  5.1080 +                if (_fx && _fy) {
  5.1081 +                    fx = toFloat(_fx);
  5.1082 +                    fy = toFloat(_fy);
  5.1083 +                    var dir = ((fy > .5) * 2 - 1);
  5.1084 +                    pow(fx - .5, 2) + pow(fy - .5, 2) > .25 &&
  5.1085 +                        (fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) &&
  5.1086 +                        fy != .5 &&
  5.1087 +                        (fy = fy.toFixed(5) - 1e-5 * dir);
  5.1088 +                }
  5.1089 +                return E;
  5.1090 +            });
  5.1091 +            gradient = gradient[split](/\s*\-\s*/);
  5.1092 +            if (type == "linear") {
  5.1093 +                var angle = gradient.shift();
  5.1094 +                angle = -toFloat(angle);
  5.1095 +                if (isNaN(angle)) {
  5.1096 +                    return null;
  5.1097 +                }
  5.1098 +                var vector = [0, 0, math.cos(angle * math.PI / 180), math.sin(angle * math.PI / 180)],
  5.1099 +                    max = 1 / (mmax(math.abs(vector[2]), math.abs(vector[3])) || 1);
  5.1100 +                vector[2] *= max;
  5.1101 +                vector[3] *= max;
  5.1102 +                if (vector[2] < 0) {
  5.1103 +                    vector[0] = -vector[2];
  5.1104 +                    vector[2] = 0;
  5.1105 +                }
  5.1106 +                if (vector[3] < 0) {
  5.1107 +                    vector[1] = -vector[3];
  5.1108 +                    vector[3] = 0;
  5.1109 +                }
  5.1110 +            }
  5.1111 +            var dots = parseDots(gradient);
  5.1112 +            if (!dots) {
  5.1113 +                return null;
  5.1114 +            }
  5.1115 +            var id = o.getAttribute(fillString);
  5.1116 +            id = id.match(/^url\(#(.*)\)$/);
  5.1117 +            id && SVG.defs.removeChild(doc.getElementById(id[1]));
  5.1118 +            
  5.1119 +            var el = $(type + "Gradient");
  5.1120 +            el.id = "r" + (R._id++)[toString](36);
  5.1121 +            $(el, type == "radial" ? {fx: fx, fy: fy} : {x1: vector[0], y1: vector[1], x2: vector[2], y2: vector[3]});
  5.1122 +            SVG.defs[appendChild](el);
  5.1123 +            for (var i = 0, ii = dots[length]; i < ii; i++) {
  5.1124 +                var stop = $("stop");
  5.1125 +                $(stop, {
  5.1126 +                    offset: dots[i].offset ? dots[i].offset : !i ? "0%" : "100%",
  5.1127 +                    "stop-color": dots[i].color || "#fff"
  5.1128 +                });
  5.1129 +                el[appendChild](stop);
  5.1130 +            }
  5.1131 +            $(o, {
  5.1132 +                fill: "url(#" + el.id + ")",
  5.1133 +                opacity: 1,
  5.1134 +                "fill-opacity": 1
  5.1135 +            });
  5.1136 +            s.fill = E;
  5.1137 +            s.opacity = 1;
  5.1138 +            s.fillOpacity = 1;
  5.1139 +            return 1;
  5.1140 +        };
  5.1141 +        var updatePosition = function (o) {
  5.1142 +            var bbox = o.getBBox();
  5.1143 +            $(o.pattern, {patternTransform: R.format("translate({0},{1})", bbox.x, bbox.y)});
  5.1144 +        };
  5.1145 +        var setFillAndStroke = function (o, params) {
  5.1146 +            var dasharray = {
  5.1147 +                    "": [0],
  5.1148 +                    "none": [0],
  5.1149 +                    "-": [3, 1],
  5.1150 +                    ".": [1, 1],
  5.1151 +                    "-.": [3, 1, 1, 1],
  5.1152 +                    "-..": [3, 1, 1, 1, 1, 1],
  5.1153 +                    ". ": [1, 3],
  5.1154 +                    "- ": [4, 3],
  5.1155 +                    "--": [8, 3],
  5.1156 +                    "- .": [4, 3, 1, 3],
  5.1157 +                    "--.": [8, 3, 1, 3],
  5.1158 +                    "--..": [8, 3, 1, 3, 1, 3]
  5.1159 +                },
  5.1160 +                node = o.node,
  5.1161 +                attrs = o.attrs,
  5.1162 +                rot = o.rotate(),
  5.1163 +                addDashes = function (o, value) {
  5.1164 +                    value = dasharray[lowerCase.call(value)];
  5.1165 +                    if (value) {
  5.1166 +                        var width = o.attrs["stroke-width"] || "1",
  5.1167 +                            butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
  5.1168 +                            dashes = [];
  5.1169 +                        var i = value[length];
  5.1170 +                        while (i--) {
  5.1171 +                            dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt;
  5.1172 +                        }
  5.1173 +                        $(node, {"stroke-dasharray": dashes[join](",")});
  5.1174 +                    }
  5.1175 +                };
  5.1176 +            params[has]("rotation") && (rot = params.rotation);
  5.1177 +            var rotxy = Str(rot)[split](separator);
  5.1178 +            if (!(rotxy.length - 1)) {
  5.1179 +                rotxy = null;
  5.1180 +            } else {
  5.1181 +                rotxy[1] = +rotxy[1];
  5.1182 +                rotxy[2] = +rotxy[2];
  5.1183 +            }
  5.1184 +            toFloat(rot) && o.rotate(0, true);
  5.1185 +            for (var att in params) {
  5.1186 +                if (params[has](att)) {
  5.1187 +                    if (!availableAttrs[has](att)) {
  5.1188 +                        continue;
  5.1189 +                    }
  5.1190 +                    var value = params[att];
  5.1191 +                    attrs[att] = value;
  5.1192 +                    switch (att) {
  5.1193 +                        case "blur":
  5.1194 +                            o.blur(value);
  5.1195 +                            break;
  5.1196 +                        case "rotation":
  5.1197 +                            o.rotate(value, true);
  5.1198 +                            break;
  5.1199 +                        case "href":
  5.1200 +                        case "title":
  5.1201 +                        case "target":
  5.1202 +                            var pn = node.parentNode;
  5.1203 +                            if (lowerCase.call(pn.tagName) != "a") {
  5.1204 +                                var hl = $("a");
  5.1205 +                                pn.insertBefore(hl, node);
  5.1206 +                                hl[appendChild](node);
  5.1207 +                                pn = hl;
  5.1208 +                            }
  5.1209 +                            pn.setAttributeNS(o.paper.xlink, att, value);
  5.1210 +                            break;
  5.1211 +                        case "cursor":
  5.1212 +                            node.style.cursor = value;
  5.1213 +                            break;
  5.1214 +                        case "clip-rect":
  5.1215 +                            var rect = Str(value)[split](separator);
  5.1216 +                            if (rect[length] == 4) {
  5.1217 +                                o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode);
  5.1218 +                                var el = $("clipPath"),
  5.1219 +                                    rc = $("rect");
  5.1220 +                                el.id = "r" + (R._id++)[toString](36);
  5.1221 +                                $(rc, {
  5.1222 +                                    x: rect[0],
  5.1223 +                                    y: rect[1],
  5.1224 +                                    width: rect[2],
  5.1225 +                                    height: rect[3]
  5.1226 +                                });
  5.1227 +                                el[appendChild](rc);
  5.1228 +                                o.paper.defs[appendChild](el);
  5.1229 +                                $(node, {"clip-path": "url(#" + el.id + ")"});
  5.1230 +                                o.clip = rc;
  5.1231 +                            }
  5.1232 +                            if (!value) {
  5.1233 +                                var clip = doc.getElementById(node.getAttribute("clip-path")[rp](/(^url\(#|\)$)/g, E));
  5.1234 +                                clip && clip.parentNode.removeChild(clip);
  5.1235 +                                $(node, {"clip-path": E});
  5.1236 +                                delete o.clip;
  5.1237 +                            }
  5.1238 +                        break;
  5.1239 +                        case "path":
  5.1240 +                            if (o.type == "path") {
  5.1241 +                                $(node, {d: value ? attrs.path = pathToAbsolute(value) : "M0,0"});
  5.1242 +                            }
  5.1243 +                            break;
  5.1244 +                        case "width":
  5.1245 +                            node[setAttribute](att, value);
  5.1246 +                            if (attrs.fx) {
  5.1247 +                                att = "x";
  5.1248 +                                value = attrs.x;
  5.1249 +                            } else {
  5.1250 +                                break;
  5.1251 +                            }
  5.1252 +                        case "x":
  5.1253 +                            if (attrs.fx) {
  5.1254 +                                value = -attrs.x - (attrs.width || 0);
  5.1255 +                            }
  5.1256 +                        case "rx":
  5.1257 +                            if (att == "rx" && o.type == "rect") {
  5.1258 +                                break;
  5.1259 +                            }
  5.1260 +                        case "cx":
  5.1261 +                            rotxy && (att == "x" || att == "cx") && (rotxy[1] += value - attrs[att]);
  5.1262 +                            node[setAttribute](att, value);
  5.1263 +                            o.pattern && updatePosition(o);
  5.1264 +                            break;
  5.1265 +                        case "height":
  5.1266 +                            node[setAttribute](att, value);
  5.1267 +                            if (attrs.fy) {
  5.1268 +                                att = "y";
  5.1269 +                                value = attrs.y;
  5.1270 +                            } else {
  5.1271 +                                break;
  5.1272 +                            }
  5.1273 +                        case "y":
  5.1274 +                            if (attrs.fy) {
  5.1275 +                                value = -attrs.y - (attrs.height || 0);
  5.1276 +                            }
  5.1277 +                        case "ry":
  5.1278 +                            if (att == "ry" && o.type == "rect") {
  5.1279 +                                break;
  5.1280 +                            }
  5.1281 +                        case "cy":
  5.1282 +                            rotxy && (att == "y" || att == "cy") && (rotxy[2] += value - attrs[att]);
  5.1283 +                            node[setAttribute](att, value);
  5.1284 +                            o.pattern && updatePosition(o);
  5.1285 +                            break;
  5.1286 +                        case "r":
  5.1287 +                            if (o.type == "rect") {
  5.1288 +                                $(node, {rx: value, ry: value});
  5.1289 +                            } else {
  5.1290 +                                node[setAttribute](att, value);
  5.1291 +                            }
  5.1292 +                            break;
  5.1293 +                        case "src":
  5.1294 +                            if (o.type == "image") {
  5.1295 +                                node.setAttributeNS(o.paper.xlink, "href", value);
  5.1296 +                            }
  5.1297 +                            break;
  5.1298 +                        case "stroke-width":
  5.1299 +                            node.style.strokeWidth = value;
  5.1300 +                            // Need following line for Firefox
  5.1301 +                            node[setAttribute](att, value);
  5.1302 +                            if (attrs["stroke-dasharray"]) {
  5.1303 +                                addDashes(o, attrs["stroke-dasharray"]);
  5.1304 +                            }
  5.1305 +                            break;
  5.1306 +                        case "stroke-dasharray":
  5.1307 +                            addDashes(o, value);
  5.1308 +                            break;
  5.1309 +                        case "translation":
  5.1310 +                            var xy = Str(value)[split](separator);
  5.1311 +                            xy[0] = +xy[0] || 0;
  5.1312 +                            xy[1] = +xy[1] || 0;
  5.1313 +                            if (rotxy) {
  5.1314 +                                rotxy[1] += xy[0];
  5.1315 +                                rotxy[2] += xy[1];
  5.1316 +                            }
  5.1317 +                            translate.call(o, xy[0], xy[1]);
  5.1318 +                            break;
  5.1319 +                        case "scale":
  5.1320 +                            xy = Str(value)[split](separator);
  5.1321 +                            o.scale(+xy[0] || 1, +xy[1] || +xy[0] || 1, isNaN(toFloat(xy[2])) ? null : +xy[2], isNaN(toFloat(xy[3])) ? null : +xy[3]);
  5.1322 +                            break;
  5.1323 +                        case fillString:
  5.1324 +                            var isURL = Str(value).match(ISURL);
  5.1325 +                            if (isURL) {
  5.1326 +                                el = $("pattern");
  5.1327 +                                var ig = $("image");
  5.1328 +                                el.id = "r" + (R._id++)[toString](36);
  5.1329 +                                $(el, {x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1});
  5.1330 +                                $(ig, {x: 0, y: 0});
  5.1331 +                                ig.setAttributeNS(o.paper.xlink, "href", isURL[1]);
  5.1332 +                                el[appendChild](ig);
  5.1333 + 
  5.1334 +                                var img = doc.createElement("img");
  5.1335 +                                img.style.cssText = "position:absolute;left:-9999em;top-9999em";
  5.1336 +                                img.onload = function () {
  5.1337 +                                    $(el, {width: this.offsetWidth, height: this.offsetHeight});
  5.1338 +                                    $(ig, {width: this.offsetWidth, height: this.offsetHeight});
  5.1339 +                                    doc.body.removeChild(this);
  5.1340 +                                    o.paper.safari();
  5.1341 +                                };
  5.1342 +                                doc.body[appendChild](img);
  5.1343 +                                img.src = isURL[1];
  5.1344 +                                o.paper.defs[appendChild](el);
  5.1345 +                                node.style.fill = "url(#" + el.id + ")";
  5.1346 +                                $(node, {fill: "url(#" + el.id + ")"});
  5.1347 +                                o.pattern = el;
  5.1348 +                                o.pattern && updatePosition(o);
  5.1349 +                                break;
  5.1350 +                            }
  5.1351 +                            var clr = R.getRGB(value);
  5.1352 +                            if (!clr.error) {
  5.1353 +                                delete params.gradient;
  5.1354 +                                delete attrs.gradient;
  5.1355 +                                !R.is(attrs.opacity, "undefined") &&
  5.1356 +                                    R.is(params.opacity, "undefined") &&
  5.1357 +                                    $(node, {opacity: attrs.opacity});
  5.1358 +                                !R.is(attrs["fill-opacity"], "undefined") &&
  5.1359 +                                    R.is(params["fill-opacity"], "undefined") &&
  5.1360 +                                    $(node, {"fill-opacity": attrs["fill-opacity"]});
  5.1361 +                            } else if ((({circle: 1, ellipse: 1})[has](o.type) || Str(value).charAt() != "r") && addGradientFill(node, value, o.paper)) {
  5.1362 +                                attrs.gradient = value;
  5.1363 +                                attrs.fill = "none";
  5.1364 +                                break;
  5.1365 +                            }
  5.1366 +                            clr[has]("o") && $(node, {"fill-opacity": clr.o > 1 ? clr.o / 100 : clr.o});
  5.1367 +                        case "stroke":
  5.1368 +                            clr = R.getRGB(value);
  5.1369 +                            node[setAttribute](att, clr.hex);
  5.1370 +                            att == "stroke" && clr[has]("o") && $(node, {"stroke-opacity": clr.o > 1 ? clr.o / 100 : clr.o});
  5.1371 +                            break;
  5.1372 +                        case "gradient":
  5.1373 +                            (({circle: 1, ellipse: 1})[has](o.type) || Str(value).charAt() != "r") && addGradientFill(node, value, o.paper);
  5.1374 +                            break;
  5.1375 +                        case "opacity":
  5.1376 +                        case "fill-opacity":
  5.1377 +                            if (attrs.gradient) {
  5.1378 +                                var gradient = doc.getElementById(node.getAttribute(fillString)[rp](/^url\(#|\)$/g, E));
  5.1379 +                                if (gradient) {
  5.1380 +                                    var stops = gradient.getElementsByTagName("stop");
  5.1381 +                                    stops[stops[length] - 1][setAttribute]("stop-opacity", value);
  5.1382 +                                }
  5.1383 +                                break;
  5.1384 +                            }
  5.1385 +                        default:
  5.1386 +                            att == "font-size" && (value = toInt(value, 10) + "px");
  5.1387 +                            var cssrule = att[rp](/(\-.)/g, function (w) {
  5.1388 +                                return upperCase.call(w.substring(1));
  5.1389 +                            });
  5.1390 +                            node.style[cssrule] = value;
  5.1391 +                            // Need following line for Firefox
  5.1392 +                            node[setAttribute](att, value);
  5.1393 +                            break;
  5.1394 +                    }
  5.1395 +                }
  5.1396 +            }
  5.1397 +            
  5.1398 +            tuneText(o, params);
  5.1399 +            if (rotxy) {
  5.1400 +                o.rotate(rotxy.join(S));
  5.1401 +            } else {
  5.1402 +                toFloat(rot) && o.rotate(rot, true);
  5.1403 +            }
  5.1404 +        };
  5.1405 +        var leading = 1.2,
  5.1406 +        tuneText = function (el, params) {
  5.1407 +            if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) {
  5.1408 +                return;
  5.1409 +            }
  5.1410 +            var a = el.attrs,
  5.1411 +                node = el.node,
  5.1412 +                fontSize = node.firstChild ? toInt(doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10;
  5.1413 + 
  5.1414 +            if (params[has]("text")) {
  5.1415 +                a.text = params.text;
  5.1416 +                while (node.firstChild) {
  5.1417 +                    node.removeChild(node.firstChild);
  5.1418 +                }
  5.1419 +                var texts = Str(params.text)[split]("\n");
  5.1420 +                for (var i = 0, ii = texts[length]; i < ii; i++) if (texts[i]) {
  5.1421 +                    var tspan = $("tspan");
  5.1422 +                    i && $(tspan, {dy: fontSize * leading, x: a.x});
  5.1423 +                    tspan[appendChild](doc.createTextNode(texts[i]));
  5.1424 +                    node[appendChild](tspan);
  5.1425 +                }
  5.1426 +            } else {
  5.1427 +                texts = node.getElementsByTagName("tspan");
  5.1428 +                for (i = 0, ii = texts[length]; i < ii; i++) {
  5.1429 +                    i && $(texts[i], {dy: fontSize * leading, x: a.x});
  5.1430 +                }
  5.1431 +            }
  5.1432 +            $(node, {y: a.y});
  5.1433 +            var bb = el.getBBox(),
  5.1434 +                dif = a.y - (bb.y + bb.height / 2);
  5.1435 +            dif && isFinite(dif) && $(node, {y: a.y + dif});
  5.1436 +        },
  5.1437 +        Element = function (node, svg) {
  5.1438 +            var X = 0,
  5.1439 +                Y = 0;
  5.1440 +            this[0] = node;
  5.1441 +            this.id = R._oid++;
  5.1442 +            this.node = node;
  5.1443 +            node.raphael = this;
  5.1444 +            this.paper = svg;
  5.1445 +            this.attrs = this.attrs || {};
  5.1446 +            this.transformations = []; // rotate, translate, scale
  5.1447 +            this._ = {
  5.1448 +                tx: 0,
  5.1449 +                ty: 0,
  5.1450 +                rt: {deg: 0, cx: 0, cy: 0},
  5.1451 +                sx: 1,
  5.1452 +                sy: 1
  5.1453 +            };
  5.1454 +            !svg.bottom && (svg.bottom = this);
  5.1455 +            this.prev = svg.top;
  5.1456 +            svg.top && (svg.top.next = this);
  5.1457 +            svg.top = this;
  5.1458 +            this.next = null;
  5.1459 +        };
  5.1460 +        Element[proto].rotate = function (deg, cx, cy) {
  5.1461 +            if (this.removed) {
  5.1462 +                return this;
  5.1463 +            }
  5.1464 +            if (deg == null) {
  5.1465 +                if (this._.rt.cx) {
  5.1466 +                    return [this._.rt.deg, this._.rt.cx, this._.rt.cy][join](S);
  5.1467 +                }
  5.1468 +                return this._.rt.deg;
  5.1469 +            }
  5.1470 +            var bbox = this.getBBox();
  5.1471 +            deg = Str(deg)[split](separator);
  5.1472 +            if (deg[length] - 1) {
  5.1473 +                cx = toFloat(deg[1]);
  5.1474 +                cy = toFloat(deg[2]);
  5.1475 +            }
  5.1476 +            deg = toFloat(deg[0]);
  5.1477 +            if (cx != null) {
  5.1478 +                this._.rt.deg = deg;
  5.1479 +            } else {
  5.1480 +                this._.rt.deg += deg;
  5.1481 +            }
  5.1482 +            (cy == null) && (cx = null);
  5.1483 +            this._.rt.cx = cx;
  5.1484 +            this._.rt.cy = cy;
  5.1485 +            cx = cx == null ? bbox.x + bbox.width / 2 : cx;
  5.1486 +            cy = cy == null ? bbox.y + bbox.height / 2 : cy;
  5.1487 +            if (this._.rt.deg) {
  5.1488 +                this.transformations[0] = R.format("rotate({0} {1} {2})", this._.rt.deg, cx, cy);
  5.1489 +                this.clip && $(this.clip, {transform: R.format("rotate({0} {1} {2})", -this._.rt.deg, cx, cy)});
  5.1490 +            } else {
  5.1491 +                this.transformations[0] = E;
  5.1492 +                this.clip && $(this.clip, {transform: E});
  5.1493 +            }
  5.1494 +            $(this.node, {transform: this.transformations[join](S)});
  5.1495 +            return this;
  5.1496 +        };
  5.1497 +        Element[proto].hide = function () {
  5.1498 +            !this.removed && (this.node.style.display = "none");
  5.1499 +            return this;
  5.1500 +        };
  5.1501 +        Element[proto].show = function () {
  5.1502 +            !this.removed && (this.node.style.display = "");
  5.1503 +            return this;
  5.1504 +        };
  5.1505 +        Element[proto].remove = function () {
  5.1506 +            if (this.removed) {
  5.1507 +                return;
  5.1508 +            }
  5.1509 +            tear(this, this.paper);
  5.1510 +            this.node.parentNode.removeChild(this.node);
  5.1511 +            for (var i in this) {
  5.1512 +                delete this[i];
  5.1513 +            }
  5.1514 +            this.removed = true;
  5.1515 +        };
  5.1516 +        Element[proto].getBBox = function () {
  5.1517 +            if (this.removed) {
  5.1518 +                return this;
  5.1519 +            }
  5.1520 +            if (this.type == "path") {
  5.1521 +                return pathDimensions(this.attrs.path);
  5.1522 +            }
  5.1523 +            if (this.node.style.display == "none") {
  5.1524 +                this.show();
  5.1525 +                var hide = true;
  5.1526 +            }
  5.1527 +            var bbox = {};
  5.1528 +            try {
  5.1529 +                bbox = this.node.getBBox();
  5.1530 +            } catch(e) {
  5.1531 +                // Firefox 3.0.x plays badly here
  5.1532 +            } finally {
  5.1533 +                bbox = bbox || {};
  5.1534 +            }
  5.1535 +            if (this.type == "text") {
  5.1536 +                bbox = {x: bbox.x, y: Infinity, width: 0, height: 0};
  5.1537 +                for (var i = 0, ii = this.node.getNumberOfChars(); i < ii; i++) {
  5.1538 +                    var bb = this.node.getExtentOfChar(i);
  5.1539 +                    (bb.y < bbox.y) && (bbox.y = bb.y);
  5.1540 +                    (bb.y + bb.height - bbox.y > bbox.height) && (bbox.height = bb.y + bb.height - bbox.y);
  5.1541 +                    (bb.x + bb.width - bbox.x > bbox.width) && (bbox.width = bb.x + bb.width - bbox.x);
  5.1542 +                }
  5.1543 +            }
  5.1544 +            hide && this.hide();
  5.1545 +            return bbox;
  5.1546 +        };
  5.1547 +        Element[proto].attr = function (name, value) {
  5.1548 +            if (this.removed) {
  5.1549 +                return this;
  5.1550 +            }
  5.1551 +            if (name == null) {
  5.1552 +                var res = {};
  5.1553 +                for (var i in this.attrs) if (this.attrs[has](i)) {
  5.1554 +                    res[i] = this.attrs[i];
  5.1555 +                }
  5.1556 +                this._.rt.deg && (res.rotation = this.rotate());
  5.1557 +                (this._.sx != 1 || this._.sy != 1) && (res.scale = this.scale());
  5.1558 +                res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
  5.1559 +                return res;
  5.1560 +            }
  5.1561 +            if (value == null && R.is(name, string)) {
  5.1562 +                if (name == "translation") {
  5.1563 +                    return translate.call(this);
  5.1564 +                }
  5.1565 +                if (name == "rotation") {
  5.1566 +                    return this.rotate();
  5.1567 +                }
  5.1568 +                if (name == "scale") {
  5.1569 +                    return this.scale();
  5.1570 +                }
  5.1571 +                if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
  5.1572 +                    return this.attrs.gradient;
  5.1573 +                }
  5.1574 +                return this.attrs[name];
  5.1575 +            }
  5.1576 +            if (value == null && R.is(name, array)) {
  5.1577 +                var values = {};
  5.1578 +                for (var j = 0, jj = name.length; j < jj; j++) {
  5.1579 +                    values[name[j]] = this.attr(name[j]);
  5.1580 +                }
  5.1581 +                return values;
  5.1582 +            }
  5.1583 +            if (value != null) {
  5.1584 +                var params = {};
  5.1585 +                params[name] = value;
  5.1586 +                setFillAndStroke(this, params);
  5.1587 +            } else if (name != null && R.is(name, "object")) {
  5.1588 +                setFillAndStroke(this, name);
  5.1589 +            }
  5.1590 +            return this;
  5.1591 +        };
  5.1592 +        Element[proto].toFront = function () {
  5.1593 +            if (this.removed) {
  5.1594 +                return this;
  5.1595 +            }
  5.1596 +            this.node.parentNode[appendChild](this.node);
  5.1597 +            var svg = this.paper;
  5.1598 +            svg.top != this && tofront(this, svg);
  5.1599 +            return this;
  5.1600 +        };
  5.1601 +        Element[proto].toBack = function () {
  5.1602 +            if (this.removed) {
  5.1603 +                return this;
  5.1604 +            }
  5.1605 +            if (this.node.parentNode.firstChild != this.node) {
  5.1606 +                this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
  5.1607 +                toback(this, this.paper);
  5.1608 +                var svg = this.paper;
  5.1609 +            }
  5.1610 +            return this;
  5.1611 +        };
  5.1612 +        Element[proto].insertAfter = function (element) {
  5.1613 +            if (this.removed) {
  5.1614 +                return this;
  5.1615 +            }
  5.1616 +            var node = element.node || element[element.length].node;
  5.1617 +            if (node.nextSibling) {
  5.1618 +                node.parentNode.insertBefore(this.node, node.nextSibling);
  5.1619 +            } else {
  5.1620 +                node.parentNode[appendChild](this.node);
  5.1621 +            }
  5.1622 +            insertafter(this, element, this.paper);
  5.1623 +            return this;
  5.1624 +        };
  5.1625 +        Element[proto].insertBefore = function (element) {
  5.1626 +            if (this.removed) {
  5.1627 +                return this;
  5.1628 +            }
  5.1629 +            var node = element.node || element[0].node;
  5.1630 +            node.parentNode.insertBefore(this.node, node);
  5.1631 +            insertbefore(this, element, this.paper);
  5.1632 +            return this;
  5.1633 +        };
  5.1634 +        Element[proto].blur = function (size) {
  5.1635 +            // Experimental. No Safari support. Use it on your own risk.
  5.1636 +            var t = this;
  5.1637 +            if (+size !== 0) {
  5.1638 +                var fltr = $("filter"),
  5.1639 +                    blur = $("feGaussianBlur");
  5.1640 +                t.attrs.blur = size;
  5.1641 +                fltr.id = "r" + (R._id++)[toString](36);
  5.1642 +                $(blur, {stdDeviation: +size || 1.5});
  5.1643 +                fltr.appendChild(blur);
  5.1644 +                t.paper.defs.appendChild(fltr);
  5.1645 +                t._blur = fltr;
  5.1646 +                $(t.node, {filter: "url(#" + fltr.id + ")"});
  5.1647 +            } else {
  5.1648 +                if (t._blur) {
  5.1649 +                    t._blur.parentNode.removeChild(t._blur);
  5.1650 +                    delete t._blur;
  5.1651 +                    delete t.attrs.blur;
  5.1652 +                }
  5.1653 +                t.node.removeAttribute("filter");
  5.1654 +            }
  5.1655 +        };
  5.1656 +        var theCircle = function (svg, x, y, r) {
  5.1657 +            var el = $("circle");
  5.1658 +            svg.canvas && svg.canvas[appendChild](el);
  5.1659 +            var res = new Element(el, svg);
  5.1660 +            res.attrs = {cx: x, cy: y, r: r, fill: "none", stroke: "#000"};
  5.1661 +            res.type = "circle";
  5.1662 +            $(el, res.attrs);
  5.1663 +            return res;
  5.1664 +        };
  5.1665 +        var theRect = function (svg, x, y, w, h, r) {
  5.1666 +            var el = $("rect");
  5.1667 +            svg.canvas && svg.canvas[appendChild](el);
  5.1668 +            var res = new Element(el, svg);
  5.1669 +            res.attrs = {x: x, y: y, width: w, height: h, r: r || 0, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000"};
  5.1670 +            res.type = "rect";
  5.1671 +            $(el, res.attrs);
  5.1672 +            return res;
  5.1673 +        };
  5.1674 +        var theEllipse = function (svg, x, y, rx, ry) {
  5.1675 +            var el = $("ellipse");
  5.1676 +            svg.canvas && svg.canvas[appendChild](el);
  5.1677 +            var res = new Element(el, svg);
  5.1678 +            res.attrs = {cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000"};
  5.1679 +            res.type = "ellipse";
  5.1680 +            $(el, res.attrs);
  5.1681 +            return res;
  5.1682 +        };
  5.1683 +        var theImage = function (svg, src, x, y, w, h) {
  5.1684 +            var el = $("image");
  5.1685 +            $(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"});
  5.1686 +            el.setAttributeNS(svg.xlink, "href", src);
  5.1687 +            svg.canvas && svg.canvas[appendChild](el);
  5.1688 +            var res = new Element(el, svg);
  5.1689 +            res.attrs = {x: x, y: y, width: w, height: h, src: src};
  5.1690 +            res.type = "image";
  5.1691 +            return res;
  5.1692 +        };
  5.1693 +        var theText = function (svg, x, y, text) {
  5.1694 +            var el = $("text");
  5.1695 +            $(el, {x: x, y: y, "text-anchor": "middle"});
  5.1696 +            svg.canvas && svg.canvas[appendChild](el);
  5.1697 +            var res = new Element(el, svg);
  5.1698 +            res.attrs = {x: x, y: y, "text-anchor": "middle", text: text, font: availableAttrs.font, stroke: "none", fill: "#000"};
  5.1699 +            res.type = "text";
  5.1700 +            setFillAndStroke(res, res.attrs);
  5.1701 +            return res;
  5.1702 +        };
  5.1703 +        var setSize = function (width, height) {
  5.1704 +            this.width = width || this.width;
  5.1705 +            this.height = height || this.height;
  5.1706 +            this.canvas[setAttribute]("width", this.width);
  5.1707 +            this.canvas[setAttribute]("height", this.height);
  5.1708 +            return this;
  5.1709 +        };
  5.1710 +        var create = function () {
  5.1711 +            var con = getContainer[apply](0, arguments),
  5.1712 +                container = con && con.container,
  5.1713 +                x = con.x,
  5.1714 +                y = con.y,
  5.1715 +                width = con.width,
  5.1716 +                height = con.height;
  5.1717 +            if (!container) {
  5.1718 +                throw new Error("SVG container not found.");
  5.1719 +            }
  5.1720 +            var cnvs = $("svg");
  5.1721 +            x = x || 0;
  5.1722 +            y = y || 0;
  5.1723 +            width = width || 512;
  5.1724 +            height = height || 342;
  5.1725 +            $(cnvs, {
  5.1726 +                xmlns: "http://www.w3.org/2000/svg",
  5.1727 +                version: 1.1,
  5.1728 +                width: width,
  5.1729 +                height: height
  5.1730 +            });
  5.1731 +            if (container == 1) {
  5.1732 +                cnvs.style.cssText = "position:absolute;left:" + x + "px;top:" + y + "px";
  5.1733 +                doc.body[appendChild](cnvs);
  5.1734 +            } else {
  5.1735 +                if (container.firstChild) {
  5.1736 +                    container.insertBefore(cnvs, container.firstChild);
  5.1737 +                } else {
  5.1738 +                    container[appendChild](cnvs);
  5.1739 +                }
  5.1740 +            }
  5.1741 +            container = new Paper;
  5.1742 +            container.width = width;
  5.1743 +            container.height = height;
  5.1744 +            container.canvas = cnvs;
  5.1745 +            plugins.call(container, container, R.fn);
  5.1746 +            container.clear();
  5.1747 +            return container;
  5.1748 +        };
  5.1749 +        Paper[proto].clear = function () {
  5.1750 +            var c = this.canvas;
  5.1751 +            while (c.firstChild) {
  5.1752 +                c.removeChild(c.firstChild);
  5.1753 +            }
  5.1754 +            this.bottom = this.top = null;
  5.1755 +            (this.desc = $("desc"))[appendChild](doc.createTextNode("Created with Rapha\xebl"));
  5.1756 +            c[appendChild](this.desc);
  5.1757 +            c[appendChild](this.defs = $("defs"));
  5.1758 +        };
  5.1759 +        Paper[proto].remove = function () {
  5.1760 +            this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
  5.1761 +            for (var i in this) {
  5.1762 +                this[i] = removed(i);
  5.1763 +            }
  5.1764 +        };
  5.1765 +    }
  5.1766 +
  5.1767 +    // VML
  5.1768 +    if (R.vml) {
  5.1769 +        var map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
  5.1770 +            bites = /([clmz]),?([^clmz]*)/gi,
  5.1771 +            val = /-?[^,\s-]+/g,
  5.1772 +            coordsize = 1e3 + S + 1e3,
  5.1773 +            zoom = 10,
  5.1774 +            pathlike = {path: 1, rect: 1},
  5.1775 +            path2vml = function (path) {
  5.1776 +                var total =  /[ahqstv]/ig,
  5.1777 +                    command = pathToAbsolute;
  5.1778 +                Str(path).match(total) && (command = path2curve);
  5.1779 +                total = /[clmz]/g;
  5.1780 +                if (command == pathToAbsolute && !Str(path).match(total)) {
  5.1781 +                    var res = Str(path)[rp](bites, function (all, command, args) {
  5.1782 +                        var vals = [],
  5.1783 +                            isMove = lowerCase.call(command) == "m",
  5.1784 +                            res = map[command];
  5.1785 +                        args[rp](val, function (value) {
  5.1786 +                            if (isMove && vals[length] == 2) {
  5.1787 +                                res += vals + map[command == "m" ? "l" : "L"];
  5.1788 +                                vals = [];
  5.1789 +                            }
  5.1790 +                            vals[push](round(value * zoom));
  5.1791 +                        });
  5.1792 +                        return res + vals;
  5.1793 +                    });
  5.1794 +                    return res;
  5.1795 +                }
  5.1796 +                var pa = command(path), p, r;
  5.1797 +                res = [];
  5.1798 +                for (var i = 0, ii = pa[length]; i < ii; i++) {
  5.1799 +                    p = pa[i];
  5.1800 +                    r = lowerCase.call(pa[i][0]);
  5.1801 +                    r == "z" && (r = "x");
  5.1802 +                    for (var j = 1, jj = p[length]; j < jj; j++) {
  5.1803 +                        r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
  5.1804 +                    }
  5.1805 +                    res[push](r);
  5.1806 +                }
  5.1807 +                return res[join](S);
  5.1808 +            };
  5.1809 +        
  5.1810 +        R[toString] = function () {
  5.1811 +            return  "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
  5.1812 +        };
  5.1813 +        thePath = function (pathString, vml) {
  5.1814 +            var g = createNode("group");
  5.1815 +            g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
  5.1816 +            g.coordsize = vml.coordsize;
  5.1817 +            g.coordorigin = vml.coordorigin;
  5.1818 +            var el = createNode("shape"), ol = el.style;
  5.1819 +            ol.width = vml.width + "px";
  5.1820 +            ol.height = vml.height + "px";
  5.1821 +            el.coordsize = coordsize;
  5.1822 +            el.coordorigin = vml.coordorigin;
  5.1823 +            g[appendChild](el);
  5.1824 +            var p = new Element(el, g, vml),
  5.1825 +                attr = {fill: "none", stroke: "#000"};
  5.1826 +            pathString && (attr.path = pathString);
  5.1827 +            p.isAbsolute = true;
  5.1828 +            p.type = "path";
  5.1829 +            p.path = [];
  5.1830 +            p.Path = E;
  5.1831 +            setFillAndStroke(p, attr);
  5.1832 +            vml.canvas[appendChild](g);
  5.1833 +            return p;
  5.1834 +        };
  5.1835 +        setFillAndStroke = function (o, params) {
  5.1836 +            o.attrs = o.attrs || {};
  5.1837 +            var node = o.node,
  5.1838 +                a = o.attrs,
  5.1839 +                s = node.style,
  5.1840 +                xy,
  5.1841 +                newpath = (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.r != a.r) && o.type == "rect",
  5.1842 +                res = o;
  5.1843 +
  5.1844 +            for (var par in params) if (params[has](par)) {
  5.1845 +                a[par] = params[par];
  5.1846 +            }
  5.1847 +            if (newpath) {
  5.1848 +                a.path = rectPath(a.x, a.y, a.width, a.height, a.r);
  5.1849 +                o.X = a.x;
  5.1850 +                o.Y = a.y;
  5.1851 +                o.W = a.width;
  5.1852 +                o.H = a.height;
  5.1853 +            }
  5.1854 +            params.href && (node.href = params.href);
  5.1855 +            params.title && (node.title = params.title);
  5.1856 +            params.target && (node.target = params.target);
  5.1857 +            params.cursor && (s.cursor = params.cursor);
  5.1858 +            "blur" in params && o.blur(params.blur);
  5.1859 +            if (params.path && o.type == "path" || newpath) {
  5.1860 +                    node.path = path2vml(a.path);
  5.1861 +            }
  5.1862 +            if (params.rotation != null) {
  5.1863 +                o.rotate(params.rotation, true);
  5.1864 +            }
  5.1865 +            if (params.translation) {
  5.1866 +                xy = Str(params.translation)[split](separator);
  5.1867 +                translate.call(o, xy[0], xy[1]);
  5.1868 +                if (o._.rt.cx != null) {
  5.1869 +                    o._.rt.cx +=+ xy[0];
  5.1870 +                    o._.rt.cy +=+ xy[1];
  5.1871 +                    o.setBox(o.attrs, xy[0], xy[1]);
  5.1872 +                }
  5.1873 +            }
  5.1874 +            if (params.scale) {
  5.1875 +                xy = Str(params.scale)[split](separator);
  5.1876 +                o.scale(+xy[0] || 1, +xy[1] || +xy[0] || 1, +xy[2] || null, +xy[3] || null);
  5.1877 +            }
  5.1878 +            if ("clip-rect" in params) {
  5.1879 +                var rect = Str(params["clip-rect"])[split](separator);
  5.1880 +                if (rect[length] == 4) {
  5.1881 +                    rect[2] = +rect[2] + (+rect[0]);
  5.1882 +                    rect[3] = +rect[3] + (+rect[1]);
  5.1883 +                    var div = node.clipRect || doc.createElement("div"),
  5.1884 +                        dstyle = div.style,
  5.1885 +                        group = node.parentNode;
  5.1886 +                    dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
  5.1887 +                    if (!node.clipRect) {
  5.1888 +                        dstyle.position = "absolute";
  5.1889 +                        dstyle.top = 0;
  5.1890 +                        dstyle.left = 0;
  5.1891 +                        dstyle.width = o.paper.width + "px";
  5.1892 +                        dstyle.height = o.paper.height + "px";
  5.1893 +                        group.parentNode.insertBefore(div, group);
  5.1894 +                        div[appendChild](group);
  5.1895 +                        node.clipRect = div;
  5.1896 +                    }
  5.1897 +                }
  5.1898 +                if (!params["clip-rect"]) {
  5.1899 +                    node.clipRect && (node.clipRect.style.clip = E);
  5.1900 +                }
  5.1901 +            }
  5.1902 +            if (o.type == "image" && params.src) {
  5.1903 +                node.src = params.src;
  5.1904 +            }
  5.1905 +            if (o.type == "image" && params.opacity) {
  5.1906 +                node.filterOpacity = ms + ".Alpha(opacity=" + (params.opacity * 100) + ")";
  5.1907 +                s.filter = (node.filterMatrix || E) + (node.filterOpacity || E);
  5.1908 +            }
  5.1909 +            params.font && (s.font = params.font);
  5.1910 +            params["font-family"] && (s.fontFamily = '"' + params["font-family"][split](",")[0][rp](/^['"]+|['"]+$/g, E) + '"');
  5.1911 +            params["font-size"] && (s.fontSize = params["font-size"]);
  5.1912 +            params["font-weight"] && (s.fontWeight = params["font-weight"]);
  5.1913 +            params["font-style"] && (s.fontStyle = params["font-style"]);
  5.1914 +            if (params.opacity != null || 
  5.1915 +                params["stroke-width"] != null ||
  5.1916 +                params.fill != null ||
  5.1917 +                params.stroke != null ||
  5.1918 +                params["stroke-width"] != null ||
  5.1919 +                params["stroke-opacity"] != null ||
  5.1920 +                params["fill-opacity"] != null ||
  5.1921 +                params["stroke-dasharray"] != null ||
  5.1922 +                params["stroke-miterlimit"] != null ||
  5.1923 +                params["stroke-linejoin"] != null ||
  5.1924 +                params["stroke-linecap"] != null) {
  5.1925 +                node = o.shape || node;
  5.1926 +                var fill = (node.getElementsByTagName(fillString) && node.getElementsByTagName(fillString)[0]),
  5.1927 +                    newfill = false;
  5.1928 +                !fill && (newfill = fill = createNode(fillString));
  5.1929 +                if ("fill-opacity" in params || "opacity" in params) {
  5.1930 +                    var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
  5.1931 +                    opacity < 0 && (opacity = 0);
  5.1932 +                    opacity > 1 && (opacity = 1);
  5.1933 +                    fill.opacity = opacity;
  5.1934 +                }
  5.1935 +                params.fill && (fill.on = true);
  5.1936 +                if (fill.on == null || params.fill == "none") {
  5.1937 +                    fill.on = false;
  5.1938 +                }
  5.1939 +                if (fill.on && params.fill) {
  5.1940 +                    var isURL = params.fill.match(ISURL);
  5.1941 +                    if (isURL) {
  5.1942 +                        fill.src = isURL[1];
  5.1943 +                        fill.type = "tile";
  5.1944 +                    } else {
  5.1945 +                        fill.color = R.getRGB(params.fill).hex;
  5.1946 +                        fill.src = E;
  5.1947 +                        fill.type = "solid";
  5.1948 +                        if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill)) {
  5.1949 +                            a.fill = "none";
  5.1950 +                            a.gradient = params.fill;
  5.1951 +                        }
  5.1952 +                    }
  5.1953 +                }
  5.1954 +                newfill && node[appendChild](fill);
  5.1955 +                var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
  5.1956 +                newstroke = false;
  5.1957 +                !stroke && (newstroke = stroke = createNode("stroke"));
  5.1958 +                if ((params.stroke && params.stroke != "none") ||
  5.1959 +                    params["stroke-width"] ||
  5.1960 +                    params["stroke-opacity"] != null ||
  5.1961 +                    params["stroke-dasharray"] ||
  5.1962 +                    params["stroke-miterlimit"] ||
  5.1963 +                    params["stroke-linejoin"] ||
  5.1964 +                    params["stroke-linecap"]) {
  5.1965 +                    stroke.on = true;
  5.1966 +                }
  5.1967 +                (params.stroke == "none" || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
  5.1968 +                var strokeColor = R.getRGB(params.stroke);
  5.1969 +                stroke.on && params.stroke && (stroke.color = strokeColor.hex);
  5.1970 +                opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
  5.1971 +                var width = (toFloat(params["stroke-width"]) || 1) * .75;
  5.1972 +                opacity < 0 && (opacity = 0);
  5.1973 +                opacity > 1 && (opacity = 1);
  5.1974 +                params["stroke-width"] == null && (width = a["stroke-width"]);
  5.1975 +                params["stroke-width"] && (stroke.weight = width);
  5.1976 +                width && width < 1 && (opacity *= width) && (stroke.weight = 1);
  5.1977 +                stroke.opacity = opacity;
  5.1978 +                
  5.1979 +                params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
  5.1980 +                stroke.miterlimit = params["stroke-miterlimit"] || 8;
  5.1981 +                params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
  5.1982 +                if (params["stroke-dasharray"]) {
  5.1983 +                    var dasharray = {
  5.1984 +                        "-": "shortdash",
  5.1985 +                        ".": "shortdot",
  5.1986 +                        "-.": "shortdashdot",
  5.1987 +                        "-..": "shortdashdotdot",
  5.1988 +                        ". ": "dot",
  5.1989 +                        "- ": "dash",
  5.1990 +                        "--": "longdash",
  5.1991 +                        "- .": "dashdot",
  5.1992 +                        "--.": "longdashdot",
  5.1993 +                        "--..": "longdashdotdot"
  5.1994 +                    };
  5.1995 +                    stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
  5.1996 +                }
  5.1997 +                newstroke && node[appendChild](stroke);
  5.1998 +            }
  5.1999 +            if (res.type == "text") {
  5.2000 +                s = res.paper.span.style;
  5.2001 +                a.font && (s.font = a.font);
  5.2002 +                a["font-family"] && (s.fontFamily = a["font-family"]);
  5.2003 +                a["font-size"] && (s.fontSize = a["font-size"]);
  5.2004 +                a["font-weight"] && (s.fontWeight = a["font-weight"]);
  5.2005 +                a["font-style"] && (s.fontStyle = a["font-style"]);
  5.2006 +                res.node.string && (res.paper.span.innerHTML = Str(res.node.string)[rp](/</g, "&#60;")[rp](/&/g, "&#38;")[rp](/\n/g, "<br>"));
  5.2007 +                res.W = a.w = res.paper.span.offsetWidth;
  5.2008 +                res.H = a.h = res.paper.span.offsetHeight;
  5.2009 +                res.X = a.x;
  5.2010 +                res.Y = a.y + round(res.H / 2);
  5.2011 + 
  5.2012 +                // text-anchor emulationm
  5.2013 +                switch (a["text-anchor"]) {
  5.2014 +                    case "start":
  5.2015 +                        res.node.style["v-text-align"] = "left";
  5.2016 +                        res.bbx = round(res.W / 2);
  5.2017 +                    break;
  5.2018 +                    case "end":
  5.2019 +                        res.node.style["v-text-align"] = "right";
  5.2020 +                        res.bbx = -round(res.W / 2);
  5.2021 +                    break;
  5.2022 +                    default:
  5.2023 +                        res.node.style["v-text-align"] = "center";
  5.2024 +                    break;
  5.2025 +                }
  5.2026 +            }
  5.2027 +        };
  5.2028 +        addGradientFill = function (o, gradient) {
  5.2029 +            o.attrs = o.attrs || {};
  5.2030 +            var attrs = o.attrs,
  5.2031 +                fill,
  5.2032 +                type = "linear",
  5.2033 +                fxfy = ".5 .5";
  5.2034 +            o.attrs.gradient = gradient;
  5.2035 +            gradient = Str(gradient)[rp](radial_gradient, function (all, fx, fy) {
  5.2036 +                type = "radial";
  5.2037 +                if (fx && fy) {
  5.2038 +                    fx = toFloat(fx);
  5.2039 +                    fy = toFloat(fy);
  5.2040 +                    pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
  5.2041 +                    fxfy = fx + S + fy;
  5.2042 +                }
  5.2043 +                return E;
  5.2044 +            });
  5.2045 +            gradient = gradient[split](/\s*\-\s*/);
  5.2046 +            if (type == "linear") {
  5.2047 +                var angle = gradient.shift();
  5.2048 +                angle = -toFloat(angle);
  5.2049 +                if (isNaN(angle)) {
  5.2050 +                    return null;
  5.2051 +                }
  5.2052 +            }
  5.2053 +            var dots = parseDots(gradient);
  5.2054 +            if (!dots) {
  5.2055 +                return null;
  5.2056 +            }
  5.2057 +            o = o.shape || o.node;
  5.2058 +            fill = o.getElementsByTagName(fillString)[0] || createNode(fillString);
  5.2059 +            !fill.parentNode && o.appendChild(fill);
  5.2060 +            if (dots[length]) {
  5.2061 +                fill.on = true;
  5.2062 +                fill.method = "none";
  5.2063 +                fill.color = dots[0].color;
  5.2064 +                fill.color2 = dots[dots[length] - 1].color;
  5.2065 +                var clrs = [];
  5.2066 +                for (var i = 0, ii = dots[length]; i < ii; i++) {
  5.2067 +                    dots[i].offset && clrs[push](dots[i].offset + S + dots[i].color);
  5.2068 +                }
  5.2069 +                fill.colors && (fill.colors.value = clrs[length] ? clrs[join]() : "0% " + fill.color);
  5.2070 +                if (type == "radial") {
  5.2071 +                    fill.type = "gradientradial";
  5.2072 +                    fill.focus = "100%";
  5.2073 +                    fill.focussize = fxfy;
  5.2074 +                    fill.focusposition = fxfy;
  5.2075 +                } else {
  5.2076 +                    fill.type = "gradient";
  5.2077 +                    fill.angle = (270 - angle) % 360;
  5.2078 +                }
  5.2079 +            }
  5.2080 +            return 1;
  5.2081 +        };
  5.2082 +        Element = function (node, group, vml) {
  5.2083 +            var Rotation = 0,
  5.2084 +                RotX = 0,
  5.2085 +                RotY = 0,
  5.2086 +                Scale = 1;
  5.2087 +            this[0] = node;
  5.2088 +            this.id = R._oid++;
  5.2089 +            this.node = node;
  5.2090 +            node.raphael = this;
  5.2091 +            this.X = 0;
  5.2092 +            this.Y = 0;
  5.2093 +            this.attrs = {};
  5.2094 +            this.Group = group;
  5.2095 +            this.paper = vml;
  5.2096 +            this._ = {
  5.2097 +                tx: 0,
  5.2098 +                ty: 0,
  5.2099 +                rt: {deg:0},
  5.2100 +                sx: 1,
  5.2101 +                sy: 1
  5.2102 +            };
  5.2103 +            !vml.bottom && (vml.bottom = this);
  5.2104 +            this.prev = vml.top;
  5.2105 +            vml.top && (vml.top.next = this);
  5.2106 +            vml.top = this;
  5.2107 +            this.next = null;
  5.2108 +        };
  5.2109 +        Element[proto].rotate = function (deg, cx, cy) {
  5.2110 +            if (this.removed) {
  5.2111 +                return this;
  5.2112 +            }
  5.2113 +            if (deg == null) {
  5.2114 +                if (this._.rt.cx) {
  5.2115 +                    return [this._.rt.deg, this._.rt.cx, this._.rt.cy][join](S);
  5.2116 +                }
  5.2117 +                return this._.rt.deg;
  5.2118 +            }
  5.2119 +            deg = Str(deg)[split](separator);
  5.2120 +            if (deg[length] - 1) {
  5.2121 +                cx = toFloat(deg[1]);
  5.2122 +                cy = toFloat(deg[2]);
  5.2123 +            }
  5.2124 +            deg = toFloat(deg[0]);
  5.2125 +            if (cx != null) {
  5.2126 +                this._.rt.deg = deg;
  5.2127 +            } else {
  5.2128 +                this._.rt.deg += deg;
  5.2129 +            }
  5.2130 +            cy == null && (cx = null);
  5.2131 +            this._.rt.cx = cx;
  5.2132 +            this._.rt.cy = cy;
  5.2133 +            this.setBox(this.attrs, cx, cy);
  5.2134 +            this.Group.style.rotation = this._.rt.deg;
  5.2135 +            // gradient fix for rotation. TODO
  5.2136 +            // var fill = (this.shape || this.node).getElementsByTagName(fillString);
  5.2137 +            // fill = fill[0] || {};
  5.2138 +            // var b = ((360 - this._.rt.deg) - 270) % 360;
  5.2139 +            // !R.is(fill.angle, "undefined") && (fill.angle = b);
  5.2140 +            return this;
  5.2141 +        };
  5.2142 +        Element[proto].setBox = function (params, cx, cy) {
  5.2143 +            if (this.removed) {
  5.2144 +                return this;
  5.2145 +            }
  5.2146 +            var gs = this.Group.style,
  5.2147 +                os = (this.shape && this.shape.style) || this.node.style;
  5.2148 +            params = params || {};
  5.2149 +            for (var i in params) if (params[has](i)) {
  5.2150 +                this.attrs[i] = params[i];
  5.2151 +            }
  5.2152 +            cx = cx || this._.rt.cx;
  5.2153 +            cy = cy || this._.rt.cy;
  5.2154 +            var attr = this.attrs,
  5.2155 +                x,
  5.2156 +                y,
  5.2157 +                w,
  5.2158 +                h;
  5.2159 +            switch (this.type) {
  5.2160 +                case "circle":
  5.2161 +                    x = attr.cx - attr.r;
  5.2162 +                    y = attr.cy - attr.r;
  5.2163 +                    w = h = attr.r * 2;
  5.2164 +                    break;
  5.2165 +                case "ellipse":
  5.2166 +                    x = attr.cx - attr.rx;
  5.2167 +                    y = attr.cy - attr.ry;
  5.2168 +                    w = attr.rx * 2;
  5.2169 +                    h = attr.ry * 2;
  5.2170 +                    break;
  5.2171 +                case "image":
  5.2172 +                    x = +attr.x;
  5.2173 +                    y = +attr.y;
  5.2174 +                    w = attr.width || 0;
  5.2175 +                    h = attr.height || 0;
  5.2176 +                    break;
  5.2177 +                case "text":
  5.2178 +                    this.textpath.v = ["m", round(attr.x), ", ", round(attr.y - 2), "l", round(attr.x) + 1, ", ", round(attr.y - 2)][join](E);
  5.2179 +                    x = attr.x - round(this.W / 2);
  5.2180 +                    y = attr.y - this.H / 2;
  5.2181 +                    w = this.W;
  5.2182 +                    h = this.H;
  5.2183 +                    break;
  5.2184 +                case "rect":
  5.2185 +                case "path":
  5.2186 +                    if (!this.attrs.path) {
  5.2187 +                        x = 0;
  5.2188 +                        y = 0;
  5.2189 +                        w = this.paper.width;
  5.2190 +                        h = this.paper.height;
  5.2191 +                    } else {
  5.2192 +                        var dim = pathDimensions(this.attrs.path);
  5.2193 +                        x = dim.x;
  5.2194 +                        y = dim.y;
  5.2195 +                        w = dim.width;
  5.2196 +                        h = dim.height;
  5.2197 +                    }
  5.2198 +                    break;
  5.2199 +                default:
  5.2200 +                    x = 0;
  5.2201 +                    y = 0;
  5.2202 +                    w = this.paper.width;
  5.2203 +                    h = this.paper.height;
  5.2204 +                    break;
  5.2205 +            }
  5.2206 +            cx = (cx == null) ? x + w / 2 : cx;
  5.2207 +            cy = (cy == null) ? y + h / 2 : cy;
  5.2208 +            var left = cx - this.paper.width / 2,
  5.2209 +                top = cy - this.paper.height / 2, t;
  5.2210 +            gs.left != (t = left + "px") && (gs.left = t);
  5.2211 +            gs.top != (t = top + "px") && (gs.top = t);
  5.2212 +            this.X = pathlike[has](this.type) ? -left : x;
  5.2213 +            this.Y = pathlike[has](this.type) ? -top : y;
  5.2214 +            this.W = w;
  5.2215 +            this.H = h;
  5.2216 +            if (pathlike[has](this.type)) {
  5.2217 +                os.left != (t = -left * zoom + "px") && (os.left = t);
  5.2218 +                os.top != (t = -top * zoom + "px") && (os.top = t);
  5.2219 +            } else if (this.type == "text") {
  5.2220 +                os.left != (t = -left + "px") && (os.left = t);
  5.2221 +                os.top != (t = -top + "px") && (os.top = t);
  5.2222 +            } else {
  5.2223 +                gs.width != (t = this.paper.width + "px") && (gs.width = t);
  5.2224 +                gs.height != (t = this.paper.height + "px") && (gs.height = t);
  5.2225 +                os.left != (t = x - left + "px") && (os.left = t);
  5.2226 +                os.top != (t = y - top + "px") && (os.top = t);
  5.2227 +                os.width != (t = w + "px") && (os.width = t);
  5.2228 +                os.height != (t = h + "px") && (os.height = t);
  5.2229 +            }
  5.2230 +        };
  5.2231 +        Element[proto].hide = function () {
  5.2232 +            !this.removed && (this.Group.style.display = "none");
  5.2233 +            return this;
  5.2234 +        };
  5.2235 +        Element[proto].show = function () {
  5.2236 +            !this.removed && (this.Group.style.display = "block");
  5.2237 +            return this;
  5.2238 +        };
  5.2239 +        Element[proto].getBBox = function () {
  5.2240 +            if (this.removed) {
  5.2241 +                return this;
  5.2242 +            }
  5.2243 +            if (pathlike[has](this.type)) {
  5.2244 +                return pathDimensions(this.attrs.path);
  5.2245 +            }
  5.2246 +            return {
  5.2247 +                x: this.X + (this.bbx || 0),
  5.2248 +                y: this.Y,
  5.2249 +                width: this.W,
  5.2250 +                height: this.H
  5.2251 +            };
  5.2252 +        };
  5.2253 +        Element[proto].remove = function () {
  5.2254 +            if (this.removed) {
  5.2255 +                return;
  5.2256 +            }
  5.2257 +            tear(this, this.paper);
  5.2258 +            this.node.parentNode.removeChild(this.node);
  5.2259 +            this.Group.parentNode.removeChild(this.Group);
  5.2260 +            this.shape && this.shape.parentNode.removeChild(this.shape);
  5.2261 +            for (var i in this) {
  5.2262 +                delete this[i];
  5.2263 +            }
  5.2264 +            this.removed = true;
  5.2265 +        };
  5.2266 +        Element[proto].attr = function (name, value) {
  5.2267 +            if (this.removed) {
  5.2268 +                return this;
  5.2269 +            }
  5.2270 +            if (name == null) {
  5.2271 +                var res = {};
  5.2272 +                for (var i in this.attrs) if (this.attrs[has](i)) {
  5.2273 +                    res[i] = this.attrs[i];
  5.2274 +                }
  5.2275 +                this._.rt.deg && (res.rotation = this.rotate());
  5.2276 +                (this._.sx != 1 || this._.sy != 1) && (res.scale = this.scale());
  5.2277 +                res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
  5.2278 +                return res;
  5.2279 +            }
  5.2280 +            if (value == null && R.is(name, string)) {
  5.2281 +                if (name == "translation") {
  5.2282 +                    return translate.call(this);
  5.2283 +                }
  5.2284 +                if (name == "rotation") {
  5.2285 +                    return this.rotate();
  5.2286 +                }
  5.2287 +                if (name == "scale") {
  5.2288 +                    return this.scale();
  5.2289 +                }
  5.2290 +                if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
  5.2291 +                    return this.attrs.gradient;
  5.2292 +                }
  5.2293 +                return this.attrs[name];
  5.2294 +            }
  5.2295 +            if (this.attrs && value == null && R.is(name, array)) {
  5.2296 +                var ii, values = {};
  5.2297 +                for (i = 0, ii = name[length]; i < ii; i++) {
  5.2298 +                    values[name[i]] = this.attr(name[i]);
  5.2299 +                }
  5.2300 +                return values;
  5.2301 +            }
  5.2302 +            var params;
  5.2303 +            if (value != null) {
  5.2304 +                params = {};
  5.2305 +                params[name] = value;
  5.2306 +            }
  5.2307 +            value == null && R.is(name, "object") && (params = name);
  5.2308 +            if (params) {
  5.2309 +                if (params.text && this.type == "text") {
  5.2310 +                    this.node.string = params.text;
  5.2311 +                }
  5.2312 +                setFillAndStroke(this, params);
  5.2313 +                if (params.gradient && (({circle: 1, ellipse: 1})[has](this.type) || Str(params.gradient).charAt() != "r")) {
  5.2314 +                    addGradientFill(this, params.gradient);
  5.2315 +                }
  5.2316 +                (!pathlike[has](this.type) || this._.rt.deg) && this.setBox(this.attrs);
  5.2317 +            }
  5.2318 +            return this;
  5.2319 +        };
  5.2320 +        Element[proto].toFront = function () {
  5.2321 +            !this.removed && this.Group.parentNode[appendChild](this.Group);
  5.2322 +            this.paper.top != this && tofront(this, this.paper);
  5.2323 +            return this;
  5.2324 +        };
  5.2325 +        Element[proto].toBack = function () {
  5.2326 +            if (this.removed) {
  5.2327 +                return this;
  5.2328 +            }
  5.2329 +            if (this.Group.parentNode.firstChild != this.Group) {
  5.2330 +                this.Group.parentNode.insertBefore(this.Group, this.Group.parentNode.firstChild);
  5.2331 +                toback(this, this.paper);
  5.2332 +            }
  5.2333 +            return this;
  5.2334 +        };
  5.2335 +        Element[proto].insertAfter = function (element) {
  5.2336 +            if (this.removed) {
  5.2337 +                return this;
  5.2338 +            }
  5.2339 +            if (element.constructor == Set) {
  5.2340 +                element = element[element.length];
  5.2341 +            }
  5.2342 +            if (element.Group.nextSibling) {
  5.2343 +                element.Group.parentNode.insertBefore(this.Group, element.Group.nextSibling);
  5.2344 +            } else {
  5.2345 +                element.Group.parentNode[appendChild](this.Group);
  5.2346 +            }
  5.2347 +            insertafter(this, element, this.paper);
  5.2348 +            return this;
  5.2349 +        };
  5.2350 +        Element[proto].insertBefore = function (element) {
  5.2351 +            if (this.removed) {
  5.2352 +                return this;
  5.2353 +            }
  5.2354 +            if (element.constructor == Set) {
  5.2355 +                element = element[0];
  5.2356 +            }
  5.2357 +            element.Group.parentNode.insertBefore(this.Group, element.Group);
  5.2358 +            insertbefore(this, element, this.paper);
  5.2359 +            return this;
  5.2360 +        };
  5.2361 +        var blurregexp = / progid:\S+Blur\([^\)]+\)/g;
  5.2362 +        Element[proto].blur = function (size) {
  5.2363 +            var s = this.node.runtimeStyle,
  5.2364 +                f = s.filter;
  5.2365 +            f = f.replace(blurregexp, E);
  5.2366 +            if (+size !== 0) {
  5.2367 +                this.attrs.blur = size;
  5.2368 +                s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
  5.2369 +                s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5));
  5.2370 +            } else {
  5.2371 +                s.filter = f;
  5.2372 +                s.margin = 0;
  5.2373 +                delete this.attrs.blur;
  5.2374 +            }
  5.2375 +        };
  5.2376 + 
  5.2377 +        theCircle = function (vml, x, y, r) {
  5.2378 +            var g = createNode("group"),
  5.2379 +                o = createNode("oval"),
  5.2380 +                ol = o.style;
  5.2381 +            g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
  5.2382 +            g.coordsize = coordsize;
  5.2383 +            g.coordorigin = vml.coordorigin;
  5.2384 +            g[appendChild](o);
  5.2385 +            var res = new Element(o, g, vml);
  5.2386 +            res.type = "circle";
  5.2387 +            setFillAndStroke(res, {stroke: "#000", fill: "none"});
  5.2388 +            res.attrs.cx = x;
  5.2389 +            res.attrs.cy = y;
  5.2390 +            res.attrs.r = r;
  5.2391 +            res.setBox({x: x - r, y: y - r, width: r * 2, height: r * 2});
  5.2392 +            vml.canvas[appendChild](g);
  5.2393 +            return res;
  5.2394 +        };
  5.2395 +        function rectPath(x, y, w, h, r) {
  5.2396 +            if (r) {
  5.2397 +                return R.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z", x + r, y, w - r * 2, r, -r, h - r * 2, r * 2 - w, r * 2 - h);
  5.2398 +            } else {
  5.2399 +                return R.format("M{0},{1}l{2},0,0,{3},{4},0z", x, y, w, h, -w);
  5.2400 +            }
  5.2401 +        }
  5.2402 +        theRect = function (vml, x, y, w, h, r) {
  5.2403 +            var path = rectPath(x, y, w, h, r),
  5.2404 +                res = vml.path(path),
  5.2405 +                a = res.attrs;
  5.2406 +            res.X = a.x = x;
  5.2407 +            res.Y = a.y = y;
  5.2408 +            res.W = a.width = w;
  5.2409 +            res.H = a.height = h;
  5.2410 +            a.r = r;
  5.2411 +            a.path = path;
  5.2412 +            res.type = "rect";
  5.2413 +            return res;
  5.2414 +        };
  5.2415 +        theEllipse = function (vml, x, y, rx, ry) {
  5.2416 +            var g = createNode("group"),
  5.2417 +                o = createNode("oval"),
  5.2418 +                ol = o.style;
  5.2419 +            g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
  5.2420 +            g.coordsize = coordsize;
  5.2421 +            g.coordorigin = vml.coordorigin;
  5.2422 +            g[appendChild](o);
  5.2423 +            var res = new Element(o, g, vml);
  5.2424 +            res.type = "ellipse";
  5.2425 +            setFillAndStroke(res, {stroke: "#000"});
  5.2426 +            res.attrs.cx = x;
  5.2427 +            res.attrs.cy = y;
  5.2428 +            res.attrs.rx = rx;
  5.2429 +            res.attrs.ry = ry;
  5.2430 +            res.setBox({x: x - rx, y: y - ry, width: rx * 2, height: ry * 2});
  5.2431 +            vml.canvas[appendChild](g);
  5.2432 +            return res;
  5.2433 +        };
  5.2434 +        theImage = function (vml, src, x, y, w, h) {
  5.2435 +            var g = createNode("group"),
  5.2436 +                o = createNode("image"),
  5.2437 +                ol = o.style;
  5.2438 +            g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
  5.2439 +            g.coordsize = coordsize;
  5.2440 +            g.coordorigin = vml.coordorigin;
  5.2441 +            o.src = src;
  5.2442 +            g[appendChild](o);
  5.2443 +            var res = new Element(o, g, vml);
  5.2444 +            res.type = "image";
  5.2445 +            res.attrs.src = src;
  5.2446 +            res.attrs.x = x;
  5.2447 +            res.attrs.y = y;
  5.2448 +            res.attrs.w = w;
  5.2449 +            res.attrs.h = h;
  5.2450 +            res.setBox({x: x, y: y, width: w, height: h});
  5.2451 +            vml.canvas[appendChild](g);
  5.2452 +            return res;
  5.2453 +        };
  5.2454 +        theText = function (vml, x, y, text) {
  5.2455 +            var g = createNode("group"),
  5.2456 +                el = createNode("shape"),
  5.2457 +                ol = el.style,
  5.2458 +                path = createNode("path"),
  5.2459 +                ps = path.style,
  5.2460 +                o = createNode("textpath");
  5.2461 +            g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
  5.2462 +            g.coordsize = coordsize;
  5.2463 +            g.coordorigin = vml.coordorigin;
  5.2464 +            path.v = R.format("m{0},{1}l{2},{1}", round(x * 10), round(y * 10), round(x * 10) + 1);
  5.2465 +            path.textpathok = true;
  5.2466 +            ol.width = vml.width;
  5.2467 +            ol.height = vml.height;
  5.2468 +            o.string = Str(text);
  5.2469 +            o.on = true;
  5.2470 +            el[appendChild](o);
  5.2471 +            el[appendChild](path);
  5.2472 +            g[appendChild](el);
  5.2473 +            var res = new Element(o, g, vml);
  5.2474 +            res.shape = el;
  5.2475 +            res.textpath = path;
  5.2476 +            res.type = "text";
  5.2477 +            res.attrs.text = text;
  5.2478 +            res.attrs.x = x;
  5.2479 +            res.attrs.y = y;
  5.2480 +            res.attrs.w = 1;
  5.2481 +            res.attrs.h = 1;
  5.2482 +            setFillAndStroke(res, {font: availableAttrs.font, stroke: "none", fill: "#000"});
  5.2483 +            res.setBox();
  5.2484 +            vml.canvas[appendChild](g);
  5.2485 +            return res;
  5.2486 +        };
  5.2487 +        setSize = function (width, height) {
  5.2488 +            var cs = this.canvas.style;
  5.2489 +            width == +width && (width += "px");
  5.2490 +            height == +height && (height += "px");
  5.2491 +            cs.width = width;
  5.2492 +            cs.height = height;
  5.2493 +            cs.clip = "rect(0 " + width + " " + height + " 0)";
  5.2494 +            return this;
  5.2495 +        };
  5.2496 +        var createNode;
  5.2497 +        doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
  5.2498 +        try {
  5.2499 +            !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
  5.2500 +            createNode = function (tagName) {
  5.2501 +                return doc.createElement('<rvml:' + tagName + ' class="rvml">');
  5.2502 +            };
  5.2503 +        } catch (e) {
  5.2504 +            createNode = function (tagName) {
  5.2505 +                return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
  5.2506 +            };
  5.2507 +        }
  5.2508 +        create = function () {
  5.2509 +            var con = getContainer[apply](0, arguments),
  5.2510 +                container = con.container,
  5.2511 +                height = con.height,
  5.2512 +                s,
  5.2513 +                width = con.width,
  5.2514 +                x = con.x,
  5.2515 +                y = con.y;
  5.2516 +            if (!container) {
  5.2517 +                throw new Error("VML container not found.");
  5.2518 +            }
  5.2519 +            var res = new Paper,
  5.2520 +                c = res.canvas = doc.createElement("div"),
  5.2521 +                cs = c.style;
  5.2522 +            x = x || 0;
  5.2523 +            y = y || 0;
  5.2524 +            width = width || 512;
  5.2525 +            height = height || 342;
  5.2526 +            width == +width && (width += "px");
  5.2527 +            height == +height && (height += "px");
  5.2528 +            res.width = 1e3;
  5.2529 +            res.height = 1e3;
  5.2530 +            res.coordsize = zoom * 1e3 + S + zoom * 1e3;
  5.2531 +            res.coordorigin = "0 0";
  5.2532 +            res.span = doc.createElement("span");
  5.2533 +            res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
  5.2534 +            c[appendChild](res.span);
  5.2535 +            cs.cssText = R.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
  5.2536 +            if (container == 1) {
  5.2537 +                doc.body[appendChild](c);
  5.2538 +                cs.left = x + "px";
  5.2539 +                cs.top = y + "px";
  5.2540 +                cs.position = "absolute";
  5.2541 +            } else {
  5.2542 +                if (container.firstChild) {
  5.2543 +                    container.insertBefore(c, container.firstChild);
  5.2544 +                } else {
  5.2545 +                    container[appendChild](c);
  5.2546 +                }
  5.2547 +            }
  5.2548 +            plugins.call(res, res, R.fn);
  5.2549 +            return res;
  5.2550 +        };
  5.2551 +        Paper[proto].clear = function () {
  5.2552 +            this.canvas.innerHTML = E;
  5.2553 +            this.span = doc.createElement("span");
  5.2554 +            this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
  5.2555 +            this.canvas[appendChild](this.span);
  5.2556 +            this.bottom = this.top = null;
  5.2557 +        };
  5.2558 +        Paper[proto].remove = function () {
  5.2559 +            this.canvas.parentNode.removeChild(this.canvas);
  5.2560 +            for (var i in this) {
  5.2561 +                this[i] = removed(i);
  5.2562 +            }
  5.2563 +            return true;
  5.2564 +        };
  5.2565 +    }
  5.2566 + 
  5.2567 +    // rest
  5.2568 +    // WebKit rendering bug workaround method
  5.2569 +    if ((navigator.vendor == "Apple Computer, Inc.") && (navigator.userAgent.match(/Version\/(.*?)\s/)[1] < 4 || win.navigator.platform.slice(0, 2) == "iP")) {
  5.2570 +        Paper[proto].safari = function () {
  5.2571 +            var rect = this.rect(-99, -99, this.width + 99, this.height + 99).attr({stroke: "none"});
  5.2572 +            win.setTimeout(function () {rect.remove();});
  5.2573 +        };
  5.2574 +    } else {
  5.2575 +        Paper[proto].safari = function () {};
  5.2576 +    }
  5.2577 + 
  5.2578 +    // Events
  5.2579 +    var preventDefault = function () {
  5.2580 +        this.returnValue = false;
  5.2581 +    },
  5.2582 +    preventTouch = function () {
  5.2583 +        return this.originalEvent.preventDefault();
  5.2584 +    },
  5.2585 +    stopPropagation = function () {
  5.2586 +        this.cancelBubble = true;
  5.2587 +    },
  5.2588 +    stopTouch = function () {
  5.2589 +        return this.originalEvent.stopPropagation();
  5.2590 +    },
  5.2591 +    addEvent = (function () {
  5.2592 +        if (doc.addEventListener) {
  5.2593 +            return function (obj, type, fn, element) {
  5.2594 +                var realName = supportsTouch && touchMap[type] ? touchMap[type] : type;
  5.2595 +                var f = function (e) {
  5.2596 +                    if (supportsTouch && touchMap[has](type)) {
  5.2597 +                        for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
  5.2598 +                            if (e.targetTouches[i].target == obj) {
  5.2599 +                                var olde = e;
  5.2600 +                                e = e.targetTouches[i];
  5.2601 +                                e.originalEvent = olde;
  5.2602 +                                e.preventDefault = preventTouch;
  5.2603 +                                e.stopPropagation = stopTouch;
  5.2604 +                                break;
  5.2605 +                            }
  5.2606 +                        }
  5.2607 +                    }
  5.2608 +                    return fn.call(element, e);
  5.2609 +                };
  5.2610 +                obj.addEventListener(realName, f, false);
  5.2611 +                return function () {
  5.2612 +                    obj.removeEventListener(realName, f, false);
  5.2613 +                    return true;
  5.2614 +                };
  5.2615 +            };
  5.2616 +        } else if (doc.attachEvent) {
  5.2617 +            return function (obj, type, fn, element) {
  5.2618 +                var f = function (e) {
  5.2619 +                    e = e || win.event;
  5.2620 +                    e.preventDefault = e.preventDefault || preventDefault;
  5.2621 +                    e.stopPropagation = e.stopPropagation || stopPropagation;
  5.2622 +                    return fn.call(element, e);
  5.2623 +                };
  5.2624 +                obj.attachEvent("on" + type, f);
  5.2625 +                var detacher = function () {
  5.2626 +                    obj.detachEvent("on" + type, f);
  5.2627 +                    return true;
  5.2628 +                };
  5.2629 +                return detacher;
  5.2630 +            };
  5.2631 +        }
  5.2632 +    })(),
  5.2633 +    drag = [],
  5.2634 +    dragMove = function (e) {
  5.2635 +        var x = e.clientX,
  5.2636 +            y = e.clientY,
  5.2637 +            dragi,
  5.2638 +            j = drag.length;
  5.2639 +        while (j--) {
  5.2640 +            dragi = drag[j];
  5.2641 +            if (supportsTouch) {
  5.2642 +                var i = e.touches.length,
  5.2643 +                    touch;
  5.2644 +                while (i--) {
  5.2645 +                    touch = e.touches[i];
  5.2646 +                    if (touch.identifier == dragi.el._drag.id) {
  5.2647 +                        x = touch.clientX;
  5.2648 +                        y = touch.clientY;
  5.2649 +                        (e.originalEvent ? e.originalEvent : e).preventDefault();
  5.2650 +                        break;
  5.2651 +                    }
  5.2652 +                }
  5.2653 +            } else {
  5.2654 +                e.preventDefault();
  5.2655 +            }
  5.2656 +            dragi.move && dragi.move.call(dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y);
  5.2657 +        }
  5.2658 +    },
  5.2659 +    dragUp = function () {
  5.2660 +        R.unmousemove(dragMove).unmouseup(dragUp);
  5.2661 +        var i = drag.length,
  5.2662 +            dragi;
  5.2663 +        while (i--) {
  5.2664 +            dragi = drag[i];
  5.2665 +            dragi.el._drag = {};
  5.2666 +            dragi.end && dragi.end.call(dragi.el);
  5.2667 +        }
  5.2668 +        drag = [];
  5.2669 +    };
  5.2670 +    for (var i = events[length]; i--;) {
  5.2671 +        (function (eventName) {
  5.2672 +            R[eventName] = Element[proto][eventName] = function (fn) {
  5.2673 +                if (R.is(fn, "function")) {
  5.2674 +                    this.events = this.events || [];
  5.2675 +                    this.events.push({name: eventName, f: fn, unbind: addEvent(this.shape || this.node || doc, eventName, fn, this)});
  5.2676 +                }
  5.2677 +                return this;
  5.2678 +            };
  5.2679 +            R["un" + eventName] = Element[proto]["un" + eventName] = function (fn) {
  5.2680 +                var events = this.events,
  5.2681 +                    l = events[length];
  5.2682 +                while (l--) if (events[l].name == eventName && events[l].f == fn) {
  5.2683 +                    events[l].unbind();
  5.2684 +                    events.splice(l, 1);
  5.2685 +                    !events.length && delete this.events;
  5.2686 +                    return this;
  5.2687 +                }
  5.2688 +                return this;
  5.2689 +            };
  5.2690 +        })(events[i]);
  5.2691 +    }
  5.2692 +    Element[proto].hover = function (f_in, f_out) {
  5.2693 +        return this.mouseover(f_in).mouseout(f_out);
  5.2694 +    };
  5.2695 +    Element[proto].unhover = function (f_in, f_out) {
  5.2696 +        return this.unmouseover(f_in).unmouseout(f_out);
  5.2697 +    };
  5.2698 +    Element[proto].drag = function (onmove, onstart, onend) {
  5.2699 +        this._drag = {};
  5.2700 +        this.mousedown(function (e) {
  5.2701 +            (e.originalEvent || e).preventDefault();
  5.2702 +            this._drag.x = e.clientX;
  5.2703 +            this._drag.y = e.clientY;
  5.2704 +            this._drag.id = e.identifier;
  5.2705 +            onstart && onstart.call(this, e.clientX, e.clientY);
  5.2706 +            !drag.length && R.mousemove(dragMove).mouseup(dragUp);
  5.2707 +            drag.push({el: this, move: onmove, end: onend});
  5.2708 +        });
  5.2709 +        return this;
  5.2710 +    };
  5.2711 +    Element[proto].undrag = function (onmove, onstart, onend) {
  5.2712 +        var i = drag.length;
  5.2713 +        while (i--) {
  5.2714 +            drag[i].el == this && (drag[i].move == onmove && drag[i].end == onend) && drag.splice(i, 1);
  5.2715 +            !drag.length && R.unmousemove(dragMove).unmouseup(dragUp);
  5.2716 +        }
  5.2717 +    };
  5.2718 +    Paper[proto].circle = function (x, y, r) {
  5.2719 +        return theCircle(this, x || 0, y || 0, r || 0);
  5.2720 +    };
  5.2721 +    Paper[proto].rect = function (x, y, w, h, r) {
  5.2722 +        return theRect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
  5.2723 +    };
  5.2724 +    Paper[proto].ellipse = function (x, y, rx, ry) {
  5.2725 +        return theEllipse(this, x || 0, y || 0, rx || 0, ry || 0);
  5.2726 +    };
  5.2727 +    Paper[proto].path = function (pathString) {
  5.2728 +        pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
  5.2729 +        return thePath(R.format[apply](R, arguments), this);
  5.2730 +    };
  5.2731 +    Paper[proto].image = function (src, x, y, w, h) {
  5.2732 +        return theImage(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
  5.2733 +    };
  5.2734 +    Paper[proto].text = function (x, y, text) {
  5.2735 +        return theText(this, x || 0, y || 0, text || E);
  5.2736 +    };
  5.2737 +    Paper[proto].set = function (itemsArray) {
  5.2738 +        arguments[length] > 1 && (itemsArray = Array[proto].splice.call(arguments, 0, arguments[length]));
  5.2739 +        return new Set(itemsArray);
  5.2740 +    };
  5.2741 +    Paper[proto].setSize = setSize;
  5.2742 +    Paper[proto].top = Paper[proto].bottom = null;
  5.2743 +    Paper[proto].raphael = R;
  5.2744 +    function x_y() {
  5.2745 +        return this.x + S + this.y;
  5.2746 +    }
  5.2747 +    Element[proto].resetScale = function () {
  5.2748 +        if (this.removed) {
  5.2749 +            return this;
  5.2750 +        }
  5.2751 +        this._.sx = 1;
  5.2752 +        this._.sy = 1;
  5.2753 +        this.attrs.scale = "1 1";
  5.2754 +    };
  5.2755 +    Element[proto].scale = function (x, y, cx, cy) {
  5.2756 +        if (this.removed) {
  5.2757 +            return this;
  5.2758 +        }
  5.2759 +        if (x == null && y == null) {
  5.2760 +            return {
  5.2761 +                x: this._.sx,
  5.2762 +                y: this._.sy,
  5.2763 +                toString: x_y
  5.2764 +            };
  5.2765 +        }
  5.2766 +        y = y || x;
  5.2767 +        !+y && (y = x);
  5.2768 +        var dx,
  5.2769 +            dy,
  5.2770 +            dcx,
  5.2771 +            dcy,
  5.2772 +            a = this.attrs;
  5.2773 +        if (x != 0) {
  5.2774 +            var bb = this.getBBox(),
  5.2775 +                rcx = bb.x + bb.width / 2,
  5.2776 +                rcy = bb.y + bb.height / 2,
  5.2777 +                kx = x / this._.sx,
  5.2778 +                ky = y / this._.sy;
  5.2779 +            cx = (+cx || cx == 0) ? cx : rcx;
  5.2780 +            cy = (+cy || cy == 0) ? cy : rcy;
  5.2781 +            var dirx = ~~(x / math.abs(x)),
  5.2782 +                diry = ~~(y / math.abs(y)),
  5.2783 +                s = this.node.style,
  5.2784 +                ncx = cx + (rcx - cx) * kx,
  5.2785 +                ncy = cy + (rcy - cy) * ky;
  5.2786 +            switch (this.type) {
  5.2787 +                case "rect":
  5.2788 +                case "image":
  5.2789 +                    var neww = a.width * dirx * kx,
  5.2790 +                        newh = a.height * diry * ky;
  5.2791 +                    this.attr({
  5.2792 +                        height: newh,
  5.2793 +                        r: a.r * mmin(dirx * kx, diry * ky),
  5.2794 +                        width: neww,
  5.2795 +                        x: ncx - neww / 2,
  5.2796 +                        y: ncy - newh / 2
  5.2797 +                    });
  5.2798 +                    break;
  5.2799 +                case "circle":
  5.2800 +                case "ellipse":
  5.2801 +                    this.attr({
  5.2802 +                        rx: a.rx * dirx * kx,
  5.2803 +                        ry: a.ry * diry * ky,
  5.2804 +                        r: a.r * mmin(dirx * kx, diry * ky),
  5.2805 +                        cx: ncx,
  5.2806 +                        cy: ncy
  5.2807 +                    });
  5.2808 +                    break;
  5.2809 +                case "text":
  5.2810 +                    this.attr({
  5.2811 +                        x: ncx,
  5.2812 +                        y: ncy
  5.2813 +                    });
  5.2814 +                    break;
  5.2815 +                case "path":
  5.2816 +                    var path = pathToRelative(a.path),
  5.2817 +                        skip = true;
  5.2818 +                    for (var i = 0, ii = path[length]; i < ii; i++) {
  5.2819 +                        var p = path[i],
  5.2820 +                            P0 = upperCase.call(p[0]);
  5.2821 +                        if (P0 == "M" && skip) {
  5.2822 +                            continue;
  5.2823 +                        } else {
  5.2824 +                            skip = false;
  5.2825 +                        }
  5.2826 +                        if (P0 == "A") {
  5.2827 +                            p[path[i][length] - 2] *= kx;
  5.2828 +                            p[path[i][length] - 1] *= ky;
  5.2829 +                            p[1] *= dirx * kx;
  5.2830 +                            p[2] *= diry * ky;
  5.2831 +                            p[5] = +!(dirx + diry ? !+p[5] : +p[5]);
  5.2832 +                        } else if (P0 == "H") {
  5.2833 +                            for (var j = 1, jj = p[length]; j < jj; j++) {
  5.2834 +                                p[j] *= kx;
  5.2835 +                            }
  5.2836 +                        } else if (P0 == "V") {
  5.2837 +                            for (j = 1, jj = p[length]; j < jj; j++) {
  5.2838 +                                p[j] *= ky;
  5.2839 +                            }
  5.2840 +                         } else {
  5.2841 +                            for (j = 1, jj = p[length]; j < jj; j++) {
  5.2842 +                                p[j] *= (j % 2) ? kx : ky;
  5.2843 +                            }
  5.2844 +                        }
  5.2845 +                    }
  5.2846 +                    var dim2 = pathDimensions(path);
  5.2847 +                    dx = ncx - dim2.x - dim2.width / 2;
  5.2848 +                    dy = ncy - dim2.y - dim2.height / 2;
  5.2849 +                    path[0][1] += dx;
  5.2850 +                    path[0][2] += dy;
  5.2851 +                    this.attr({path: path});
  5.2852 +                break;
  5.2853 +            }
  5.2854 +            if (this.type in {text: 1, image:1} && (dirx != 1 || diry != 1)) {
  5.2855 +                if (this.transformations) {
  5.2856 +                    this.transformations[2] = "scale("[concat](dirx, ",", diry, ")");
  5.2857 +                    this.node[setAttribute]("transform", this.transformations[join](S));
  5.2858 +                    dx = (dirx == -1) ? -a.x - (neww || 0) : a.x;
  5.2859 +                    dy = (diry == -1) ? -a.y - (newh || 0) : a.y;
  5.2860 +                    this.attr({x: dx, y: dy});
  5.2861 +                    a.fx = dirx - 1;
  5.2862 +                    a.fy = diry - 1;
  5.2863 +                } else {
  5.2864 +                    this.node.filterMatrix = ms + ".Matrix(M11="[concat](dirx,
  5.2865 +                        ", M12=0, M21=0, M22=", diry,
  5.2866 +                        ", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");
  5.2867 +                    s.filter = (this.node.filterMatrix || E) + (this.node.filterOpacity || E);
  5.2868 +                }
  5.2869 +            } else {
  5.2870 +                if (this.transformations) {
  5.2871 +                    this.transformations[2] = E;
  5.2872 +                    this.node[setAttribute]("transform", this.transformations[join](S));
  5.2873 +                    a.fx = 0;
  5.2874 +                    a.fy = 0;
  5.2875 +                } else {
  5.2876 +                    this.node.filterMatrix = E;
  5.2877 +                    s.filter = (this.node.filterMatrix || E) + (this.node.filterOpacity || E);
  5.2878 +                }
  5.2879 +            }
  5.2880 +            a.scale = [x, y, cx, cy][join](S);
  5.2881 +            this._.sx = x;
  5.2882 +            this._.sy = y;
  5.2883 +        }
  5.2884 +        return this;
  5.2885 +    };
  5.2886 +    Element[proto].clone = function () {
  5.2887 +        if (this.removed) {
  5.2888 +            return null;
  5.2889 +        }
  5.2890 +        var attr = this.attr();
  5.2891 +        delete attr.scale;
  5.2892 +        delete attr.translation;
  5.2893 +        return this.paper[this.type]().attr(attr);
  5.2894 +    };
  5.2895 +    var getPointAtSegmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
  5.2896 +        var len = 0,
  5.2897 +            old;
  5.2898 +        for (var i = 0; i < 1.01; i+=.01) {
  5.2899 +            var dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
  5.2900 +            i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
  5.2901 +            if (len >= length) {
  5.2902 +                return dot;
  5.2903 +            }
  5.2904 +            old = dot;
  5.2905 +        }
  5.2906 +    }),
  5.2907 +    getLengthFactory = function (istotal, subpath) {
  5.2908 +        return function (path, length, onlystart) {
  5.2909 +            path = path2curve(path);
  5.2910 +            var x, y, p, l, sp = "", subpaths = {}, point,
  5.2911 +                len = 0;
  5.2912 +            for (var i = 0, ii = path.length; i < ii; i++) {
  5.2913 +                p = path[i];
  5.2914 +                if (p[0] == "M") {
  5.2915 +                    x = +p[1];
  5.2916 +                    y = +p[2];
  5.2917 +                } else {
  5.2918 +                    l = segmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
  5.2919 +                    if (len + l > length) {
  5.2920 +                        if (subpath && !subpaths.start) {
  5.2921 +                            point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
  5.2922 +                            sp += ["C", point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y];
  5.2923 +                            if (onlystart) {return sp;}
  5.2924 +                            subpaths.start = sp;
  5.2925 +                            sp = ["M", point.x, point.y + "C", point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]][join]();
  5.2926 +                            len += l;
  5.2927 +                            x = +p[5];
  5.2928 +                            y = +p[6];
  5.2929 +                            continue;
  5.2930 +                        }
  5.2931 +                        if (!istotal && !subpath) {
  5.2932 +                            point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
  5.2933 +                            return {x: point.x, y: point.y, alpha: point.alpha};
  5.2934 +                        }
  5.2935 +                    }
  5.2936 +                    len += l;
  5.2937 +                    x = +p[5];
  5.2938 +                    y = +p[6];
  5.2939 +                }
  5.2940 +                sp += p;
  5.2941 +            }
  5.2942 +            subpaths.end = sp;
  5.2943 +            point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[1], p[2], p[3], p[4], p[5], p[6], 1);
  5.2944 +            point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha});
  5.2945 +            return point;
  5.2946 +        };
  5.2947 +    },
  5.2948 +    segmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
  5.2949 +        var old = {x: 0, y: 0},
  5.2950 +            len = 0;
  5.2951 +        for (var i = 0; i < 1.01; i+=.01) {
  5.2952 +            var dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
  5.2953 +            i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
  5.2954 +            old = dot;
  5.2955 +        }
  5.2956 +        return len;
  5.2957 +    });
  5.2958 +    var getTotalLength = getLengthFactory(1),
  5.2959 +        getPointAtLength = getLengthFactory(),
  5.2960 +        getSubpathsAtLength = getLengthFactory(0, 1);
  5.2961 +    Element[proto].getTotalLength = function () {
  5.2962 +        if (this.type != "path") {return;}
  5.2963 +        if (this.node.getTotalLength) {
  5.2964 +            return this.node.getTotalLength();
  5.2965 +        }
  5.2966 +        return getTotalLength(this.attrs.path);
  5.2967 +    };
  5.2968 +    Element[proto].getPointAtLength = function (length) {
  5.2969 +        if (this.type != "path") {return;}
  5.2970 +        if (this.node.getPointAtLength) {
  5.2971 +            return this.node.getPointAtLength(length);
  5.2972 +        }
  5.2973 +        return getPointAtLength(this.attrs.path, length);
  5.2974 +    };
  5.2975 +    Element[proto].getSubpath = function (from, to) {
  5.2976 +        if (this.type != "path") {return;}
  5.2977 +        if (math.abs(this.getTotalLength() - to) < 1e-6) {
  5.2978 +            return getSubpathsAtLength(this.attrs.path, from).end;
  5.2979 +        }
  5.2980 +        var a = getSubpathsAtLength(this.attrs.path, to, 1);
  5.2981 +        return from ? getSubpathsAtLength(a, from).end : a;
  5.2982 +    };
  5.2983 +
  5.2984 +    // animation easing formulas
  5.2985 +    R.easing_formulas = {
  5.2986 +        linear: function (n) {
  5.2987 +            return n;
  5.2988 +        },
  5.2989 +        "<": function (n) {
  5.2990 +            return pow(n, 3);
  5.2991 +        },
  5.2992 +        ">": function (n) {
  5.2993 +            return pow(n - 1, 3) + 1;
  5.2994 +        },
  5.2995 +        "<>": function (n) {
  5.2996 +            n = n * 2;
  5.2997 +            if (n < 1) {
  5.2998 +                return pow(n, 3) / 2;
  5.2999 +            }
  5.3000 +            n -= 2;
  5.3001 +            return (pow(n, 3) + 2) / 2;
  5.3002 +        },
  5.3003 +        backIn: function (n) {
  5.3004 +            var s = 1.70158;
  5.3005 +            return n * n * ((s + 1) * n - s);
  5.3006 +        },
  5.3007 +        backOut: function (n) {
  5.3008 +            n = n - 1;
  5.3009 +            var s = 1.70158;
  5.3010 +            return n * n * ((s + 1) * n + s) + 1;
  5.3011 +        },
  5.3012 +        elastic: function (n) {
  5.3013 +            if (n == 0 || n == 1) {
  5.3014 +                return n;
  5.3015 +            }
  5.3016 +            var p = .3,
  5.3017 +                s = p / 4;
  5.3018 +            return pow(2, -10 * n) * math.sin((n - s) * (2 * math.PI) / p) + 1;
  5.3019 +        },
  5.3020 +        bounce: function (n) {
  5.3021 +            var s = 7.5625,
  5.3022 +                p = 2.75,
  5.3023 +                l;
  5.3024 +            if (n < (1 / p)) {
  5.3025 +                l = s * n * n;
  5.3026 +            } else {
  5.3027 +                if (n < (2 / p)) {
  5.3028 +                    n -= (1.5 / p);
  5.3029 +                    l = s * n * n + .75;
  5.3030 +                } else {
  5.3031 +                    if (n < (2.5 / p)) {
  5.3032 +                        n -= (2.25 / p);
  5.3033 +                        l = s * n * n + .9375;
  5.3034 +                    } else {
  5.3035 +                        n -= (2.625 / p);
  5.3036 +                        l = s * n * n + .984375;
  5.3037 +                    }
  5.3038 +                }
  5.3039 +            }
  5.3040 +            return l;
  5.3041 +        }
  5.3042 +    };
  5.3043 +
  5.3044 +    var animationElements = {length : 0},
  5.3045 +        animation = function () {
  5.3046 +            var Now = +new Date;
  5.3047 +            for (var l in animationElements) if (l != "length" && animationElements[has](l)) {
  5.3048 +                var e = animationElements[l];
  5.3049 +                if (e.stop || e.el.removed) {
  5.3050 +                    delete animationElements[l];
  5.3051 +                    animationElements[length]--;
  5.3052 +                    continue;
  5.3053 +                }
  5.3054 +                var time = Now - e.start,
  5.3055 +                    ms = e.ms,
  5.3056 +                    easing = e.easing,
  5.3057 +                    from = e.from,
  5.3058 +                    diff = e.diff,
  5.3059 +                    to = e.to,
  5.3060 +                    t = e.t,
  5.3061 +                    prev = e.prev || 0,
  5.3062 +                    that = e.el,
  5.3063 +                    callback = e.callback,
  5.3064 +                    set = {},
  5.3065 +                    now;
  5.3066 +                if (time < ms) {
  5.3067 +                    var pos = R.easing_formulas[easing] ? R.easing_formulas[easing](time / ms) : time / ms;
  5.3068 +                    for (var attr in from) if (from[has](attr)) {
  5.3069 +                        switch (availableAnimAttrs[attr]) {
  5.3070 +                            case "along":
  5.3071 +                                now = pos * ms * diff[attr];
  5.3072 +                                to.back && (now = to.len - now);
  5.3073 +                                var point = getPointAtLength(to[attr], now);
  5.3074 +                                that.translate(diff.sx - diff.x || 0, diff.sy - diff.y || 0);
  5.3075 +                                diff.x = point.x;
  5.3076 +                                diff.y = point.y;
  5.3077 +                                that.translate(point.x - diff.sx, point.y - diff.sy);
  5.3078 +                                to.rot && that.rotate(diff.r + point.alpha, point.x, point.y);
  5.3079 +                                break;
  5.3080 +                            case nu:
  5.3081 +                                now = +from[attr] + pos * ms * diff[attr];
  5.3082 +                                break;
  5.3083 +                            case "colour":
  5.3084 +                                now = "rgb(" + [
  5.3085 +                                    upto255(round(from[attr].r + pos * ms * diff[attr].r)),
  5.3086 +                                    upto255(round(from[attr].g + pos * ms * diff[attr].g)),
  5.3087 +                                    upto255(round(from[attr].b + pos * ms * diff[attr].b))
  5.3088 +                                ][join](",") + ")";
  5.3089 +                                break;
  5.3090 +                            case "path":
  5.3091 +                                now = [];
  5.3092 +                                for (var i = 0, ii = from[attr][length]; i < ii; i++) {
  5.3093 +                                    now[i] = [from[attr][i][0]];
  5.3094 +                                    for (var j = 1, jj = from[attr][i][length]; j < jj; j++) {
  5.3095 +                                        now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j];
  5.3096 +                                    }
  5.3097 +                                    now[i] = now[i][join](S);
  5.3098 +                                }
  5.3099 +                                now = now[join](S);
  5.3100 +                                break;
  5.3101 +                            case "csv":
  5.3102 +                                switch (attr) {
  5.3103 +                                    case "translation":
  5.3104 +                                        var x = diff[attr][0] * (time - prev),
  5.3105 +                                            y = diff[attr][1] * (time - prev);
  5.3106 +                                        t.x += x;
  5.3107 +                                        t.y += y;
  5.3108 +                                        now = x + S + y;
  5.3109 +                                    break;
  5.3110 +                                    case "rotation":
  5.3111 +                                        now = +from[attr][0] + pos * ms * diff[attr][0];
  5.3112 +                                        from[attr][1] && (now += "," + from[attr][1] + "," + from[attr][2]);
  5.3113 +                                    break;
  5.3114 +                                    case "scale":
  5.3115 +                                        now = [+from[attr][0] + pos * ms * diff[attr][0], +from[attr][1] + pos * ms * diff[attr][1], (2 in to[attr] ? to[attr][2] : E), (3 in to[attr] ? to[attr][3] : E)][join](S);
  5.3116 +                                    break;
  5.3117 +                                    case "clip-rect":
  5.3118 +                                        now = [];
  5.3119 +                                        i = 4;
  5.3120 +                                        while (i--) {
  5.3121 +                                            now[i] = +from[attr][i] + pos * ms * diff[attr][i];
  5.3122 +                                        }
  5.3123 +                                    break;
  5.3124 +                                }
  5.3125 +                                break;
  5.3126 +                        }
  5.3127 +                        set[attr] = now;
  5.3128 +                    }
  5.3129 +                    that.attr(set);
  5.3130 +                    that._run && that._run.call(that);
  5.3131 +                } else {
  5.3132 +                    if (to.along) {
  5.3133 +                        point = getPointAtLength(to.along, to.len * !to.back);
  5.3134 +                        that.translate(diff.sx - (diff.x || 0) + point.x - diff.sx, diff.sy - (diff.y || 0) + point.y - diff.sy);
  5.3135 +                        to.rot && that.rotate(diff.r + point.alpha, point.x, point.y);
  5.3136 +                    }
  5.3137 +                    (t.x || t.y) && that.translate(-t.x, -t.y);
  5.3138 +                    to.scale && (to.scale += E);
  5.3139 +                    that.attr(to);
  5.3140 +                    delete animationElements[l];
  5.3141 +                    animationElements[length]--;
  5.3142 +                    that.in_animation = null;
  5.3143 +                    R.is(callback, "function") && callback.call(that);
  5.3144 +                }
  5.3145 +                e.prev = time;
  5.3146 +            }
  5.3147 +            R.svg && that && that.paper && that.paper.safari();
  5.3148 +            animationElements[length] && win.setTimeout(animation);
  5.3149 +        },
  5.3150 +        upto255 = function (color) {
  5.3151 +            return mmax(mmin(color, 255), 0);
  5.3152 +        },
  5.3153 +        translate = function (x, y) {
  5.3154 +            if (x == null) {
  5.3155 +                return {x: this._.tx, y: this._.ty, toString: x_y};
  5.3156 +            }
  5.3157 +            this._.tx += +x;
  5.3158 +            this._.ty += +y;
  5.3159 +            switch (this.type) {
  5.3160 +                case "circle":
  5.3161 +                case "ellipse":
  5.3162 +                    this.attr({cx: +x + this.attrs.cx, cy: +y + this.attrs.cy});
  5.3163 +                    break;
  5.3164 +                case "rect":
  5.3165 +                case "image":
  5.3166 +                case "text":
  5.3167 +                    this.attr({x: +x + this.attrs.x, y: +y + this.attrs.y});
  5.3168 +                    break;
  5.3169 +                case "path":
  5.3170 +                    var path = pathToRelative(this.attrs.path);
  5.3171 +                    path[0][1] += +x;
  5.3172 +                    path[0][2] += +y;
  5.3173 +                    this.attr({path: path});
  5.3174 +                break;
  5.3175 +            }
  5.3176 +            return this;
  5.3177 +        };
  5.3178 +    Element[proto].animateWith = function (element, params, ms, easing, callback) {
  5.3179 +        animationElements[element.id] && (params.start = animationElements[element.id].start);
  5.3180 +        return this.animate(params, ms, easing, callback);
  5.3181 +    };
  5.3182 +    Element[proto].animateAlong = along();
  5.3183 +    Element[proto].animateAlongBack = along(1);
  5.3184 +    function along(isBack) {
  5.3185 +        return function (path, ms, rotate, callback) {
  5.3186 +            var params = {back: isBack};
  5.3187 +            R.is(rotate, "function") ? (callback = rotate) : (params.rot = rotate);
  5.3188 +            path && path.constructor == Element && (path = path.attrs.path);
  5.3189 +            path && (params.along = path);
  5.3190 +            return this.animate(params, ms, callback);
  5.3191 +        };
  5.3192 +    }
  5.3193 +    Element[proto].onAnimation = function (f) {
  5.3194 +        this._run = f || 0;
  5.3195 +        return this;
  5.3196 +    };
  5.3197 +    Element[proto].animate = function (params, ms, easing, callback) {
  5.3198 +        if (R.is(easing, "function") || !easing) {
  5.3199 +            callback = easing || null;
  5.3200 +        }
  5.3201 +        var from = {},
  5.3202 +            to = {},
  5.3203 +            diff = {};
  5.3204 +        for (var attr in params) if (params[has](attr)) {
  5.3205 +            if (availableAnimAttrs[has](attr)) {
  5.3206 +                from[attr] = this.attr(attr);
  5.3207 +                (from[attr] == null) && (from[attr] = availableAttrs[attr]);
  5.3208 +                to[attr] = params[attr];
  5.3209 +                switch (availableAnimAttrs[attr]) {
  5.3210 +                    case "along":
  5.3211 +                        var len = getTotalLength(params[attr]);
  5.3212 +                        var point = getPointAtLength(params[attr], len * !!params.back);
  5.3213 +                        var bb = this.getBBox();
  5.3214 +                        diff[attr] = len / ms;
  5.3215 +                        diff.tx = bb.x;
  5.3216 +                        diff.ty = bb.y;
  5.3217 +                        diff.sx = point.x;
  5.3218 +                        diff.sy = point.y;
  5.3219 +                        to.rot = params.rot;
  5.3220 +                        to.back = params.back;
  5.3221 +                        to.len = len;
  5.3222 +                        params.rot && (diff.r = toFloat(this.rotate()) || 0);
  5.3223 +                        break;
  5.3224 +                    case nu:
  5.3225 +                        diff[attr] = (to[attr] - from[attr]) / ms;
  5.3226 +                        break;
  5.3227 +                    case "colour":
  5.3228 +                        from[attr] = R.getRGB(from[attr]);
  5.3229 +                        var toColour = R.getRGB(to[attr]);
  5.3230 +                        diff[attr] = {
  5.3231 +                            r: (toColour.r - from[attr].r) / ms,
  5.3232 +                            g: (toColour.g - from[attr].g) / ms,
  5.3233 +                            b: (toColour.b - from[attr].b) / ms
  5.3234 +                        };
  5.3235 +                        break;
  5.3236 +                    case "path":
  5.3237 +                        var pathes = path2curve(from[attr], to[attr]);
  5.3238 +                        from[attr] = pathes[0];
  5.3239 +                        var toPath = pathes[1];
  5.3240 +                        diff[attr] = [];
  5.3241 +                        for (var i = 0, ii = from[attr][length]; i < ii; i++) {
  5.3242 +                            diff[attr][i] = [0];
  5.3243 +                            for (var j = 1, jj = from[attr][i][length]; j < jj; j++) {
  5.3244 +                                diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms;
  5.3245 +                            }
  5.3246 +                        }
  5.3247 +                        break;
  5.3248 +                    case "csv":
  5.3249 +                        var values = Str(params[attr])[split](separator),
  5.3250 +                            from2 = Str(from[attr])[split](separator);
  5.3251 +                        switch (attr) {
  5.3252 +                            case "translation":
  5.3253 +                                from[attr] = [0, 0];
  5.3254 +                                diff[attr] = [values[0] / ms, values[1] / ms];
  5.3255 +                            break;
  5.3256 +                            case "rotation":
  5.3257 +                                from[attr] = (from2[1] == values[1] && from2[2] == values[2]) ? from2 : [0, values[1], values[2]];
  5.3258 +                                diff[attr] = [(values[0] - from[attr][0]) / ms, 0, 0];
  5.3259 +                            break;
  5.3260 +                            case "scale":
  5.3261 +                                params[attr] = values;
  5.3262 +                                from[attr] = Str(from[attr])[split](separator);
  5.3263 +                                diff[attr] = [(values[0] - from[attr][0]) / ms, (values[1] - from[attr][1]) / ms, 0, 0];
  5.3264 +                            break;
  5.3265 +                            case "clip-rect":
  5.3266 +                                from[attr] = Str(from[attr])[split](separator);
  5.3267 +                                diff[attr] = [];
  5.3268 +                                i = 4;
  5.3269 +                                while (i--) {
  5.3270 +                                    diff[attr][i] = (values[i] - from[attr][i]) / ms;
  5.3271 +                                }
  5.3272 +                            break;
  5.3273 +                        }
  5.3274 +                        to[attr] = values;
  5.3275 +                }
  5.3276 +            }
  5.3277 +        }
  5.3278 +        this.stop();
  5.3279 +        this.in_animation = 1;
  5.3280 +        animationElements[this.id] = {
  5.3281 +            start: params.start || +new Date,
  5.3282 +            ms: ms,
  5.3283 +            easing: easing,
  5.3284 +            from: from,
  5.3285 +            diff: diff,
  5.3286 +            to: to,
  5.3287 +            el: this,
  5.3288 +            callback: callback,
  5.3289 +            t: {x: 0, y: 0}
  5.3290 +        };
  5.3291 +        ++animationElements[length] == 1 && animation();
  5.3292 +        return this;
  5.3293 +    };
  5.3294 +    Element[proto].stop = function () {
  5.3295 +        animationElements[this.id] && animationElements[length]--;
  5.3296 +        delete animationElements[this.id];
  5.3297 +        return this;
  5.3298 +    };
  5.3299 +    Element[proto].translate = function (x, y) {
  5.3300 +        return this.attr({translation: x + " " + y});
  5.3301 +    };
  5.3302 +    Element[proto][toString] = function () {
  5.3303 +        return "Rapha\xebl\u2019s object";
  5.3304 +    };
  5.3305 +    R.ae = animationElements;
  5.3306 + 
  5.3307 +    // Set
  5.3308 +    var Set = function (items) {
  5.3309 +        this.items = [];
  5.3310 +        this[length] = 0;
  5.3311 +        this.type = "set";
  5.3312 +        if (items) {
  5.3313 +            for (var i = 0, ii = items[length]; i < ii; i++) {
  5.3314 +                if (items[i] && (items[i].constructor == Element || items[i].constructor == Set)) {
  5.3315 +                    this[this.items[length]] = this.items[this.items[length]] = items[i];
  5.3316 +                    this[length]++;
  5.3317 +                }
  5.3318 +            }
  5.3319 +        }
  5.3320 +    };
  5.3321 +    Set[proto][push] = function () {
  5.3322 +        var item,
  5.3323 +            len;
  5.3324 +        for (var i = 0, ii = arguments[length]; i < ii; i++) {
  5.3325 +            item = arguments[i];
  5.3326 +            if (item && (item.constructor == Element || item.constructor == Set)) {
  5.3327 +                len = this.items[length];
  5.3328 +                this[len] = this.items[len] = item;
  5.3329 +                this[length]++;
  5.3330 +            }
  5.3331 +        }
  5.3332 +        return this;
  5.3333 +    };
  5.3334 +    Set[proto].pop = function () {
  5.3335 +        delete this[this[length]--];
  5.3336 +        return this.items.pop();
  5.3337 +    };
  5.3338 +    for (var method in Element[proto]) if (Element[proto][has](method)) {
  5.3339 +        Set[proto][method] = (function (methodname) {
  5.3340 +            return function () {
  5.3341 +                for (var i = 0, ii = this.items[length]; i < ii; i++) {
  5.3342 +                    this.items[i][methodname][apply](this.items[i], arguments);
  5.3343 +                }
  5.3344 +                return this;
  5.3345 +            };
  5.3346 +        })(method);
  5.3347 +    }
  5.3348 +    Set[proto].attr = function (name, value) {
  5.3349 +        if (name && R.is(name, array) && R.is(name[0], "object")) {
  5.3350 +            for (var j = 0, jj = name[length]; j < jj; j++) {
  5.3351 +                this.items[j].attr(name[j]);
  5.3352 +            }
  5.3353 +        } else {
  5.3354 +            for (var i = 0, ii = this.items[length]; i < ii; i++) {
  5.3355 +                this.items[i].attr(name, value);
  5.3356 +            }
  5.3357 +        }
  5.3358 +        return this;
  5.3359 +    };
  5.3360 +    Set[proto].animate = function (params, ms, easing, callback) {
  5.3361 +        (R.is(easing, "function") || !easing) && (callback = easing || null);
  5.3362 +        var len = this.items[length],
  5.3363 +            i = len,
  5.3364 +            item,
  5.3365 +            set = this,
  5.3366 +            collector;
  5.3367 +        callback && (collector = function () {
  5.3368 +            !--len && callback.call(set);
  5.3369 +        });
  5.3370 +        easing = R.is(easing, string) ? easing : collector;
  5.3371 +        item = this.items[--i].animate(params, ms, easing, collector);
  5.3372 +        while (i--) {
  5.3373 +            this.items[i].animateWith(item, params, ms, easing, collector);
  5.3374 +        }
  5.3375 +        return this;
  5.3376 +    };
  5.3377 +    Set[proto].insertAfter = function (el) {
  5.3378 +        var i = this.items[length];
  5.3379 +        while (i--) {
  5.3380 +            this.items[i].insertAfter(el);
  5.3381 +        }
  5.3382 +        return this;
  5.3383 +    };
  5.3384 +    Set[proto].getBBox = function () {
  5.3385 +        var x = [],
  5.3386 +            y = [],
  5.3387 +            w = [],
  5.3388 +            h = [];
  5.3389 +        for (var i = this.items[length]; i--;) {
  5.3390 +            var box = this.items[i].getBBox();
  5.3391 +            x[push](box.x);
  5.3392 +            y[push](box.y);
  5.3393 +            w[push](box.x + box.width);
  5.3394 +            h[push](box.y + box.height);
  5.3395 +        }
  5.3396 +        x = mmin[apply](0, x);
  5.3397 +        y = mmin[apply](0, y);
  5.3398 +        return {
  5.3399 +            x: x,
  5.3400 +            y: y,
  5.3401 +            width: mmax[apply](0, w) - x,
  5.3402 +            height: mmax[apply](0, h) - y
  5.3403 +        };
  5.3404 +    };
  5.3405 +    Set[proto].clone = function (s) {
  5.3406 +        s = new Set;
  5.3407 +        for (var i = 0, ii = this.items[length]; i < ii; i++) {
  5.3408 +            s[push](this.items[i].clone());
  5.3409 +        }
  5.3410 +        return s;
  5.3411 +    };
  5.3412 +
  5.3413 +    R.registerFont = function (font) {
  5.3414 +        if (!font.face) {
  5.3415 +            return font;
  5.3416 +        }
  5.3417 +        this.fonts = this.fonts || {};
  5.3418 +        var fontcopy = {
  5.3419 +                w: font.w,
  5.3420 +                face: {},
  5.3421 +                glyphs: {}
  5.3422 +            },
  5.3423 +            family = font.face["font-family"];
  5.3424 +        for (var prop in font.face) if (font.face[has](prop)) {
  5.3425 +            fontcopy.face[prop] = font.face[prop];
  5.3426 +        }
  5.3427 +        if (this.fonts[family]) {
  5.3428 +            this.fonts[family][push](fontcopy);
  5.3429 +        } else {
  5.3430 +            this.fonts[family] = [fontcopy];
  5.3431 +        }
  5.3432 +        if (!font.svg) {
  5.3433 +            fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10);
  5.3434 +            for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) {
  5.3435 +                var path = font.glyphs[glyph];
  5.3436 +                fontcopy.glyphs[glyph] = {
  5.3437 +                    w: path.w,
  5.3438 +                    k: {},
  5.3439 +                    d: path.d && "M" + path.d[rp](/[mlcxtrv]/g, function (command) {
  5.3440 +                            return {l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M";
  5.3441 +                        }) + "z"
  5.3442 +                };
  5.3443 +                if (path.k) {
  5.3444 +                    for (var k in path.k) if (path[has](k)) {
  5.3445 +                        fontcopy.glyphs[glyph].k[k] = path.k[k];
  5.3446 +                    }
  5.3447 +                }
  5.3448 +            }
  5.3449 +        }
  5.3450 +        return font;
  5.3451 +    };
  5.3452 +    Paper[proto].getFont = function (family, weight, style, stretch) {
  5.3453 +        stretch = stretch || "normal";
  5.3454 +        style = style || "normal";
  5.3455 +        weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400;
  5.3456 +        if (!R.fonts) {
  5.3457 +            return;
  5.3458 +        }
  5.3459 +        var font = R.fonts[family];
  5.3460 +        if (!font) {
  5.3461 +            var name = new RegExp("(^|\\s)" + family[rp](/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i");
  5.3462 +            for (var fontName in R.fonts) if (R.fonts[has](fontName)) {
  5.3463 +                if (name.test(fontName)) {
  5.3464 +                    font = R.fonts[fontName];
  5.3465 +                    break;
  5.3466 +                }
  5.3467 +            }
  5.3468 +        }
  5.3469 +        var thefont;
  5.3470 +        if (font) {
  5.3471 +            for (var i = 0, ii = font[length]; i < ii; i++) {
  5.3472 +                thefont = font[i];
  5.3473 +                if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) {
  5.3474 +                    break;
  5.3475 +                }
  5.3476 +            }
  5.3477 +        }
  5.3478 +        return thefont;
  5.3479 +    };
  5.3480 +    Paper[proto].print = function (x, y, string, font, size, origin) {
  5.3481 +        origin = origin || "middle"; // baseline|middle
  5.3482 +        var out = this.set(),
  5.3483 +            letters = Str(string)[split](E),
  5.3484 +            shift = 0,
  5.3485 +            path = E,
  5.3486 +            scale;
  5.3487 +        R.is(font, string) && (font = this.getFont(font));
  5.3488 +        if (font) {
  5.3489 +            scale = (size || 16) / font.face["units-per-em"];
  5.3490 +            var bb = font.face.bbox.split(separator),
  5.3491 +                top = +bb[0],
  5.3492 +                height = +bb[1] + (origin == "baseline" ? bb[3] - bb[1] + (+font.face.descent) : (bb[3] - bb[1]) / 2);
  5.3493 +            for (var i = 0, ii = letters[length]; i < ii; i++) {
  5.3494 +                var prev = i && font.glyphs[letters[i - 1]] || {},
  5.3495 +                    curr = font.glyphs[letters[i]];
  5.3496 +                shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) : 0;
  5.3497 +                curr && curr.d && out[push](this.path(curr.d).attr({fill: "#000", stroke: "none", translation: [shift, 0]}));
  5.3498 +            }
  5.3499 +            out.scale(scale, scale, top, height).translate(x - top, y - height);
  5.3500 +        }
  5.3501 +        return out;
  5.3502 +    };
  5.3503 +
  5.3504 +    var formatrg = /\{(\d+)\}/g;
  5.3505 +    R.format = function (token, params) {
  5.3506 +        var args = R.is(params, array) ? [0][concat](params) : arguments;
  5.3507 +        token && R.is(token, string) && args[length] - 1 && (token = token[rp](formatrg, function (str, i) {
  5.3508 +            return args[++i] == null ? E : args[i];
  5.3509 +        }));
  5.3510 +        return token || E;
  5.3511 +    };
  5.3512 +    R.ninja = function () {
  5.3513 +        oldRaphael.was ? (Raphael = oldRaphael.is) : delete Raphael;
  5.3514 +        return R;
  5.3515 +    };
  5.3516 +    R.el = Element[proto];
  5.3517 +    return R;
  5.3518 +})();
  5.3519 \ No newline at end of file