OSDN Git Service

0.98beta is built
[sie/sie.git] / sie.js
1 /*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
2  *公式ページは http://sie.sourceforge.jp/
3  *利用方法は <script defer="defer" type="text/javascript" src="sie.js"></script>
4  *http://sie.sourceforge.jp/
5  *Usage: <script defer="defer" type="text/javascript" src="sie.js"></script>
6  */
7 /* ***** BEGIN LICENSE BLOCK *****
8  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9  *
10  * The contents of this file are subject to the Mozilla Public License Version
11  * 1.1 (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS" basis,
16  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17  * for the specific language governing rights and limitations under the
18  * License.
19  *
20  * The Original Code is the Mozilla SVG Cairo Renderer project.
21  *
22  * The Initial Developer of the Original Code is IBM Corporation.
23  * Portions created by the Initial Developer are Copyright (C) 2004
24  * the Initial Developer. All Rights Reserved.
25  *
26  * Parts of this file contain code derived from the following files(s)
27  * of the Mozilla SVG project (these parts are Copyright (C) by their
28  * respective copyright-holders):
29  *    layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
30  *
31  * Contributor(s):DHRNAME revulo bellbind
32  *
33  * Alternatively, the contents of this file may be used under the terms of
34  * either of the GNU General Public License Version 2 or later (the "GPL"),
35  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
36  * in which case the provisions of the GPL or the LGPL are applicable instead
37  * of those above. If you wish to allow use of your version of this file only
38  * under the terms of either the GPL or the LGPL, and not to allow others to
39  * use your version of this file under the terms of the MPL, indicate your
40  * decision by deleting the provisions above and replace them with the notice
41  * and other provisions required by the GPL or the LGPL. If you do not delete
42  * the provisions above, a recipient may use your version of this file under
43  * the terms of any one of the MPL, the GPL or the LGPL.
44  *
45  * ***** END LICENSE BLOCK ***** */
46 /*
47  * Copyright (c) 2000 World Wide Web Consortium,
48  * (Massachusetts Institute of Technology, Institut National de
49  * Recherche en Informatique et en Automatique, Keio University). All
50  * Rights Reserved. This program is distributed under the W3C's Software
51  * Intellectual Property License. This program is distributed in the
52  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
53  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
54  * PURPOSE.
55  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
56  */
57
58 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/dom.idl
59 /*W3CのDOMのIDLを参照にコードを起こしている
60  *変数やプロパティ、メソッドの名前の頭に、「_」がついているときはSIE独自のもの
61  */
62 /*
63 #ifndef _DOM_IDL_
64 #define _DOM_IDL_
65
66 #pragma prefix "w3c.org"
67 module dom
68 {
69
70   valuetype DOMString sequence<unsigned short>;
71
72   typedef   unsigned long long DOMTimeStamp;
73
74   interface DocumentType;
75   interface Document;
76   interface NodeList;
77   interface NamedNodeMap;
78   interface Element;
79 */
80 function DOMException(n){
81  Error.apply(this, arguments);
82  this.code = n;
83  var s = [
84    "", //数合わせのため
85    "Index Size Error",
86    "DOMString Size Error",
87    "Hierarchy Request Error",
88    "Wrong Document Error",
89    "Invalid Character Error",
90    "No Data Allowed Error",
91    "No Modification Allowed Error",
92    "Not Found Error",
93    "Not Supported Error",
94    "Inuse Attribute Error",
95    "Invalid State Error",
96    "Syntax Error",
97    "Invalid Modification Error",
98    "Namespace Error",
99    "Invalid Access Error"
100  ];
101  this.message = s[n];
102  return this;
103 /*DOMSTRING_SIZE_ERR
104 テキストの指定された範囲がDOMStringに合致しない。 2
105 HIERARCHY_REQUEST_ERR
106 コードが属さない場所に挿入されている。 3
107 INDEX_SIZE_ERR
108 インデクス若しくは大きさが負数,又は許された値よりも大きい。 1
109 INUSE_ATTRIBUTE_ERR
110 他で既に使用されている属性を追加しようとしている。 10
111 INVALID_ACCESS_ERR,DOM水準2で導入 
112 パラメタ又は操作が基礎になるオブジェクトによってサポートされていない。 15
113 INVALID_CHARACTER_ERR
114 名前の中などで,妥当でない又は不正な文字が指定されている。文法に合った文字の定義についてはXML規定の 生成規則2 を,文法に合った名前文字については 生成規則5 を参照すること。5 
115 INVALID_MODIFICATION_ERR,DOM水準2で導入 
116 基礎となるオブジェクトの型を修正しようとしている。 13
117 INVALID_STATE_ERR,DOM水準2で導入 
118 利用不可能又はもはや利用可能ではないオブジェクトを使用しようとしている。 11
119 NAMESPACE_ERR,DOM水準2で導入 
120 名前空間に関して正しくない方法でオブジェクトを生成又は変更しようとしている。 14
121 NOT_FOUND_ERR
122 ノードが存在しない文脈でそのノードを参照しようとしている。 8
123 NOT_SUPPORTED_ERR
124 実装は,オブジェクト又は操作の要求された型をサポートしていない。9 
125 NO_DATA_ALLOWED_ERR
126 データをサポートしないノードに対してデータを指定している。 6
127 NO_MODIFICATION_ALLOWED_ERR
128 修正が許されない場所でオブジェクトを修正しようとしている。 7
129 SYNTAX_ERR,DOM水準2で導入 
130 妥当ではない又は不正な文字列が指定されている。 12
131 WRONG_DOCUMENT_ERR
132 ノードを生成した文書以外の(そのノードをサポートしない)異なる文書で,ノードが使用されている。4
133 */
134 };
135 (function(t) {
136 t.INDEX_SIZE_ERR                 = 1;
137 t.DOMSTRING_SIZE_ERR             = 2;
138 t.HIERARCHY_REQUEST_ERR          = 3;
139 t.WRONG_DOCUMENT_ERR             = 4;
140 t.INVALID_CHARACTER_ERR          = 5;
141 t.NO_DATA_ALLOWED_ERR            = 6;
142 t.NO_MODIFICATION_ALLOWED_ERR    = 7;
143 t.NOT_FOUND_ERR                  = 8;
144 t.NOT_SUPPORTED_ERR              = 9;
145 t.INUSE_ATTRIBUTE_ERR            = 10;
146 t.INVALID_STATE_ERR              = 11;
147 t.SYNTAX_ERR                     = 12;
148 t.INVALID_MODIFICATION_ERR       = 13;
149 t.NAMESPACE_ERR                  = 14;
150 t.INVALID_ACCESS_ERR             = 15;
151 t.prototype = new Error();
152 })(DOMException);
153
154 /*DOMImplementation
155  *DOMの基本的な機能をつかさどる
156  */
157 DOMImplementation = {
158     /* hasFeature
159      *文字列によって、機能をサポートしているかどうかをチェックする。削除不可。
160      */
161     /*boolean*/ hasFeature : function(/*string*/ feature, version) {
162       switch (feature) {
163         case "CORE" :
164         case "XML" :
165         case "Events" :              //DOM level2 Eventを参照
166         case "StyleSheets" :         //DOM level2 StyleSheetを参照
167         case "org.w3c.svg.static" :  //SVG1.1の仕様を参照
168         case "org.w3c.dom.svg.static" :
169           return true;
170         default :
171           if (version === "2.0") {   //DOM level2 Coreにおいて策定されたバージョン情報
172             return true;
173           } else {
174             return false;
175           }
176       }
177     },
178
179     /* createDocumentType
180      *ドキュメントタイプを作るためのもの。削除可。
181      */
182     /*DocumentType*/ createDocumentType : function(/*string*/ qualifiedName, publicId, systemId) {
183       var s = new Node();
184       s.publicId = publicId;
185       s.systemId = systemId;
186       return s;
187     },
188     /* createDocument
189      * ドキュメントオブジェクトを作るためのもの。削除不可。
190      */
191     /*Document*/ createDocument : function( /*string*/ ns, qname, /*DocumentType*/ doctype) {
192       try {
193         var s;
194         if (ns) {
195           s = new (DOMImplementation[ns].Document);
196           this._doc_ && (s._document_ = this._doc_);          //_document_プロパティはcreateElementNSメソッドやradialGradient要素やNAIBU._setPaintなどで使う
197         } else {
198           s = new Document();
199         }
200         s.implementation = this;
201         s.doctype = doctype;
202         s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る
203         return s;
204       } catch(e){alert(e.message);}
205     },
206     "http://www.w3.org/2000/xmlns": {}
207 };
208
209 /* Node
210  *ノード(節)はすべての雛形となる重要なものである。削除不可。
211  */
212
213 function Node(){
214   this.childNodes = [];
215   this._capter = []; //eventで利用
216   return this;
217 }
218 (function(t) {
219 // NodeType
220 /*const unsigned short*/  t.ELEMENT_NODE                   = 1;
221 /*const unsigned short*/  t.ATTRIBUTE_NODE                 = 2;
222 /*const unsigned short*/  t.TEXT_NODE                      = 3;
223 /*const unsigned short*/  t.CDATA_SECTION_NODE             = 4;
224 /*const unsigned short*/  t.ENTITY_REFERENCE_NODE          = 5;
225 /*const unsigned short*/  t.ENTITY_NODE                    = 6;
226 /*const unsigned short*/  t.PROCESSING_INSTRUCTION_NODE    = 7;
227 /*const unsigned short*/  t.COMMENT_NODE                   = 8;
228 /*const unsigned short*/  t.DOCUMENT_NODE                  = 9;
229 /*const unsigned short*/  t.DOCUMENT_TYPE_NODE             = 10;
230 /*const unsigned short*/  t.DOCUMENT_FRAGMENT_NODE         = 11;
231 /*const unsigned short*/  t.NOTATION_NODE                  = 12;
232 })(Node);
233 Node.prototype = {
234   //以下は初期値として設定
235   tar : null,
236   firstChild : null,
237   previousSibling : null,
238   nextSibling : null,
239   attributes : null,
240   namespaceURI : null,
241   localName : null,
242   lastChild : null,
243   prefix : null,
244   ownerDocument : null,
245   parentNode : null,
246 /*replaceChildメソッド
247  *指定したoldChildノードの代わりに、新たなnewChildノードを入れる。切り替え機能。
248  */
249 /*Node*/ replaceChild : function( /*Node*/ newChild, oldChild) {
250   this.insertBefore(newChild, oldChild);
251   var s = this.removeChild(oldChild);
252   return s;
253 },
254 /*appendChildメソッド
255  *eleノードをリストの最後尾に追加する
256  */
257 /*Node*/ appendChild : function( /*Node*/ ele) {
258   this.insertBefore(ele,null);
259   return ele;
260 },
261 /*hasChildNodesメソッド
262  *子ノードがあるかどうか
263  */
264 /*boolean*/ hasChildNodes : function() {
265   if (this.childNodes.length > 0) {
266     return true;
267   } else {
268     return false;
269   }
270 },
271 /*cloneNodeメソッド
272  *ノードのコピーを作る。引数は、子ノードのコピーも作るかどうか。コピー機能。
273  */
274 /*Node*/ cloneNode : function( /*boolean*/ deep) {
275   var s;
276   if (this.hasOwnProperty("ownerDocument")) {
277     s = this.ownerDocument.importNode(this, deep);
278   } else {
279     s = new Node();
280   }
281   return s;
282 },
283 /*normalizeメソッド
284  *二つ以上の重複したテキストノードを一つにまとめる
285  */
286 /*void*/ normalize : function() {
287   var tcn = this.childNodes;
288   try {
289   for (var i=tcn.length-1;i<0;--i) {
290     var tcni = tcn[i], tcnip = tcni.nextSibling;
291     if (tcnip) {
292       if (tcni.nodeType === Node.TEXT_NODE && tcnip.nodeType === Node.TEXT_NODE) {
293         tcni.appendData(tcnip.data);    //次ノードの文字列データを、現ノード文字列の後に付け加える
294         tcni.legnth = tcni.data.length;
295         this.removeChild(tcnip);        //次ノードを排除
296       } else {
297         tcni.normalize();
298       }
299     } else {
300       tcni.normalize();
301     }
302   }
303   } catch(e){};
304 },
305 /*isSupportedメソッド
306  *どんな機能をサポートしているかどうかをチェック
307  */
308 /*boolean*/ isSupported : function( /*string*/ feature, version) {
309   return (this.ownerDocument.implementation.hasFeature(feature+"", version+""));
310 },
311 /*hasAttributesメソッド
312  *ノードが属性を持っているかどうか
313  */
314 /*boolean*/ hasAttributes : function() {
315   if (this.attributes.length > 0) {
316     return true;
317   } else {
318     return false;
319   }
320 }
321 };
322
323
324 Array.prototype.item = function( /*long*/ index) {
325   return (this[index]);
326 };
327 /*ノードリストはArrayで代用。
328   interface NodeList {
329     Node               item(in unsigned long index);
330     readonly attribute unsigned long    length;
331   };
332 */
333
334 /*NamedNodeMap
335  *ノードの集合。ノードリストと違って、順序が決まっていない。削除不可
336  */
337 function NamedNodeMap() {
338   return this;
339 }
340 /*_copyNode
341  *cloneNodeを行う際に、用いる。削除不可
342  */
343 Array.prototype._copyNode = function __nnmp_c( /*NamedNodeMap*/ children, /*boolean*/ deep) {
344   for (var i=0,cli=children.length;i<cli;i++) {
345     this[i] = children[i].cloneNode(deep);
346   }
347 };
348
349 NamedNodeMap.prototype = {
350  /*number*/ length : 0,
351 /*
352  *名前空間に対応していないメソッドは、軽量化のため、機能させないようにする。代わりに、**NSメソッドを利用すること
353  */
354 /*Node*/ getNamedItem : function(/*string*/ name){
355   },
356 /*Node*/ setNamedItem : function(/*Node*/ arg){
357   },
358 /*Node*/ removeNamedItem : function(/*string*/ name){
359   },
360 /*Node*/ item : function( /*long*/ index) {
361     return this[index];
362   },
363 /*getNamedItemNSメソッド
364  *名前空間と名前を使って、ノードの集合から特定のノードを取り出す
365  */
366 /*Node*/ getNamedItemNS : function(/*string*/ namespaceURI, /*string*/ localName) {
367     var ta;
368     for (var i=0,tali=this.length;i<tali;i++) {
369       ta = this[i];
370       if (ta.namespaceURI === namespaceURI && ta.localName === localName) { //名前空間と名前がそれぞれ一致すれば
371         this._num = i;                                                      //場所をいったん記録しておく。(setNamedItemNSで使う)
372         return ta;
373       }
374     }
375     i = ta = void 0;
376     return null;
377   },
378 /*setNamedItemNSメソッド
379  *ノードの集合に特定のノードを設定
380  */
381 /*Node*/ setNamedItemNS : function(/*Node*/ arg) {
382     var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName),
383         s;
384     if (tgans) {                          //ノードがすでにあるならば、
385       s = this[this._num];
386       this[this._num] = arg;
387       arg = tgans = void 0;
388       return s;
389     } else {
390       if (arg.ownerElement !== void 0) { //ノードがもはや別の要素で使われている
391         throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
392       }
393       this[this.length] = arg;            //新たに、argを項目として追加する
394       this.length +=  1;
395       arg = void 0;
396       return null;
397     }
398   },
399 /*removeNamedItemNSメソッド
400  *名前空間と名前を使って、ノードの集合から特定のノードを排除
401  */
402 /*Node*/ removeNamedItemNS : function(/*string*/ namespaceURI, /*string*/ localName) {
403     var tgans = this.getNamedItemNS(namespaceURI, localName);
404     if (!tgans) {                          //ノードが見当たらない場合、
405       throw (new DOMException(DOMException.NOT_FOUND_ERR));
406     } else {
407       var s = this[this._num];
408       delete (this[this._num]);
409       this.length -= 1;
410       tgas = void 0;
411       return s;
412     }
413   },
414   _copyNode : Array.prototype._copyNode //上記のArrayの_copyNodeを参照
415 };
416
417 /*CharacterData
418  *文字データ。Textノードなどの元となる。削除不可。
419  */
420 function CharacterData(){
421  Node.apply(this);
422  return this;
423 };
424 CharacterData.prototype = new Node();                    //ノードのプロトタイプチェーンを作って、継承
425 CharacterData.constructor = Node;
426 CharacterData.prototype.length = 0;
427 /*substringDataメソッド
428  *offsetから数えてcount分の文字列を取り出す
429  */
430 /*string*/ CharacterData.prototype.substringData = function(/*long*/ offset, /*long*/ count) {
431   if (offset < 0 || count < 0 || offset > this.length) { //値が負か、データの長さよりoffsetが長いとき、サイズエラーを起こす
432     throw (new DOMException(INDEX_SIZE_ERR));
433   }
434   if (offset + count > this.length) {                    //offsetとcountの和が文字全体の長さを超える場合、offsetから最後までのを取り出す
435     count = this.length - offset;
436   }
437   var s = this.data.substr(offset, count);
438   return s;
439 };
440 /*void*/ CharacterData.prototype.replaceData = function( /*long*/ offset, /*long*/ count, /*string*/ arg) {
441   if (offset < 0 || count < 0 || offset > this.length) { //値が負か、データの長さよりoffsetが長いとき、サイズエラーを起こす
442     throw (new DOMException(INDEX_SIZE_ERR));
443   }
444   this.deleteData(offset, count);
445   this.insertData(offset, arg);
446 };
447
448 /*Attr
449  *属性ノード。削除不可。
450  */
451 function Attr() {
452   return this;
453 };
454 Attr.prototype = new Node();                    //ノードのプロトタイプチェーンを作って、継承
455 Attr.constructor = Node;
456 Attr.prototype.nodeType = Node.ATTRIBUTE_NODE;
457 Attr.prototype.nodeValue = null;
458
459 /*Element
460  *要素ノード。削除不可。
461  */
462 function Element() {
463   Node.apply(this);
464   this.attributes = new NamedNodeMap();          //属性を収納
465   return this;
466 };
467 Element.prototype = new Node();                  //ノードのプロトタイプチェーンを作って、継承
468 Element.constructor = Node;
469 Element.prototype.nodeType = Node.ELEMENT_NODE;
470 Element.prototype.nodeValue = null;
471 /*
472  *名前空間に対応していないメソッドは、軽量化のため、機能させないようにする。代わりに、**NSメソッドを利用すること
473  *(getAttributeとsetAttributeは普及しているので機能させる
474  */
475 /*string*/ Element.prototype.getAttribute = function( /*string*/ name) {
476   return (this.getAttributeNS(null, name));
477 };
478 /*void*/ Element.prototype.setAttribute = function( /*string*/ name, /*string*/ value) {
479   this.setAttributeNS(null, name, value);
480 };
481 /*void*/ Element.prototype.removeAttribute = function( /*string*/ name) {
482   this.removeAttributeNS(null, name);
483 };
484 /*Attr*/ Element.prototype.getAttributeNode = function( /*string*/ name) {
485 };
486 /*Attr*/ Element.prototype.setAttributeNode = function( /*Attr*/ newAttr) {
487 };
488 /*Attr*/ Element.prototype.removeAttributeNode = function( /*Attr*/ oldAttr) {
489   var s = this.attributes.removeNamedItemNS(oldAttr.namespaceURI, oldAttr.localName);  //attributesから該当するノードを排除
490   return s;
491 };
492 /*NodeList(Array)*/ Element.prototype.getElementsByTagName = function( /*string*/ name) {
493 };
494 /*string*/ Element.prototype.getAttributeNS = function( /*string*/ namespaceURI, /*string*/ localName) {
495   var n = this.getAttributeNodeNS(namespaceURI, localName);                      //属性ノードを取得する
496   if (!n) {
497     return null;
498   } else {
499     return (n.nodeValue);
500   }
501 };
502 /*void*/ Element.prototype.setAttributeNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName, /*string*/ value) {
503   var atn = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
504   /*元来、string型以外の型を許容すべきではないが、他のブラウザ(FirefoxやOpera)でエラーが出ないため許容する*/
505   atn.nodeValue = value+"";
506   atn.value = value+"";
507   this.setAttributeNodeNS(atn);
508 };
509 /*void*/ Element.prototype.removeAttributeNS = function( /*string*/ namespaceURI, /*string*/ localName) {
510 };
511 /*Attr*/ Element.prototype.getAttributeNodeNS = function( /*string*/ namespaceURI, /*string*/ localName) {
512   var s = this.attributes.getNamedItemNS(namespaceURI,localName);
513   return s;
514 };
515 /*NodeList(Array)*/ Element.prototype.getElementsByTagNameNS = function( /*string*/ namespaceURI, /*string*/ localName) {
516   var s = [], n = 0;
517   var tno = this.childNodes;
518   for (var i=0,tcli = tno.length;i<tcli;i++) {
519     var tnoi = tno[i];
520     if (tnoi.nodeType === Node.ELEMENT_NODE) {
521       var ns = (namespaceURI === "*") ? tnoi.namespaceURI : namespaceURI;
522       var ln = (localName === "*") ? tnoi.localName : localName;
523       if((tnoi.namespaceURI === ns) && (tnoi.localName === ln)) {
524         s[n++] = tnoi;
525       }
526       var d = tnoi.getElementsByTagNameNS(namespaceURI, localName);
527       if (d) {
528         for (var j=0,dli=d.length;j<dli;++j) {
529           s[n++] = d[j];
530         }
531       }
532       ns = ln = d = void 0;
533     }
534   }
535   tno = i = j = tcli = dli = void 0;
536   if (n === 0) {
537     n = void 0;
538     return null; //該当する要素なし
539   }
540   n = void 0;
541   return s;
542 };
543 /*boolean*/ Element.prototype.hasAttribute = function( /*string*/ name) {
544   return (this.hasAttributeNS("http://www.w3.org/2000/svg", name));
545 };
546 /*boolean*/ Element.prototype.hasAttributeNS = function( /*string*/ namespaceURI, /*string*/ localName) {
547   if (this.getAttributeNodeNS(namespaceURI, localName)) { //ノードの取得に成功した場合
548    return true;
549   } else {
550    return false;
551   }
552 };
553
554 /*Text
555  *テキストノード。削除不可。
556  */
557 function Text() {
558   return this;
559 };
560 Text.prototype = new CharacterData();                       //文字データのプロトタイプチェーンを作って、継承
561 Text.constructor = CharacterData;
562 Text.prototype.nodeType = Node.TEXT_NODE;
563 Text.prototype.nodeName = "#text";
564 /*Text*/ Text.prototype.splitText = function(/*long*/ offset) {
565   var pre = this.substringData(0, offset - 1);              //このノードからoffsetまでの文字列を取り出して、
566   this.replaceData(0, this.length - 1, pre);                //このノードの文字列と置き換える
567   var next = "";
568   if (this.length !== offset) {                             //このノードの文字列の長さがoffsetに等しくない場合
569     next = this.substringData(offset, this.length - 1);     //文字列を取り出す。(等しい場合は文字列を取り出さない)
570   }
571   var nnode = this.ownerDocument.createTextNode(next);
572   if (this.parentNode) {
573     this.parentNode.insertBefore(nnode, this.nextSibling);
574   }
575   return nnode;
576 };
577
578 /*Comment
579  *コメントノード。<!-- --!>で表現される。削除不可。
580  */
581 function Comment() {
582   return this;
583 };
584 Comment.prototype = new CharacterData();                    //文字データのプロトタイプチェーンを作って、継承
585 Comment.constructor = CharacterData;
586 Comment.prototype.nodeType = Node.COMMENT_NODE;
587 Comment.prototype.nodeName = "#comment";
588 /*CDATASection
589  *CDATA領域を示すノード。<![CDATA[ ]]!>で表現される。削除不可。
590  */
591 function CDATASection() {
592   this.nodeType = Node.CDATA_SECTION_NODE;
593   this.nodeName = "#cdata-section";
594   return this;
595 };
596 CDATASection.prototype = new Text();                        //テキストノードのプロトタイプチェーンを作って、継承
597 CDATASection.constructor = Text;
598
599 /*DocumentType
600  *DTD(文書型定義)の情報を取り扱うノード。DTDは<!DOCTYPE[ ]>で表現されうる。削除可
601  */
602 function DocumentType() {
603   //以下のメンバは削除可
604   this.name = "";
605   this.entities = new NamedNodeMap();   //パラメタ実体を除く実体の集まり
606   this.notations = new NamedNodeMap();  //DTDで示した記法の集まり
607   this.publicId = "";                   //外部サブセットの公開識別子
608   this.systemId = "";                   //上同のシステム識別子
609   this.internalSubset = "";             //内部サブセットの内容(文字列)
610   this.nodeValue = null;
611   this.nodeType = Node.DOCUMENT_TYPE_NODE;
612   return this;
613 };
614 DocumentType.prototype = new Node();   //ノードのプロトタイプチェーンを作って、継承
615 DocumentType.constructor = Node;
616
617 /*Notation
618  *DTDの記法の情報を取り扱うノード。<!NOTATION >か、処理命令で記法は表現されうる。削除可
619  */
620 function Notation() {
621   this.publicId = null;
622   this.systemId = null;
623   this.nodeValue = null;
624   this.nodeType = Node.NOTATION_NODE;
625   return this;
626 };
627 Notation.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
628 Notation.constructor = Node;
629
630 /*注意
631  *以下のノードは、もし、DOMを展開する前に、XMLプロセッサが実体参照の読み込みを行うのであれば、文書中に挿入される必要はない。
632  */
633 /*Entity
634  *解析対象(外)実体ノード。削除可
635  */
636 function Entity() {
637   this.publicId = null;
638   this.systemId = null;
639   this.notationName = null;      //解析対象外実体のための記法名。解析対象実体ではnull
640   this.nodeValue = null;
641   this.nodeType = Node.ENTITY_NODE;
642   return this;
643 };
644 Entity.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
645 Entity.constructor = Node;
646
647 /*EntityReference
648  *実態参照の代わりに挿入されるノード。削除可
649  */
650 function EntityReference() {
651   this.nodeValue = null;
652   this.nodeType = Node.ENTITY_REFERENCE_NODE ;
653   return this;
654 };
655 EntityReference.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
656 EntityReference.constructor = Node;
657
658 /*ProcessingInstruction
659  *処理命令ノード。スタイルシート処理命令で使うので、削除不可
660  */
661 function ProcessingInstruction() {
662   this.nodeType = Node.PROCESSING_INSTRUCTION_NODE;
663   return this;
664 };
665 ProcessingInstruction.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
666 ProcessingInstruction.constructor = Node;
667
668 /*DocumentFragment
669  *複数のノードを移したりするのに便宜上、用いられる文書ノード。削除可
670  */
671 function DocumentFragment() {
672   this.nodeName = "#document-fragment";
673   this.nodeValue = null;
674   this.nodeType = Node.DOCUMENT_FRAGMENT_NODE;
675   return this;
676 };
677 DocumentFragment.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
678 DocumentFragment.constructor = Node;
679
680 /*Document
681  *文書ノード。
682  */
683 function Document() {
684   this.nodeName = "#document";
685   this.nodeValue = null;
686   this.nodeType = Node.DOCUMENT_NODE;
687   this._id = {};  //getElementByIdで使う
688   return this;
689 };
690 Document.prototype = new Node();  //ノードのプロトタイプチェーンを作って、継承
691 Document.constructor = Node;
692
693 /*
694  *名前空間に対応していないメソッドは、軽量化のため、機能させないようにする。代わりに、**NSメソッドを利用すること。
695  *また、createメソッドは工場メソッドである。クラス名をユーザから隠蔽するのに役に立つ。
696  *突然、クラス名が変更されても、ライブラリを利用したユーザは、コードを書き換える必要がないなどのメリットがある。
697  */
698 /*Element*/ Document.prototype.createElement = function( /*string*/ tagName) {
699 };
700 /*createDocumentFragmentメソッド
701  *切り貼り用のドキュメントを作る。削除可
702  */
703 /*DocumentFragment*/   Document.prototype.createDocumentFragment = function() {
704   var s = new DocumentFragment();
705   s.ownerDocument = this;
706   return s;
707 };
708 /*createTextNodeメソッド
709  *テキストのノードを作る
710  */
711 /*Text*/               Document.prototype.createTextNode = function( /*string*/ data) {
712   var s = new Text();
713   s.data = s.nodeValue = data+"";
714   s.length = data.length;
715   s.ownerDocument = this;
716   return s;
717 };
718 /*createCommentメソッド
719  *コメントノードを作る
720  */
721 /*Comment*/            Document.prototype.createComment = function( /*string*/ data) {
722   var s = new Comment();
723   s.data = s.nodeValue = data;
724   s.length = data.length;
725   s.ownerDocument = this;
726   return s;
727 };
728 /*createCDATASectionメソッド
729  *CDATA領域ノードを作る
730  */
731 /*CDATASection*/       Document.prototype.createCDATASection = function( /*string*/ data) {
732   var s = new CDATASection();
733   s.data = s.nodeValue = data;
734   s.length = data.length;
735   s.ownerDocument = this;
736   return s;
737 };
738 /*createProcessingInstructionメソッド
739  *処理命令ノードを作る
740  */
741 /*ProcessingInstruction*/ Document.prototype.createProcessingInstruction = function( /*string*/ target, /*string*/ data) {
742   var s = new ProcessingInstruction();
743   s.target = s.nodeName = target;
744   s.data = s.nodeValue = data;
745   s.ownerDocument = this;
746   return s;
747 };
748 /*createAttribute
749  *createAttributeNSを推奨
750  */
751 /*Attr*/               Document.prototype.createAttribute = function( /*string*/ name) {
752 };
753 /*createEntityReferenceメソッド
754  *実体参照ノードを作る
755  */
756 /*EntityReference*/    Document.prototype.createEntityReference = function( /*string*/ name) {
757   var s = new EntityReference();
758   s.nodeName = name;
759   s.ownerDocument = this;
760   return s;
761 };
762 /*getElementsByTagNameメソッド
763  *getElementsByTagNameNSを推奨
764  */
765 /*NodeList*/           Document.prototype.getElementsByTagName = function( /*string*/ tagname) {
766 };
767 /*importNodeメソッド
768  *自身のドキュメントノードに、他のドキュメントノードから作られたノードを取り込みたいときに用いる
769  */
770 /*Node*/               Document.prototype.importNode = function( /*Node*/ importedNode, /*boolean*/ deep) {
771   var s,
772       imn = importedNode.nodeType,
773       attr, att, fi, n, uri, ch;
774   /*以下の処理は引き渡されたimportedNodeがMSXMLによって解析された
775    *データであることを前提にしている
776    */
777   if (imn === /*Node.ELEMENT_NODE*/ 1) {
778     s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName);
779     attr = importedNode.attributes;
780     for (var i=0;attr[i];++i) { //NamedNodeMapを検索する
781       ch = attr[i];
782       uri = ch.namespaceURI;
783       uri = (uri === "") ? null : uri; //空文字列はnullとして扱うようにする(MSXMLが空文字列を返す時の対策)
784       att = this.createAttributeNS(uri, ch.nodeName);
785       att.nodeValue = ch.nodeValue;
786       s.setAttributeNodeNS(att);
787     }
788     if (deep) {
789       fi = importedNode.firstChild;
790       while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する
791         n = this.importNode(fi, true);
792         s.appendChild(n);
793         fi = fi.nextSibling;
794       }
795     }
796     i = void 0;
797   } else if(imn === /*Node.TEXT_NODE*/ 3) {
798     s = this.createTextNode(importedNode.data);
799   } else if(imn === /*Node.ATTRIBUTE_NODE*/ 2) {
800     uri = importedNode.namespaceURI;
801     uri = (uri === "") ? null : uri; //空文字列はnullとして扱うようにする(MSXMLが空文字列を返す時の対策)
802     s = this.createAttributeNS(uri, importedNode.nodeName);
803     s.nodeValue = importedNode.nodeValue;
804   } else if(imn === /*Node.COMMENT_NODE*/ 8) {
805     s = this.createComment(importedNode.data);
806   } else if(imn === Node.DOCUMENT_FRAGMENT_NODE) {
807     s = this.createDocumentFragment();
808     if (deep) {
809       ch = importedNode.childNodes;
810       for (var i=0,chli=ch.length;i<chli;i++) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する
811         n = this.importNode(ch[i], true);
812         s.appendChild(n);
813       }
814     }
815     i = chli = void 0;
816   } else if(imn === Node.CDATA_SECTION_NODE) {
817     s = this.createCDATASection(importedNode.data);
818   } else if(imn === Node.ENTITY_REFERENCE_NODE) {
819     s = this.createEntityReference(importedNode.nodeName);
820     if (deep) {
821       fi = importedNode.firstChild;
822       while (fi) {
823         n = this.importNode(fi, true);
824         s.appendChild(n);
825         fi = fi.nextSibling;
826       }
827     }    
828   } else if(imn === Node.ENTITY_NODE) {
829     s = new Entity();
830     s.publicId = importedNode.publicId;
831     s.systemId = importedNode.systemId;
832     s.notationName = importedNode.notationName;
833   } else if(imn === Node.PROCESSING_INSTRUCTION_NODE ) {
834     s = this.createProcessingInstruction(importedNode.nodeName, importedNode.nodeValue)
835   } else if(imn === Node.NOTATION_NODE) {
836     s = new Notation();
837     s.publicId = importedNode.publicId;
838     s.systemId = importedNode.systemId;
839   } else {
840     throw (new DOMException(DOMException.NOT_SUPPORTED_ERR));
841   }
842   importedNode = deep = imn = attr = att = fi = n = uri = ch = void 0;
843   return s;
844 };
845 /*createElementNSメソッド
846  *要素ノードを作る。削除不可
847  *例:var s = DOC.createElementNS("http://www.w3.org/2000/svg", "svg:svg");
848  */
849 /*Element*/            Document.prototype.createElementNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName) {
850   var ele,
851       prefix = null,
852       localName = null;
853   if (!qualifiedName) {
854     throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
855   }
856   if (qualifiedName.indexOf(":") !== -1){
857     var p = qualifiedName.split(":");
858     prefix = p[0];
859     localName = p[1];
860   } else {
861     localName = qualifiedName;
862   }
863   var isSpecified = false;
864   if (namespaceURI) {
865     var ti = this.implementation;
866     if (!!ti[namespaceURI]) {
867       if (!!ti[namespaceURI][localName]) { //もし、名前空間とローカル名によって、オブジェクトがあった場合
868         isSpecified = true;
869       }
870     }
871   }
872   if (isSpecified) {
873     ele = new (ti[namespaceURI][localName])(this._document_);
874   } else {
875     ele = new Element();
876   }
877   ele.namespaceURI = namespaceURI;
878   ele.nodeName = ele.tagName = qualifiedName;
879   ele.localName = localName;
880   ele.prefix = prefix;
881   ele.ownerDocument = this;
882   ti = namespaceURI = qualifiedName = prefix = localName = isSpecified = void 0;
883   return ele;
884 };
885 Document.prototype._document_ = document
886 /*createAttributeNSメソッド
887  *属性ノードを作る。setAttributeNSで使うため、削除不可
888  */
889 /*Attr*/               Document.prototype.createAttributeNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName) {
890   var attr = new Attr(),
891       p;
892   attr.namespaceURI = namespaceURI;
893   attr.nodeName = attr.name = qualifiedName;
894   if (qualifiedName.indexOf(":") !== -1){
895    p = qualifiedName.split(":");
896     attr.prefix = p[0];
897     attr.localName = p[1];
898   } else {
899     attr.prefix = null;
900     attr.localName = qualifiedName;
901   }
902   attr.ownerDocument = this;
903   p = qualifiedName = void 0;
904   return attr;
905 };
906 /*getElementsByTagNameNSメソッド
907  *タグ名と名前空間URIを元に、要素ノード達を取得
908  */
909 /*NodeList*/           Document.prototype.getElementsByTagNameNS = function(/*string*/ namespaceURI, /*string*/ localName) {
910   var NodeList = this.documentElement.getElementsByTagNameNS(namespaceURI, localName);
911   return NodeList;
912 };
913 /*getElementByIdメソッド
914  *id属性の値で要素ノードを指定
915  */
916 /*Element*/            Document.prototype.getElementById = function( /*string*/ elementId) {
917   var s = !!this._id[elementId] ? this._id[elementId] : null;
918   return s;
919 };
920
921 /*
922 #endif // _DOM_IDL_*/
923 
924 //以下は例外処理のログをとるためのもの。開発者以外は削除すること
925 function STLog(jou) {
926 this.jo = jou;
927 if (this.jo) {
928   this.p = document.createElement("div");
929   this.p.innerHTML = "<h1>例外処理のログ</h1>";
930   document.body.insertBefore(this.p,document.body.firstChild);
931 }
932   return this;
933 }
934 STLog.prototype.add = function(e,code) {
935 if (this.jo) {
936   this.p.innerHTML += "<p>"+code+":"+e.message+"</p>";
937 }
938 }
939 /*
940
941 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.idl
942
943 #ifndef _EVENTS_IDL_
944 #define _EVENTS_IDL_
945
946 #include "dom.idl"
947 #include "views.idl"
948
949 #pragma prefix "dom.w3c.org"
950 module events
951 {
952
953   typedef dom::DOMString DOMString;
954   typedef dom::DOMTimeStamp DOMTimeStamp;
955   typedef dom::Node Node;
956
957   interface EventListener;
958   interface Event;
959 */
960 /*EventExceptionクラス
961  *イベント専用の例外クラス。
962  */
963 function EventException() {
964   DOMException.call(this,arguments);
965   if (this.code === 0) {
966     this.message = "Uuspecified Event Type Error";
967   }
968   return this;
969 };
970 /*unsigned short*/  EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0;
971
972 EventException.prototype = new DOMException();
973
974
975 /*  // Introduced in DOM Level 2:
976   interface EventTarget {*/
977 /*void*/  Node.prototype.addEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
978   this.removeEventListener(type, listener, useCapture);  //いったん、(あれば)リスナーを離す。
979   var s = new EventListener(useCapture, type, listener), //リスナーを作成
980       t = type.charAt(0),
981       that;
982   this._capter.push(s);                 //このノードにリスナーを登録しておく
983   if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば
984     that = this;
985     that._tar && that._tar.attachEvent("on" +type, (function(node, type) { 
986       return  function(){
987         var evt = node.ownerDocument.createEvent("MouseEvents");
988         evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);
989         node.dispatchEvent(evt);
990         /*cancelBubbleプロパティについては、IEのMSDNなどを参照*/
991         node.ownerDocument._window.event.cancelBubble = true;
992         evt = void 0;
993       };
994     })(that, type)
995     );
996   }
997   type = listener = useCapture = s = t = that = void 0;
998 };
999 /*void*/  Node.prototype.removeEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
1000   var tce = this._capter;
1001   for (var i=0,tcli=tce.length;i<tcli;i++){
1002     if (tce[i]._listener === listener) {  //登録したリスナーと一致すれば
1003       tce[i] = void 0;
1004     }
1005   }
1006   i = tcli = tce = void 0;
1007 };
1008 /*boolean*/  Node.prototype.dispatchEvent = function( /*Event*/ evt) {
1009   if (!evt.type) { //Eventの型が設定されていないとき
1010     throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR);
1011   }
1012   var te = this,
1013       td = te.ownerDocument,
1014       etime = evt.timeStamp,
1015       etype = evt.type,
1016       ebub = evt.bubbles,
1017       tob,
1018       toli,
1019       type = /*Event.CAPTURING_PHASE*/ 1,
1020       ecptype = /*Event.CAPTURING_PHASE*/ "1",
1021       ebptype = /*Event.BUBBLING_PHASE*/ "3",
1022       tce;
1023   if (!td._isLoaded) {
1024     /*以下では、画像の処理に時間がかかりそうな場合、処理落ちとして、遅延処理
1025      *を行い、バッファリングにイベント送付処理をためていく作業となる
1026      */
1027     if (!td._limit_time_) {
1028       td._limit_time_ = etime;
1029     } else if ((etime - td._limit_time_) > 1000) {
1030       /*1秒を超えたらバッファにため込んで後で使う*/
1031       tob = td.implementation._buffer_ || [];
1032       toli = tob.length
1033       tob[toli] = this;
1034       tob[toli+1] = evt;
1035       td.implementation._buffer_ = tob;
1036       te = td = etime = etype = ebub = tob = toli = type = void 0;
1037       return true;
1038     }
1039   }
1040   evt.target = te;
1041   evt.eventPhase = 1;//Event.CAPTURING_PHASE
1042   //このノードからドキュメントノードにいたるまでの、DOMツリーのリストを作成しておく
1043   td[ebptype] = null;
1044   /*以下の処理では、documentElementのparentNodeが
1045    *Documentノードではなく、nullになっていることを前提としている。
1046    *したがって、documentElementのparentNodeがもし、Documentノードのオブジェクトならば、以下を書き換えるべきである
1047    */
1048   while (te.parentNode) {
1049     te.parentNode[ecptype] = te;
1050     te[ebptype] = te.parentNode;
1051     te = te.parentNode;
1052   }
1053   td[ecptype] = te;
1054   te[ebptype] = td;
1055   /*最初に捕獲フェーズでDOMツリーを下っていき、イベントのターゲットについたら、
1056    *そこで、浮上フェーズとして折り返すように、反復処理をおこなう。
1057    */
1058   te = this;
1059   while (td) {
1060     evt.currentTarget = td;
1061     if (td === te) { //イベントのターゲットに到着(折り返し地点)
1062       type = 2;//Event.AT_TARGET;
1063     }
1064     evt.eventPhase = type;
1065     tce = td._capter; //tceは登録しておいたリスナーのリスト
1066     for (var j=0,tcli=tce.length;j<tcli;++j){
1067       if (tce[j] && (etype === tce[j]._type)) {
1068         tce[j].handleEvent(evt);
1069       }
1070     }
1071     if (evt._stop) {
1072       break; //stopPropagationメソッドが呼ばれたら、停止する
1073     }
1074     if (td === te) {
1075       if (!ebub) {
1076         break; //浮上フェーズに移行せず、停止する
1077       }
1078       type = 3;//Event.BUBBLING_PHASE;
1079     }
1080     td = td[type];
1081   }
1082   var ed = evt._default;
1083   evt = te = tce = n = td = type = tob = j = tcli = etype = etime = ebub = ecptype = ebptype = void 0;
1084   return ed;
1085 };
1086
1087 function EventListener(cap,type,listener) {
1088   this._cap = cap;
1089   this._type = type;
1090   this._listener = listener;
1091   return this;
1092 };
1093
1094 EventListener.prototype = {
1095 /*void*/ handleEvent : function( /*Event*/ evt) {
1096     try {
1097       var ph = evt.eventPhase,
1098           cap = this._cap;
1099       if (ph === /*Event.CAPTURING_PHASE*/ 1) { //イベントフェーズが捕獲段階であることを示し
1100         cap = cap ? false : true;         //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。
1101       }
1102       if (!cap && (evt.type === this._type)) {
1103         this._listener(evt);
1104       }
1105       evt = ph = cap = void 0;
1106     } catch (e) {
1107       
1108     }
1109   }
1110 };
1111
1112 /*Eventクラス
1113  *イベントの雛形となる。プロパティもすべて含めて、必須
1114  */
1115 function Event() {
1116   return this;
1117 };
1118 // PhaseType
1119 /*unsigned short*/ Event.CAPTURING_PHASE   = 1;
1120 /*unsigned short*/ Event.AT_TARGET         = 2;
1121 /*unsigned short*/ Event.BUBBLING_PHASE    = 3;
1122 Event.prototype = {
1123   /*DOMTimeStamp*/     timeStamp : 0,
1124   /*DOMString*/        type : null,
1125   /*EventTarget*/      target : null,
1126   /*EventTarget*/      currentTarget : null,
1127   /*unsigned short*/   eventPhase : Event.CAPTURING_PHASE,
1128   /*boolean*/          bubbles : false,
1129   /*boolean*/          cancelable : false,
1130   _stop : false, //stopPropagationメソッドで使う
1131   _default : true, //preventDefaultメソッドで使う
1132   /*void*/ stopPropagation : function(){
1133     this._stop = true;
1134   },
1135   /*void*/ preventDefault : function(){
1136     if (this.cancelable) {
1137       this._default = false;
1138       /*IEのみで使えるreturnValueプロパティ*/
1139       this.target.ownerDocument._window.event.returnValue = false;
1140     }
1141   },
1142   /*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) {
1143     this.type = eventTypeArg;
1144     this.bubbles = canBubbleArg;
1145     this.cancelable = cancelableArg;
1146     eventTypeArg = canBubbleArg = cancelableArg = void 0;
1147   }
1148 };
1149 /*Documentノードに直接結びつける
1150 function DocumentEvent() {
1151   return this;
1152 }*/
1153 /*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) {
1154   var evt,
1155       tc = this._cevent[eventType];
1156   if (tc) {
1157     evt = new tc();
1158   } else if (eventType === "SVGEvents") {
1159     evt = new SVGEvent();
1160   } else if (eventType === "TimeEvents") {
1161     evt = new TimeEvent();
1162   } else {
1163     evt =  new Event();
1164   }
1165   evt.type = eventType;
1166   evt.timeStamp = +(new Date());
1167   eventType = void 0;
1168   return evt;
1169 };
1170
1171 function UIEvent() {
1172 /*views::AbstractView*/  this.view;
1173 /*long*/                 this.detail = 0;
1174   return this;
1175 };
1176
1177 UIEvent.prototype = new Event();
1178 /*void*/ UIEvent.prototype.initUIEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg) {
1179   this.initEvent(typeArg, canBubbleArg, cancelableArg);
1180   this.detail = detailArg;
1181   this.view = viewArg;
1182 };
1183 function MouseEvent(evt) {
1184   UIEvent.call(this, arguments);
1185 /*long*/             this.screenX;
1186 /*long*/             this.screenY;
1187 /*long*/             this.clientX = this.clientY = 0;
1188 /*boolean*/          this.ctrlKey = this.shiftKey = this.altKey = this.metaKey = false;
1189 /*unsigned short*/   this.button;
1190 /*EventTarget*/      this.relatedTarget;
1191   return this;
1192 };
1193 MouseEvent.prototype = new UIEvent();
1194 /*void*/ MouseEvent.prototype.initMouseEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg, /*long*/ screenXArg, /*long*/ screenYArg, /*long*/ clientXArg, /*long*/ clientYArg, /*boolean*/ ctrlKeyArg, /*boolean*/ altKeyArg, /*boolean*/ shiftKeyArg, /*boolean*/ metaKeyArg, /*unsigned short*/ buttonArg, /*EventTarget*/ relatedTargetArg) {
1195   this.initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
1196   this.screenX = screenXArg;
1197   this.screenY = screenYArg;
1198   this.clientX  = clientXArg;
1199   this.clientY  = clientYArg;
1200   this.ctrlKey  = ctrlKeyArg;
1201   this.shiftKey = shiftKeyArg;
1202   this.altKey   = altKeyArg;
1203   this.metaKey  = metaKeyArg;
1204   this.button = buttonArg;
1205   this.relatedTarget = relatedTargetArg;
1206 };
1207
1208 function MutationEvent(){
1209   return this;
1210 };
1211 MutationEvent.prototype = new Event();
1212 (function() {
1213 /*void*/  this.initMutationEvent = function(/*string*/ typeArg, /*boolean*/ canBubbleArg,
1214     /*boolean*/ cancelableArg, /*Node*/ relatedNodeArg, /*string*/ prevValueArg, /*string*/ newValueArg,
1215     /*string*/ attrNameArg, /*unsigned short*/ attrChangeArg) {
1216     this.initEvent(typeArg, canBubbleArg, cancelableArg);
1217     this.relatedNode = relatedNodeArg;
1218     this.prevValue = prevValueArg;
1219     this.newValue = newValueArg;
1220     this.attrName = attrNameArg;
1221     this.attrChange = attrChangeArg;
1222     typeArg = canBubbleArg = cancelableArg = relatedNodeArg = prevValueArg = newValueArg = attrNameArg = attrChangeArg = void 0;
1223   };
1224   /*Node*/  this.relatedNode = null;
1225   /*string*/  this.prevValue = this.newValue = this.attrName = null;
1226   /*unsigned short*/  this.attrChange = 2;
1227 }).apply(MutationEvent.prototype);
1228     // attrChangeType
1229 /*unsigned short*/  MutationEvent.MODIFICATION  = 1;
1230 /*unsigned short*/  MutationEvent.ADDITION      = 2;
1231 /*unsigned short*/  MutationEvent.REMOVAL       = 3;
1232
1233 /*MutationEventsの発動のために、setAttributeNodeNSを上書きする。ファイル統合やmakeの際は、
1234  *重複するのでコアモジュールのメソッドは削除する。モジュールテストを行うために、
1235  *このような形式をとることにする。なお、追加部分には区別を付けるために、前後にコメントを挿入する。
1236  */
1237 /*Attr*/ Element.prototype.setAttributeNodeNS = function( /*Attr*/ newAttr){
1238   if (newAttr.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合
1239     throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
1240   }
1241   var s = this.attributes.setNamedItemNS(newAttr);
1242   newAttr.ownerElement = this;
1243   if (newAttr.localName === "id") {                   //id属性であったならば
1244     this.ownerDocument._id[newAttr.nodeValue] = this; //ドキュメントに登録しておく
1245   }
1246   /*ここから*/
1247   var evt = this.ownerDocument.createEvent("MutationEvents");
1248   if (!s) { //ノードがなければ
1249     /*initMutationEventメソッドは軽量化のため省略する*/
1250     evt.initEvent("DOMAttrModified", true, false);
1251     evt.relatedNode = newAttr;
1252     evt.newValue = newAttr.nodeValue;
1253     evt.attrName = newAttr.nodeName;
1254   } else {
1255     evt.initMutationEvent("DOMAttrModified", true, false, newAttr, s.nodeValue, newAttr.nodeValue, newAttr.nodeName, MutationEvent.MODIFICATION);
1256   }
1257   this.dispatchEvent(evt); //このとき、MutationEventsが発動
1258   evt = void 0;
1259   /*ここまで追加*/
1260   return s;
1261 };
1262
1263 /*Node*/ Node.prototype.insertBefore = function( /*Node*/ n, ref) {
1264   var tp = this.parentNode,
1265       rp, evt,
1266       te = this,
1267       s, descend, di;
1268   if (tp) {
1269     while (!tp) {                              //先祖をたどっていく
1270       if (tp === n) {                          //先祖要素が追加ノードならばエラー
1271         throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
1272       }
1273       tp = tp.parentNode;
1274     }
1275   }
1276   if (this.ownerDocument !== n.ownerDocument) { //所属Documentの生成元が違うならば
1277     throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
1278   }
1279   if (n.parentNode === this) {                  //入力した要素が子要素ならば
1280     this.removeChild(n);
1281   }
1282   if (!ref) {                                   //参照要素がNULLの場合、要素を追加する(appendChildと同じ効果)
1283     this.childNodes[this.childNodes.length] = n;
1284     if (this.lastChild) {
1285       n.previousSibling = this.lastChild;
1286       this.lastChild.nextSibling = n;
1287     }
1288   } else {
1289     if (ref.parentNode !== this) {              //参照ノードが子要素でない場合
1290       throw (new DOMException(DOMException.NOT_FOUND_ERR));
1291     }
1292     this.childNodes.splice(ref._num,1,n,ref);   //Arrayのspliceを利用して、リストにnノードを追加
1293     rp = ref.previousSibling;
1294     if (rp) {
1295       rp.nextSibling = n;
1296     }
1297     ref.previousSibling = n;
1298   }
1299   n.nextSibling = ref;
1300   this.firstChild = this.childNodes[0];
1301   this.lastChild = this.childNodes[this.childNodes.length-1];
1302   n.parentNode = this;
1303   if ((n.nodeType===/*Node.ENTITY_REFERENCE_NODE*/ 5) || (n.nodeType===/*Node.DOCUMENT_FRAGMENT_NODE*/ 11)) {
1304     /*実体参照や、文書フラグメントノードだけは子ノードを検索して、
1305      *それらを直接文書に埋め込む作業を以下で行う
1306      */
1307     var ch = n.childNodes.concat([]); //Arrayのコピー
1308     for (var i=0,chli=ch.length;i<chli;i++) {
1309       this.insertBefore(ch[i], n);
1310     }
1311     ch = void 0;
1312   }
1313   /*ここから*/
1314   evt = this.ownerDocument.createEvent("MutationEvents");
1315   evt.initMutationEvent("DOMNodeInserted", true, false, this, null, null, null, null);
1316   n.dispatchEvent(evt);
1317   /*以下のDOMNodeInsertedIntoDocumentイベントは、間接的、あるいは直接ノードが
1318    *挿入されたときに発火する。間接的な挿入とは、サブツリーを作っておいて、それをいっぺんに挿入する場合など。
1319    *このイベントは浮上しないことに注意を要する
1320    */
1321   do {
1322     s = te;
1323     te = te.parentNode;
1324   } while (te);
1325   if (s !== this.ownerDocument.documentElement) {
1326     evt = s = void 0;
1327     return n;
1328   }
1329   evt = this.ownerDocument.createEvent("MutationEvents");
1330   evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
1331   n.dispatchEvent(evt);
1332   if (!n.hasChildNodes()) {                       //子ノードがないので終了
1333     return n;
1334   }
1335   if (n.getElementsByTagNameNS) {
1336     descend = n.getElementsByTagNameNS("*", "*"); //全子孫要素を取得
1337   } else {
1338     descend = n.childNodes;
1339   }
1340   if (descend) {
1341     for (var i=0,dli=descend.length;i<dli;++i) {
1342       di = descend[i];
1343       di.dispatchEvent(evt);
1344       di = null;
1345     }
1346   }
1347   evt = descend = void 0;
1348   tp = rp = te = s = di = void 0;
1349   return n;
1350 };
1351
1352 /*Node*/ Node.prototype.removeChild = function( /*Node*/ ele) {
1353   if (!(ele instanceof Node)) {                   //Nodeでなければ
1354     throw (new Error());
1355   }
1356   /*ここから*/
1357   var evt = this.ownerDocument.createEvent("MutationEvents"),
1358       descend;
1359   /*以下のDOMNodeRemovedFromDocumentイベントは、間接的、あるいは直接ノードが
1360    *除去されたときに発火する。間接的な除去とは、サブツリーをいっぺんに除去する場合など。
1361    *このイベントは浮上しないことに注意を要する
1362    */
1363   evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);
1364   ele.dispatchEvent(evt);
1365   if (ele.getElementsByTagNameNS) {
1366     descend = ele.getElementsByTagNameNS("*", "*"); //全子孫要素を取得
1367   } else {
1368     descend = ele.childNodes;
1369   }
1370   if (descend) {
1371     evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);
1372     for (var i=0,dli=descend.length;i<dli;++i) {
1373       var di = descend[i];
1374       evt.target = di;
1375       di.dispatchEvent(evt);
1376       di = void 0;
1377     }
1378   }
1379   evt.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);
1380   ele.dispatchEvent(evt);
1381   evt = descend = void 0;
1382   /*ここまで追加*/
1383   if (ele.parentNode === this) {
1384     this.childNodes.splice(ele._num,1);           //Arrayのspliceを利用して、リストからeleノードを排除
1385   } else {                                        //親が違う場合
1386     throw (new DOMException(DOMException.NOT_FOUND_ERR));
1387   }
1388   if (ele.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合
1389     throw (new Error());
1390   }
1391   return ele;
1392 };
1393
1394 /*void*/ CharacterData.prototype.appendData = function( /*string*/ arg) {
1395   var pd = this.data,
1396       evt;
1397   this.data += arg;
1398   this.length = this.data.length;
1399   /*ここから*/
1400   evt = this.ownerDocument.createEvent("MutationEvents");
1401   evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
1402   this.parentNode.dispatchEvent(evt);
1403   evt = arg = pd = void 0;
1404   /*ここまで追加*/
1405 };
1406 /*void*/ CharacterData.prototype.insertData = function( /*long*/ offset, /*string*/ arg) {
1407   var pd = this.data,
1408       pre = this.substring(0, offset - 1),                 //文字列を二つに分けた、前半部分
1409       next = this.substring(offset, this.length - offset), //後半部分
1410       evt;
1411   this.data = pre + this.data + next;
1412   this.length = this.data.length;
1413   /*ここから*/
1414   evt = this.ownerDocument.createEvent("MutationEvents");
1415   evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
1416   this.parentNode.dispatchEvent(evt);
1417   evt = arg = pd = pre = next = void 0;
1418   /*ここまで追加*/
1419 };
1420 /*void*/ CharacterData.prototype.deleteData = function( /*long*/ offset, /*long*/ count) {
1421   var pd = this.data;
1422       pre = this.substring(0, offset - 1),                    //残すべき前半部分
1423       next = this.substring(offset + count, this.length - 1), //後半部分
1424       evt;
1425   if (offset + count > this.length) {                         //offsetとcountの和が文字全体の長さを超える場合、offsetから最後までのを削除
1426     next = "";
1427   }
1428   this.data = pre + next;
1429   this.length = this.data.length;
1430   /*ここから*/
1431   evt = this.ownerDocument.createEvent("MutationEvents");
1432   evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
1433   this.parentNode.dispatchEvent(evt);
1434   evt = pd = void 0;
1435   /*ここまで追加*/
1436 };
1437
1438 /*_ceventプロパティはcreateEventメソッドで軽量化のために使う。*/
1439 Document.prototype._cevent = {
1440     "MutationEvents" : MutationEvent,
1441     "MouseEvents" : MouseEvent,
1442     "UIEvents" : UIEvent
1443 };
1444
1445
1446 // _EVENTS_IDL_
1447 
1448 /*
1449 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.idl
1450
1451 #ifndef _STYLESHEETS_IDL_
1452 #define _STYLESHEETS_IDL_
1453
1454 #include "dom.idl"
1455
1456 #pragma prefix "dom.w3c.org"
1457 module stylesheets
1458 {
1459
1460   typedef dom::DOMString DOMString;
1461   typedef dom::Node Node;
1462 */
1463
1464 /*StyleSheet
1465  *スタイルシート文書を示す。削除不可。
1466  */
1467 function StyleSheet() {
1468  this.type = "text/css";
1469  this.disabled = false;
1470  /*Node*/ this.ownerNode = null;
1471  /*StyleSheet*/ this.parentStyleSheet = null;
1472  this.href = null;
1473  this.title = "";
1474  /*MediaList*/ this.media = new MediaList();
1475  return this;
1476 };
1477
1478 /*StyleSheetList
1479  *このインターフェースはArrayで代用する
1480 function StyleSheetList() {
1481     readonly attribute unsigned long    length;
1482     StyleSheet         item(in unsigned long index);
1483   };
1484 */
1485
1486 function MediaList() {
1487  this.mediaText = "";
1488  this.length = 0;
1489  return this;
1490 };
1491 MediaList.prototype = {
1492 /*string*/ item : function(/*long*/ index) {
1493     return (this[index]);
1494   },
1495 /*void*/   deleteMedium : function(/*string*/ oldMedium) {
1496     for (var i=0,tli=this.length;i<tli;++i) {
1497       if (this[i] === oldMedium) {
1498         delete this[i];
1499         --this.length;
1500         return;
1501       }
1502     }
1503     throw (new DOMException(DOMException.NOT_FOUND_ERR));
1504   },
1505 /*void*/   appendMedium : function(/*string*/ newMedium) {
1506     this[this.length] = newMedium;
1507     ++this.length;
1508   }
1509 };
1510
1511 function LinkStyle() {
1512  /*StyleSheet*/ this.sheet = new StyleSheet();
1513  return this;
1514 };
1515
1516 function DocumentStyle() {
1517  /*StyleSheetList*/ this.styleSheets = [];
1518  return this;
1519 };
1520 /*
1521 #endif // _STYLESHEETS_IDL_
1522 */
1523 /*
1524 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.idl
1525
1526 #ifndef _CSS_IDL_
1527 #define _CSS_IDL_
1528
1529 #include "dom.idl"
1530 #include "stylesheets.idl"
1531 #include "views.idl"
1532
1533 #pragma prefix "dom.w3c.org"
1534 module css
1535 {
1536
1537   typedef dom::DOMString DOMString;
1538   typedef dom::Element Element;
1539   typedef dom::DOMImplementation DOMImplementation;
1540
1541   interface CSSRule;
1542   interface CSSStyleSheet;
1543   interface CSSStyleDeclaration;
1544   interface CSSValue;
1545   interface Counter;
1546   interface Rect;
1547   interface RGBColor;
1548 */
1549 /*CSSRuleList
1550  *Arrayで代用
1551 function CSSRuleList {
1552     readonly attribute unsigned long    length;
1553     CSSRule            item(in unsigned long index);
1554   };
1555 */
1556 /*CSSRule
1557  *CSSのルールを表現する。基底クラスなので削除不可。
1558  */
1559 function CSSRule() {
1560   this.cssText = "";
1561 /*CSSStyleSheet*/ this.parentStyleSheet;
1562 /*CSSRule*/       this.parentRule = null;
1563   return this;
1564 };
1565 // RuleType
1566 CSSRule.UNKNOWN_RULE                   = 0;
1567 CSSRule.STYLE_RULE                     = 1;
1568 CSSRule.CHARSET_RULE                   = 2;
1569 CSSRule.IMPORT_RULE                    = 3;
1570 CSSRule.MEDIA_RULE                     = 4;
1571 CSSRule.FONT_FACE_RULE                 = 5;
1572 CSSRule.PAGE_RULE                      = 6;
1573
1574 function CSSStyleRule() {
1575   CSSRule.call(this, arguments);
1576   this.type = CSSRule.STYLE_RULE;
1577   this.selectorText = "";
1578 /*CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration();
1579   this.style.parentRule = null;
1580   return this;
1581 };
1582 CSSStyleRule.prototype = new CSSRule();
1583
1584 function CSSMediaRule() {
1585   CSSRule.call(this, arguments);
1586   this.type = CSSRule.MEDIA_RULE;
1587 /*stylesheets::MediaList*/ this.media = new MediaList();
1588 /*CSSRuleList*/ this.cssRules = [];
1589   return this;
1590 };
1591 CSSMediaRule.prototype = new CSSRule();
1592 /*long*/ CSSMediaRule.prototype.insertRule = function( /*string*/ rule, /*long*/ index) {
1593   this.cssRules.splice(index,rule,1);
1594   this.media.appendMedium(rule);
1595   return this;
1596 };
1597 /*void*/ CSSMediaRule.prototype.deleteRule = function( /*long*/ index) {
1598 };
1599
1600 function CSSFontFaceRule() {
1601   CSSRule.call(this, arguments);
1602   this.type = CSSRule.FONT_FACE_RULE;
1603 /*CSSStyleDeclaration*/ this.style;
1604   return this;
1605 };
1606 CSSFontFaceRule.prototype = new CSSRule();
1607
1608 function CSSPageRule() {
1609   CSSRule.call(this, arguments);
1610   this.type = CSSRule.PAGE_RULE;
1611   this.selectorText = "";
1612 /*CSSStyleDeclaration*/ this.style;
1613   return this;
1614 };
1615 CSSPageRule.prototype = new CSSRule();
1616
1617 function CSSImportRule() {
1618   CSSRule.call(this, arguments);
1619   this.type = CSSRule.IMPORT_RULE;
1620   this.href = "";
1621 /*stylesheets::MediaList*/ this.media = new MediaList();
1622 /*CSSStyleSheet*/ this.styleSheet = null;
1623   return this;
1624 };
1625 CSSImportRule.prototype = new CSSRule();
1626
1627 function CSSCharsetRule() {
1628   CSSRule.call(this, arguments);
1629   this.type = CSSRule.CHARSET_RULE;
1630   this.encoding = "";
1631   return this;
1632 };
1633 CSSCharsetRule.prototype = new CSSRule();
1634
1635 function CSSUnknownRule() {
1636   CSSRule.call(this, arguments);
1637   this.type = CSSRule.UNKNOWN_RULE;
1638   return this;
1639 };
1640 CSSUnknownRule.prototype = new CSSRule();
1641
1642 /*CSSStyleDeclaration
1643  *CSSの宣言ブロックを表現。削除不可。
1644  */
1645 function CSSStyleDeclaration() {
1646   this._list = []; //内部のリスト
1647   this._list._fontSize = this._list._opacity = null;
1648   return this;
1649 };
1650 CSSStyleDeclaration.prototype = {
1651   cssText : "",
1652   /*long*/ length : 0,
1653   /*CSSRule*/ parentRule : null,
1654   _urlreg : /url\(#([^)]+)/,
1655   /*getPropertyValueメソッド
1656    *CSSの値を返す。この値は継承ではなくて、明示的に表記されているもの
1657    */
1658 /*string*/   getPropertyValue : function( /*string*/ propertyName) {
1659     var tg = this.getPropertyCSSValue(propertyName);
1660     if (tg) {                             //見つかった場合
1661       var tc = tg.cssText;
1662       return (tc.slice(tc.indexOf(":")+1));
1663     } else {
1664       return "";
1665     }
1666   },
1667   /*getPropertyCSSValueメソッド
1668    *CSSValueオブジェクトを返す。このメソッドは判別に用いているので、削除不可。
1669    */
1670 /*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
1671     var prop = propertyName,
1672         ti, tc;
1673     propertyName += ":";
1674     if (propertyName === ":") { //どんなデータ型でも、文字列に変換する機能をJavaScriptが持つことに注意
1675       return null;
1676     }
1677     for (var i=0,tl=this._list,tli=tl.length;i<tli;++i) {
1678       ti = tl[i];
1679       tc = ti.cssText;
1680       if (tc.indexOf(propertyName) > -1) {  //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 
1681         ti._empercents = tl._fontSize;
1682         i = tl = tli = tc = prop = propertyName = void 0;
1683         return ti;
1684       }
1685     }
1686     i = tl = tli = prop = propertyName = void 0;
1687     return null;
1688   },
1689   /*removePropertyメソッド
1690    *プロパティを宣言内から除去
1691    */
1692 /*string*/   removeProperty : function( /*string*/ propertyName) {
1693     var tg = this.getPropertyCSSValue(propertyName);
1694     if (tg) {                        //見つかった場合
1695       this._list.splice(tg._num,1);  //Arrayのspliceを利用して、リストからCSSValueオブジェクトを排除
1696       --this.length;
1697     }
1698   },
1699   /*getPropertyPriorityメソッド
1700    *importantなどのpriorityを取得する
1701    */
1702 /*string*/   getPropertyPriority : function( /*string*/ propertyName) {
1703     var tg = this.getPropertyCSSValue(propertyName);
1704     if (tg) {                        //見つかった場合
1705       return (tg._priority);
1706     } else {
1707       return "";
1708     }
1709   },
1710   _isFillStroke : {
1711     "fill" : 1,
1712     "stroke" : 1
1713   },
1714   _isColor : {
1715     "color" : 1
1716   },
1717   _isStop : {
1718     "stop-color" : 1
1719   },
1720   _isRS : {
1721     "r" : 1,
1722     "#" : 1
1723   },
1724   /*setPropertyメソッド
1725    *プロパティを宣言内で、明示的に設定。継承は無視する
1726    */
1727 /*void*/     setProperty : function( /*string*/ propertyName, /*string*/ value, /*string*/ priority) {
1728     var cssText = propertyName,
1729         tg = null,
1730         ti, paintType, v1,
1731         uri = null,
1732         color = null,
1733         fill, stroke, stop;
1734     if (!!this[propertyName]) {
1735       tg = this.getPropertyCSSValue(propertyName);
1736     }
1737     cssText += ":";
1738     cssText += value;
1739     if (this._isFillStroke[propertyName]) {
1740       /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
1741        *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
1742        */
1743       if (tg) {  //見つかった場合
1744         ti = tg;
1745       } else {
1746         ti = new SVGPaint();
1747       }
1748       paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
1749       v1 = value.charAt(0);
1750       if (this._isRS[v1] || ti._keywords[value]) {
1751         paintType = /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1;
1752         color = value;
1753       } else if (value === "none") {
1754         paintType = /*SVGPaint.SVG_PAINTTYPE_NONE*/ 101;
1755       } else if (this._urlreg.test(value)) {                   //fill属性の値がurl(#id)ならば
1756         paintType = /*SVGPaint.SVG_PAINTTYPE_URI*/ 107;
1757         uri = RegExp.$1;
1758       } else if (value === "currentColor") {
1759         paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
1760       }
1761       ti.setPaint(paintType, uri, color, null);
1762       paintType = v1 = uri = color = void 0;
1763     } else if (this._isStop[propertyName]) {
1764       if (tg) {  //見つかった場合
1765         ti = tg;
1766       } else {
1767         ti = new SVGColor();
1768       }
1769       if (value === "currentColor") {
1770         ti.colorType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
1771       } else {
1772         ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
1773       }
1774       ti.setRGBColor(value);
1775     } else {
1776       if (tg) {  //見つかった場合
1777         ti = tg;
1778       } else {
1779         ti = new CSSPrimitiveValue();
1780       }
1781     }
1782     ti._priority = priority;
1783     ti.cssText = cssText;
1784     if (!tg) {
1785       //_numプロパティはremovePropertyメソッドで利用する
1786       ti._num = this._list.length;
1787       this._list[ti._num] = ti;
1788       this[propertyName] = 1;
1789       ++this.length;
1790     }
1791     if (value === "inherit") {
1792       ti.cssValueType = CSSValue.CSS_INHERIT;
1793     } else if (propertyName === "opacity") {
1794       this._list._opacity = +value;
1795     } else if (propertyName === "font-size") {
1796       if (/(%|em|ex)/.test(value)) {
1797         tg = "_" +RegExP.$1
1798         ti[tg] = parseFloat(value);
1799       } else {
1800         this._em = this._ex = this["_%"] = null;
1801         this._list._fontSize = parseFloat(value);
1802       }
1803     }
1804     cssText = void 0;
1805   },
1806   /*itemメソッド
1807    *リストの位置にあるプロパティ名を取得する。宣言内のすべてのプロパティ名を取得するのに便利
1808    */
1809 /*string*/   item : function( /*long*/ index) {
1810     if (index >= this.length) { //indexの位置にCSSValueが指定されていないとき
1811       var s = "";
1812     } else {
1813       var s = this._list[index].cssText.substring(0, this._list[index].cssText.indexOf(":"));
1814     }
1815     return s;
1816   }
1817 };
1818
1819 function CSSValue() {
1820   return this;
1821 };
1822     // UnitTypes
1823 CSSValue.CSS_INHERIT                    = 0;
1824 CSSValue.CSS_PRIMITIVE_VALUE            = 1;
1825 CSSValue.CSS_VALUE_LIST                 = 2;
1826 CSSValue.CSS_CUSTOM                     = 3;
1827 CSSValue.prototype = {
1828   cssText : "",
1829   cssValueType : CSSValue.CSS_CUSTOM,
1830   _isDefault : 0 //デフォルトであるかどうか(独自のプロパティ)
1831 };
1832
1833 function CSSPrimitiveValue() {
1834   return this;
1835 };
1836
1837 (function(t) {
1838 t.CSS_UNKNOWN                    = 0;
1839 t.CSS_NUMBER                     = 1;
1840 t.CSS_PERCENTAGE                 = 2;
1841 t.CSS_EMS                        = 3;
1842 t.CSS_EXS                        = 4;
1843 t.CSS_PX                         = 5;
1844 t.CSS_CM                         = 6;
1845 t.CSS_MM                         = 7;
1846 t.CSS_IN                         = 8;
1847 t.CSS_PT                         = 9;
1848 t.CSS_PC                         = 10;
1849 t.CSS_DEG                        = 11;
1850 t.CSS_RAD                        = 12;
1851 t.CSS_GRAD                       = 13;
1852 t.CSS_MS                         = 14;
1853 t.CSS_S                          = 15;
1854 t.CSS_HZ                         = 16;
1855 t.CSS_KHZ                        = 17;
1856 t.CSS_DIMENSION                  = 18;
1857 t.CSS_STRING                     = 19;
1858 t.CSS_URI                        = 20;
1859 t.CSS_IDENT                      = 21;
1860 t.CSS_ATTR                       = 22;
1861 t.CSS_COUNTER                    = 23;
1862 t.CSS_RECT                       = 24;
1863 t.CSS_RGBCOLOR                   = 25;
1864 t.prototype = new CSSValue();
1865 })(CSSPrimitiveValue);
1866
1867 (function(){
1868   this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一)
1869   this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE;
1870   this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN;
1871   this._value = null;
1872   this._percent = 0; //単位に%が使われていた場合、このプロパティの数値を1%として使う
1873   this._empercent = 0;
1874   this._em = this._ex = this["_%"] = null; //emが単位の場合、getComputedStyleメソッドなどで使う
1875   /*void*/ this.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) {
1876     if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合
1877       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1878     }
1879     this.primitiveType = unitType;
1880     this._value = floatValue * this._n[unitType-1];  //値はあらかじめ、利用しやすいように変換しておく
1881   };
1882   /*getFloatValueメソッド
1883    *別の単位に変換可能。
1884    */
1885   this._regd = /[\d\.]+/;
1886   /*float*/ this.getFloatValue = function(/*short*/ unitType) {
1887     if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合
1888       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1889     }
1890     if (this._value || (this._value === 0)) { //すでに、setFloatValueメソッドによって_valueプロパティが設定されていた場合
1891       return (this._value / this._n[unitType-1]);
1892     } else {
1893       var tc = this.cssText,
1894           n = tc.slice(-1),
1895           type = 0,
1896           s = +(tc.match(this._regd));
1897       s = isNaN(s) ? 0 : s;
1898       if (n >= "0" && n <= "9") {
1899         type = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
1900         if (unitType === 1) {
1901           unitType = tc = n = type = void 0;
1902           return s;
1903         }
1904       } else if (n === "%") {
1905         s *= this._percent;
1906         type = /*CSSPrimitiveValue.CSS_PERCENTAGE*/ 2;
1907       } else if ((n === "m") && (tc.charAt(tc.length-2) === "e")) {
1908         s *= this._empercent;
1909         type = /*CSSPrimitiveValue.CSS_EMS*/ 3;
1910       } else if ((n === "x") && (tc.charAt(tc.length-2) === "e")) {
1911         type = /*CSSPrimitiveValue.CSS_EXS*/ 4;
1912       } else if ((n === "x") && (tc.charAt(tc.length-2) === "p")) {
1913         type = /*CSSPrimitiveValue.CSS_PX*/ 5;
1914       } else if ((n === "m") && (tc.charAt(tc.length-2) === "c")) {
1915         type = /*CSSPrimitiveValue.CSS_CM*/ 6;
1916       } else if ((n === "m") && (tc.charAt(tc.length-2) === "m")) {
1917         type = /*CSSPrimitiveValue.CSS_MM*/ 7;
1918       } else if (n === "n") {
1919         type = /*CSSPrimitiveValue.CSS_IN*/ 8;
1920       } else if (n === "t") {
1921         type = /*CSSPrimitiveValue.CSS_PT*/ 9;
1922       } else if (n === "c") {
1923         type = /*CSSPrimitiveValue.CSS_PC*/ 10;
1924       }
1925       s = s * this._n[type-1] / this._n[unitType-1];
1926       tc = n = type = unitType = void 0;
1927       return s;
1928     }
1929   };
1930   /*void*/ this.setStringValue = function(/*short*/ stringType, /*string*/ stringValue) {
1931     if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合
1932       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1933     }
1934     this._value = stringValue;
1935   };
1936   /*string*/ this.getStringValue = function(/*short*/ stringType) {
1937     if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合
1938       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1939     }
1940     return (this._value);
1941   };
1942   /*Counter*/ this.getCounterValue = function() {
1943     if (this.primitiveType !== CSSPrimitiveValue.CSS_COUNTER) { //Counter型ではないとき
1944       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1945     }
1946     return (new Counter());
1947   };
1948   /*Rect*/ this.getRectValue = function() {
1949     if (this.primitiveType !== CSSPrimitiveValue.CSS_RECT) { //Rect型ではないとき
1950       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1951     }
1952     return (new Rect());
1953   };
1954   /*RGBColor*/ this.getRGBColorValue = function() {
1955     if (this.primitiveType !== CSSPrimitiveValue.CSS_RGBCOLOR) { //RGBColor型ではないとき
1956       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
1957     }
1958     var s = new RGBColor();
1959     var rgbColor = this.cssText;
1960     var tkr = SVGColor.prototype._keywords[rgbColor];
1961     if (tkr !== void 0) {
1962       rgbColor = tkr;
1963     }
1964     if (rgbColor.indexOf("%", 5) > 0) {      // %を含むrgb形式の場合
1965       rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) {
1966         return Math.round((2.55 * parseFloat(t)));
1967       });
1968     } else if (rgbColor.indexOf("#") > -1) {  //#を含む場合
1969       rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) {
1970         return parseInt(s, 16);
1971       });
1972     }
1973     var n = rgbColor.match(/\d+/g);
1974     s.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[0]));
1975     s.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[1]));
1976     s.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[2]));
1977     n = rgbColor = void 0;
1978     return (s);
1979   };
1980 }).apply(CSSPrimitiveValue.prototype);
1981 /*CSSValueList
1982  *Arrayで代用する
1983  */
1984 function CSSValueList() {
1985   this.cssValueType = CSSValue.CSS_VALUE_LIST;
1986   this.length = 0;
1987   return this;
1988 };
1989 CSSValueList.prototype = new CSSValue();
1990 /*CSSValue*/ CSSValueList.prototype.item = function( /*long*/ index) {
1991   return (this[index]);
1992 };
1993
1994 function RGBColor() {
1995   var cs = CSSPrimitiveValue;
1996   this.red = new cs();
1997   this.green = new cs();
1998   this.blue = new cs();
1999   cs = void 0;
2000   this.red.primitiveType = this.green.primitiveType = this.blue.primitiveType = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
2001   return this;
2002 };
2003
2004 function Rect() {
2005   var cs = CSSPrimitiveValue;
2006   this.top = new cs();
2007   this.right = new cs();
2008   this.bottom = new cs();
2009   this.left = new cs();
2010   cs = void 0; 
2011   return this;
2012 };
2013
2014 function Counter() {
2015   this.identifier = this.listStyle = this.separator = "";
2016   return this;
2017 };
2018
2019 function ElementCSSInlineStyle() {
2020   var cs = CSSStyleDeclaration;
2021   this.style = new cs();
2022   this._attributeStyle = new cs(); //プレゼンテーション属性の値を格納する
2023   cs = void 0;
2024   return this;
2025 };
2026
2027 /*CSS2Properties
2028  *削除不可
2029  *さらにSVG CSSを付け加えている
2030  */
2031 var n = "none",
2032     m = "normal",
2033     a = "auto",
2034     CSS2Properties = {
2035   fill : "black",
2036   stroke : n,
2037   cursor : a,
2038   visibility : "visible",
2039   display : "inline-block",
2040   opacity : "1",
2041   fillOpacity : "1",
2042   strokeWidth : "1",
2043   strokeDasharray : n,
2044   strokeDashoffset : "0",
2045   strokeLinecap : "butt",
2046   strokeLinejoin : "miter",
2047   strokeMiterlimit : "4",
2048   strokeOpacity : "1",
2049   writingMode : "lr-tb",
2050   fontFamily : "serif",
2051   fontSize : "12",
2052   color : "black",
2053   fontSizeAdjust : n,
2054   fontStretch : m,
2055   fontStyle : m,
2056   fontVariant : m,
2057   fontWeight : m,
2058   font : "inline",
2059
2060 //# Gradient properties:
2061
2062   stopColor : "black",
2063   stopOpacity : "1",
2064   textAnchor : "start",
2065   azimuth : "center",
2066                                         // raises(dom::DOMException) on setting
2067   //簡略プロパティに関しては、初期値を再考せよ
2068   clip : a,
2069   direction : "ltr",
2070   letterSpacing : m,
2071   lineHeight : m,
2072   overflow : "visible",
2073   textAlign : "left",
2074   textDecoration : n,
2075   textIndent : "0",
2076   textShadow : n,
2077   textTransform : n,
2078   unicodeBidi : m,
2079   verticalAlign : "baseline",
2080   whiteSpace : m,
2081   wordSpacing : m,
2082   zIndex : a,
2083 //  #
2084
2085   mask : n,
2086
2087 //# Filter Effects properties:
2088
2089   enableBackground : "accumulate",
2090   filter : n,
2091   floodColor : "black",
2092   floodOpacity : "1",
2093   lightingColor : "white",
2094
2095 //# Interactivity properties:
2096
2097   pointerEvents : "visiblePainted",
2098
2099 //# Color and Painting properties:
2100
2101   colorInterpolation : "sRGB",
2102   colorInterpolationFilters : "linearRGB",
2103   colorProfile : a,
2104   colorRendering : a,
2105   imageRendering : a,
2106   marker : "",
2107   markerEnd : n,
2108   markerMid : n,
2109   markerStart : n,
2110   shapeRendering : a,
2111   textRendering : a,
2112
2113 //# Text properties:
2114
2115   alignmentBaseline : "",
2116   baselineShift : "baseline",
2117   dominantBaseline : a,
2118   glyphOrientationHorizontal : "0deg",
2119   glyphOrientationVertical : a,
2120   kerning : a,
2121   fillRule : "nonzero"
2122 };
2123 n = m = a = void 0;
2124 CSS2Properties.visibility._n = 1; //初期値の設定(_setPaintで使う)
2125
2126 function CSSStyleSheet() {
2127 /*CSSRule*/      this.ownerRule = null;
2128 /*CSSRuleList*/  this.cssRules = [];
2129   return this;
2130 };
2131 CSSStyleSheet.prototype = new StyleSheet();
2132 /*long*/  CSSStyleSheet.prototype.insertRule = function( /*string*/ rule, /*long*/ index) {
2133   var s = new CSSStyleRule(), style = s.style, a, sc = rule.match(/\{[\s\S]+\}/), m;
2134   s.parentStyleSheet = this;
2135   style.cssText = rule;
2136   //style値の解析;
2137   sc = sc.replace(/^[^a-z\-]+/, "")
2138          .replace(/\:\s+/g, ":")
2139          .replace(/\s*;[^a-z\-]*/g, ";");
2140   a = sc.split(";");
2141   for (var i=0, ali=a.length;i<ali;++i) {
2142       ai = a[i],
2143       m = ai.split(":");
2144       if (ai !== "") {
2145         style.setProperty(m[0], m[1]);
2146       }
2147       ai = m = void 0;
2148     }
2149   a = sc = style = void 0;
2150   this.cssRules.splice(index,s,1);
2151 };
2152 /*void*/  CSSStyleSheet.prototype.deleteRule = function(/*long*/ index) {
2153   this.cssRules.splice(index, 1);
2154 };
2155
2156
2157 /*getComputedStyle関数
2158  *最近の計算値を取得する。Document.defaultViewはSafariがグローバル(window)にサポートしていないため付ける。
2159  */
2160 /*interface ViewCSS : views::AbstractView {*/
2161 Document.prototype.defaultView = new ViewCSS();
2162 function ViewCSS(){
2163   return this;
2164 };
2165 /*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
2166   var s = new CSSStyleDeclaration(),
2167       el, es,
2168       eso = 1;
2169   //クロージャを利用して、カスケーディングを実現する
2170   s.getPropertyCSSValue = (function(elt, td, s){
2171     return function( /*string*/ propertyName) {
2172       var el = elt,
2173           css = null,
2174           n;
2175       while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) {
2176         if (el._runtimeStyle && el._runtimeStyle[propertyName]) {
2177           css = el._runtimeStyle.getPropertyCSSValue(propertyName);
2178         } else if (el.style && el.style[propertyName]) {
2179           css = el.style.getPropertyCSSValue(propertyName);
2180         } else if (el._attributeStyle && el._attributeStyle[propertyName]) {
2181           //プレゼンテーション属性を探す
2182           css = el._attributeStyle.getPropertyCSSValue(propertyName);
2183         } else if (el._rules) {
2184           //スタイルシートのルールを探す
2185           for (var i=0,eli=el._rules.length;i<eli;++i) {
2186             el._rules[i].style[propertyName] && (css = el._rules[i].style.getPropertyCSSValue(propertyName));
2187           }
2188         }
2189         el = el.parentNode;
2190       }
2191       if (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0)) {
2192         //デフォルト値を探す
2193         td && (css = td[propertyName]);
2194       }
2195       if (css && css.setRGBColor && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
2196         css.setRGBColor(s.getPropertyValue("color"));
2197       } else if (css && (css._em || css._ex || css["_%"])) {
2198         el = elt;
2199         n = 1;
2200         while (el) {
2201           if (el.style._list._fontSize) {
2202             n = el.style._list._fontSize;
2203             break;
2204           }
2205           el = el.parentNode;
2206         }
2207         if (css._em) {
2208           n *= css._em;
2209         } else if (css._ex) {
2210           n *= css._ex * 0.5;
2211         } else if (css["_%"]) {
2212           n *= css["_%"] / 100; 
2213         }
2214         css.cssText = "font-size:" +n+ "px";
2215       }
2216       el = void 0;
2217       return css;
2218     };
2219    })(elt, this._defaultCSS, s); //_defaultCSSはデフォルト値の設定
2220   el = elt;
2221   while (el) {
2222     if (el.style) {
2223       es = el.style._list._opacity || el._attributeStyle._list._opacity;
2224       eso *= es || 1;
2225     }
2226     el = el.parentNode;
2227   }
2228   s._list._opacity = eso;
2229   el = pelt = eso = es = void 0;
2230   s._document = elt.ownerDocument;
2231   return s;
2232 };
2233
2234 /*getOverrideStyleメソッド
2235  *指定した要素の上書きスタイルシートを取得。
2236  */
2237 /*function DocumentCSS : stylesheets::DocumentStyle {*/
2238 /*CSSStyleDeclaration*/ Document.prototype.getOverrideStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
2239   var tar = elt;
2240   if (!!tar._runtimeStyle) {
2241     return (tar._runtimeStyle);
2242   } else {
2243     var s = new CSSStyleDeclaration(), setProp = s.setProperty;
2244     tar._runtimeStyle = s;
2245   }
2246   s.setProperty = (function(setProp, s){
2247     return function(propertyName, value, priority) {
2248       setProp.call(s, propertyName, value, priority);
2249       var tar = elt, el = tar._tar, isFill = isStroke = false;
2250       if ((tar.localName === "g") || (tar.localName === "a")) {
2251         var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
2252         if (sl) {
2253           for (var i=0,sli=sl.length;i<sli;++i) {
2254             var di = sl[i];
2255             NAIBU._setPaint(di, di.getScreenCTM());
2256             di = void 0;
2257           }
2258           sl = void 0;
2259         }
2260         el = null;
2261       }
2262       if (!el) {
2263         return;
2264       }
2265       NAIBU._setPaint(tar, tar.getScreenCTM());
2266       el = tar = value = void 0;
2267     };
2268   })(setProp, s);
2269   return s;
2270 };
2271 /*createCSSStyleSheetメソッド
2272  *文書のスタイルシートを作成
2273  */
2274 /*interface DOMImplementationCSS : DOMImplementation {*/
2275 /*CSSStyleSheet*/ DOMImplementation.createCSSStyleSheet = function( /*string*/ title, /*string*/ media) {
2276   var s = new CSSStyleSheet();
2277   s.title = title;
2278   var nm = new MediaList();
2279   nm.mediaText = media;
2280   if (media && (media !== "")) {
2281     var mes = media.split(",");  //文字列をコンマで区切って配列に
2282     for (var i=0,mli=mes.length;i<mli;++i) {
2283       nm.appendMedium(mes[i]);   //メディアリストに値を加えていく
2284     }
2285   }
2286   s.media = nm;
2287   return s;
2288 };
2289 /*
2290 #endif // _CSS_IDL_
2291 */
2292 // File: smil.idl
2293 /*
2294 #ifndef _SMIL_IDL_
2295 #define _SMIL_IDL_
2296
2297 #include "dom.idl"
2298
2299 #pragma prefix "dom.w3c.org"
2300 module smil
2301 {
2302   typedef dom::DOMString DOMString;
2303 */
2304 /*ElementTimeControlはSVGAnimationElementに統合させる。
2305  *というのは、多重継承が難しいため
2306  */
2307 function ElementTimeControl(ele) {
2308   this._tar = ele;
2309   /*_startと_endプロパティはミリ秒数を収納する。
2310    *_startはアニメ開始時の秒数のリスト。_finishはアニメ終了時の秒数のリスト。
2311    *なお、文書読み込み終了時(アニメ開始時刻)の秒数を0とする。
2312    */
2313   this._start = [];
2314   this._finish = null;
2315   return this;
2316 };
2317 ElementTimeControl.prototype = {
2318   /*void*/  beginElement : function() {
2319     var ttd = this.ownerDocument, evt = ttd.createEvent("TimeEvents");
2320     evt.initTimeEvent("beginEvent", ttd.defaultView, 0);
2321     this.dispatchEvent(evt);
2322   },
2323   /*void*/  endElement : function() {
2324     var ttd = this.ownerDocument, evt = ttd.createEvent("TimeEvents");
2325     evt.initTimeEvent("endEvent", ttd.defaultView, 0);
2326     this.dispatchEvent(evt);
2327   },
2328   /*void*/  beginElementAt : function(/*float*/ offset) {
2329     var ntc = this.ownerDocument.documentElement.getCurrentTime(),
2330         start = this._start || [];
2331     for (var i=0,sli=start.length;i<sli;++i) {
2332       if (start[i] === (offset+ntc)) {
2333         ntc = start = offset = void 0;
2334         return;
2335       }
2336     }
2337     start.push(offset + ntc);
2338     this._start = start;
2339   },
2340   /*void*/  endElementAt : function(/*float*/ offset) {
2341     var ntc = this.ownerDocument.documentElement.getCurrentTime(),
2342         fin = this._finish || [];
2343     for (var i=0,fli=fin.length;i<fli;++i) {
2344       if (fin[i] === (offset+ntc)) {
2345         ntc = fin = offset = void 0;
2346         return;
2347       }
2348     }
2349     fin.push(offset + ntc);
2350     this._finish = fin;
2351   }
2352 };
2353
2354 function TimeEvent() {
2355   Event.apply(this);
2356   /*readonly attribute views::AbstractView*/  this.view;
2357   /*readonly attribute long*/             this.detail;
2358   return this;
2359 };
2360 TimeEvent.counstructor = Event;
2361 TimeEvent.prototype = new Event();
2362 /*void*/  TimeEvent.prototype.initTimeEvent = function(/*DOMString*/ typeArg, 
2363                                      /*views::AbstractView*/ viewArg, 
2364                                      /*long*/ detailArg) {
2365   this.type = typeArg;
2366   this.view = viewArg;
2367   this.detail = detailArg;
2368 };
2369 //#endif // _SMIL_IDL_
2370
2371
2372 //これを頭に付けたら、内部処理用
2373 var  NAIBU = {};
2374
2375 /*
2376 // File: svg.idl
2377 #ifndef _SVG_IDL_
2378 #define _SVG_IDL_
2379 // For access to DOM2 core
2380 #include "dom.idl"
2381 // For access to DOM2 events
2382 #include "events.idl"
2383 // For access to those parts from DOM2 CSS OM used by SVG DOM.
2384 #include "css.idl"
2385 // For access to those parts from DOM2 Views OM used by SVG DOM.
2386 #include "views.idl"
2387 // For access to the SMIL OM used by SVG DOM.
2388 #include "smil.idl"
2389 #pragma prefix "dom.w3c.org"
2390 #pragma javaPackage "org.w3c.dom"
2391 module svg
2392 {
2393   typedef dom::DOMString DOMString;
2394   typedef dom::DOMException DOMException;
2395   typedef dom::Element Element;
2396   typedef dom::Document Document;
2397   typedef dom::NodeList NodeList;
2398   // Predeclarations
2399   interface SVGElement;
2400   interface SVGLangSpace;
2401   interface SVGExternalResourcesRequired;
2402   interface SVGTests;
2403   interface SVGFitToViewBox;
2404   interface SVGZoomAndPan;
2405   interface SVGViewSpec;
2406   interface SVGURIReference;
2407   interface SVGPoint;
2408   interface SVGMatrix;
2409   interface SVGPreserveAspectRatio;
2410   interface SVGAnimatedPreserveAspectRatio;
2411   interface SVGTransformList;
2412   interface SVGAnimatedTransformList;
2413   interface SVGTransform;
2414   interface SVGICCColor;
2415   interface SVGColor;
2416   interface SVGPaint;
2417   interface SVGTransformable;
2418   interface SVGDocument;
2419   interface SVGSVGElement;
2420   interface SVGElementInstance;
2421   interface SVGElementInstanceList;
2422 */
2423 function SVGException(code) {
2424   /*unsigned short*/  this.code = code;
2425   if (this.code === SVGException.SVG_WRONG_TYPE_ERR) {
2426     this.message = "SVG Wrong Type Error";
2427   } else if (this.code === SVGException.SVG_INVALID_VALUE_ERR) {
2428     this.message = "SVG Invalid Value Error";
2429   } else if (this.code === SVGException.SVG_MATRIX_NOT_INVERTABLE) {
2430     this.message = "SVG Matrix Not Invertable";
2431   }
2432   return this;
2433 };
2434 SVGException.prototype = new Error();
2435 // SVGExceptionCode
2436 /*const unsigned short*/ SVGException.SVG_WRONG_TYPE_ERR           = 0;
2437 /*const unsigned short*/ SVGException.SVG_INVALID_VALUE_ERR        = 1;
2438 /*const unsigned short*/ SVGException.SVG_MATRIX_NOT_INVERTABLE    = 2;
2439
2440 /*SVGElement
2441  *すべてのSVG関連要素の雛形となるオブジェクト
2442  */
2443 function SVGElement() {
2444   Element.call(this);
2445   SVGStylable.call(this);             //ElementCSSInlineStyleのインタフェースを継承
2446   /*interface SVGTransformable : SVGLocatable
2447    *TransformListはtransform属性を行列で表現したあとのリスト構造
2448    */
2449   /*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList();
2450   //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする
2451   this.addEventListener("DOMAttrModified", function(evt){
2452     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
2453       return;
2454     }
2455     var name = evt.attrName,
2456         tar = evt.target;
2457     if (!!CSS2Properties[name] || (name.indexOf("-") > -1)) { //スタイルシートのプロパティならば
2458       tar._attributeStyle.setProperty(name, evt.newValue, "");
2459     }
2460     if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば
2461       tar.id = evt.newValue;
2462     } else if ((name === "transform") && !!tar.transform) {
2463       var tft = evt.newValue,
2464           degR = tar._degReg,
2465           coma = tft.match(tar._comaReg),   //コマンド文字にマッチ translate
2466           list = tft.match(tar._strReg),    //カッコ内のリストにマッチ (10 20 30...)
2467           a,b,c,d,e,f,
2468           lis,
2469           com,
2470           deg,
2471           rad,
2472           degli,
2473           s,
2474           cm,
2475           degz,
2476           etod = evt.target.ownerDocument.documentElement,
2477           ttb = tar.transform.baseVal;
2478       //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける
2479       for (var j=0,cli=coma.length;j<cli;j++) {
2480         s = etod.createSVGTransform();
2481         lis = list[j],
2482         com = coma[j];
2483         deg = lis.match(degR);
2484         degli = deg.length;
2485         if (degli === 6) {
2486           cm = s.matrix;
2487           cm.a = +(deg[0]);
2488           cm.b = +(deg[1]);
2489           cm.c = +(deg[2]);
2490           cm.d = +(deg[3]);
2491           cm.e = +(deg[4]);
2492           cm.f = +(deg[5]);
2493         } else {
2494           if (degli === 3) {
2495             degz = +(deg[0]);
2496             s.setRotate(degz, +(deg[1]), +(deg[2]))
2497           } else if (degli <= 2) {
2498             degz = +(deg[0]);
2499             if (com === "translate") {
2500               s.setTranslate(degz, +(deg[1] || 0));
2501             } else if (com === "scale") {
2502               s.setScale(degz, +(deg[1] || deg[0]));
2503             } else if (com === "rotate") {
2504               s.setRotate(degz, 0, 0);
2505             } else if (com === "skewX") {
2506               s.setSkewX(degz);
2507             } else if (com === "skewY") {
2508               s.setSkewY(degz);
2509             }
2510           }
2511         }
2512         ttb.appendItem(s);
2513       }
2514       tft = degR = coma = list = a = b = c = d = e = f = lis = com = deg = rad = degli = s = cm = degz = etod = ttb = void 0;
2515     } else if (name === "style") {
2516       var sc = evt.newValue,
2517           style = tar.style,
2518           a,
2519           ai,
2520           m;
2521       style.cssText = sc;
2522       if (sc !== "") {
2523         //style属性値の解析
2524         sc = sc.replace(tar._shouReg, "")
2525                .replace(tar._conReg, ":")
2526                .replace(tar._bouReg, ";");
2527         a = sc.split(";");
2528         for (var i=0, ali=a.length;i<ali;++i) {
2529           ai = a[i],
2530           m = ai.split(":");
2531           if (ai !== "") {
2532             style.setProperty(m[0], m[1]);
2533           }
2534           ai = m = void 0;
2535         }
2536       }
2537       a = sc = style = void 0;
2538     } else if (name === "class") {
2539       tar.className = evt.newValue;
2540     } else if (name.indexOf("on") === 0) {           //event属性ならば
2541       /*ECMA 262-3においては、eval("(function(){})")はFunctionオブジェクトを返さなければならない
2542        *ところが、IEでは、undefinedの値を返してしまう。
2543        *他のブラウザではECMAの仕様にしたがっているようなので、IEだけの問題であることに注意
2544        */
2545       eval("document._s = (function(evt){" +evt.newValue+ "})");
2546       var v = name.slice(2);
2547       if (v === "load") {
2548         v = "SVGLoad";
2549       } else if (v === "unload") {
2550         v = "SVGUnload";
2551       } else if (v === "abort") {
2552         v = "SVGAbort";
2553       } else if (v === "error") {
2554         v = "SVGError";
2555       } else if (v === "resize") {
2556         v = "SVGResize";
2557       } else if (v === "scroll") {
2558         v = "SVGScroll";
2559       } else if (v === "zoom") {
2560         v = "SVGZoom";
2561       } else if (v === "begin") {
2562         v = "beginEvent";
2563       } else if (v === "end") {
2564         v = "endEvent";
2565       } else if (v === "repeat") {
2566         v = "repeatEvent";
2567       }
2568       tar.addEventListener(v, document._s, false);
2569     } else if (evt.relatedNode.nodeName === "xml:base") { //xml:base属性ならば
2570       tar.xmlbase = evt.newValue;
2571     } else if (!!tar[name] && (tar[name] instanceof SVGAnimatedLength)) {
2572       var tea = tar[name],
2573           tod = tar.nearestViewportElement || tar.ownerDocument.documentElement,
2574           tvw = tod.viewport.width,
2575           tvh = tod.viewport.height,
2576           s,
2577           n = evt.newValue.slice(-2),
2578           m = n.charAt(1),
2579           type = /*SVGLength.SVG_LENGTHTYPE_NUMBER*/ 1,
2580           _parseFloat = parseFloat;
2581       if (m >= "0" && m <= "9") { //軽量化のためにチェックを設ける
2582       } else if (m === "%") {
2583         if (tar._x1width[name]) {
2584           tea.baseVal._percent = tvw * 0.01;
2585         } else if (tar._y1height[name]) {
2586           tea.baseVal._percent = tvh * 0.01;
2587         } else {
2588           tea.baseVal._percent = Math.sqrt((tvw*tvw + tvh*tvh) / 2) * 0.01;
2589         }
2590         type = /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2;
2591       } else if (n === "em") {
2592         type = /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3;
2593       } else if (n === "ex") {
2594         type = /*SVGLength.SVG_LENGTHTYPE_EXS*/ 4;
2595       } else if (n === "px") {
2596         type = /*SVGLength.SVG_LENGTHTYPE_PX*/ 5;
2597       } else if (n === "cm") {
2598         type = /*SVGLength.SVG_LENGTHTYPE_CM*/ 6;
2599       } else if (n === "mm") {
2600         type = /*SVGLength.SVG_LENGTHTYPE_MM*/ 7;
2601       } else if (n === "in") {
2602         type = /*SVGLength.SVG_LENGTHTYPE_IN*/ 8;
2603       } else if (n === "pt") {
2604         type = /*SVGLength.SVG_LENGTHTYPE_PT*/ 9;
2605       } else if (n === "pc") {
2606         type = /*SVGLength.SVG_LENGTHTYPE_PC*/ 10;
2607       }
2608       s = _parseFloat(evt.newValue);
2609       s = isNaN(s) ? 0 : s;
2610       tea.baseVal.newValueSpecifiedUnits(type, s);
2611       tea = tod = tvw = tvh = n = type = _parseFloat = s = void 0;
2612     }
2613     evt = _parseFloat = name = tar = null;
2614   }, false);
2615   return this;
2616 };
2617 SVGElement.prototype = new Element();
2618
2619 (function(){
2620   /*以下の正規表現は属性のパーサの際に用いる*/
2621   this._degReg = /[\-\d\.e]+/g;
2622   this._comaReg = /[A-Za-z]+(?=\s*\()/g;
2623   this._strReg =  /\([^\)]+\)/g;
2624   this._syouReg = /^[^a-z\-]+/;
2625   this._conReg = /\:\s+/g;
2626   this._bouReg = /\s*;[^a-z\-]*/g;
2627   /*_cacheMatrixプロパティはSVGMatrixのキャッシュとして、
2628    *getCTMメソッドで使う
2629    */
2630   this._cacheMatrix = null;
2631   /*以下のオブジェクトは単位がパーセント付きの属性の名前を示し、処理に使う*/
2632   this._x1width = {
2633       "x" : 1,
2634       "x1" : 1,
2635       "x2" : 1,
2636       "width" : 1,
2637       "cx" : 1
2638   };
2639   this._y1height = {
2640       "y" : 1,
2641       "y1" : 1,
2642       "y2" : 1,
2643       "height" : 1,
2644       "cy" : 1      
2645   };
2646   /*String*/              this.id      = null;        //id属性の値
2647   /*String*/              this.xmlbase = null;   //xml:base属性の値
2648   /*SVGSVGElement*/       this.ownerSVGElement;  //ルート要素であるsvg要素
2649   /*readonly SVGElement*/ this.viewportElement;  //ビューポートを形成する要素(多くはsvg要素)
2650   /*readonly attribute SVGElement*/ this.nearestViewportElement  = null;
2651   /*readonly attribute SVGElement*/ this.farthestViewportElement = null;
2652   
2653   /*interface SVGLocatable*/
2654   /*SVGRect*/     this.getBBox = function(){
2655     var s = new SVGRect(),
2656         data = this._tar.path.value,
2657         vi = this.ownerDocument.documentElement.viewport,
2658         el = vi.width,
2659         et = vi.height,
2660         er = 0,
2661         eb = 0,
2662         degis = data.match(/[0-9\-]+/g),
2663         nx,
2664         ny;
2665     /*要素の境界領域を求める(四隅の座標を求める)
2666      *etは境界領域の上からビューポート(例えばsvg要素)の上端までの距離であり、ebは境界領域の下からビューポートの下端までの距離
2667      *elは境界領域の左からビューポートの左端までの距離であり、erは境界領域の右からビューポートの右端までの距離
2668      */
2669     for (var i=0,degisli=degis.length;i<degisli;i+=2) {
2670       nx = +(degis[i]),
2671       ny = +(degis[i+1]);
2672       el = el > nx ? nx : el;
2673       et = et > ny ? ny : et;
2674       er = er > nx ? er : nx;
2675       eb = eb > ny ? eb : ny;
2676     }
2677     s.x      = el;
2678     s.y      = et;
2679     s.width  = er - el;
2680     s.height = eb - et;
2681     nx = ny = data = degis =el = et = er = eb = vi = void 0;
2682     return s;
2683   };
2684
2685   /*getCTMメソッド
2686    *CTMとは現在の利用座標系に対する変換行列
2687    *注意点として、SVG1.1とSVG Tiny1.2では内容が異なる。たとえば、
2688    *1.2ではgetCTMが言及されていない
2689    *もし、要素の中心座標を取得したい人がいれば、transformプロパティのconsolidateメソッドを使うこと
2690    */
2691   /*SVGMatrix*/   this.getCTM = function() {
2692     var s, m;
2693     if (!!this._cacheMatrix) { //キャッシュがあれば
2694       s = this._cacheMatrix;
2695     } else {
2696       m = this.transform.baseVal.consolidate();
2697       if (m) {
2698         m = m.matrix;
2699       } else {
2700         m = this.ownerDocument.documentElement.createSVGMatrix();
2701       }
2702       if (this.parentNode && !!this.parentNode.getCTM) {
2703         s = this.parentNode.getCTM().multiply(m);
2704       } else {
2705         s = m;
2706       }
2707       m = void 0;
2708       this._cacheMatrix = s; //キャッシュをためて次回で使う
2709     }
2710     return s;
2711   };
2712
2713   /*SVGMatrix*/   this.getScreenCTM = function(){
2714     if (!this.parentNode) {
2715       return null;
2716     }
2717     var view = this.nearestViewportElement || this.ownerDocument.documentElement;
2718     var s = view.getScreenCTM().multiply(this.getCTM());
2719     view = null;
2720     return s;
2721   };
2722
2723   /*getTransformToElementメソッド
2724    *これは、あるelementへの変換行列を計算して返す
2725    *たとえばある要素から別の要素への引越しをする際の変換行列を算出することが可能
2726    */
2727   /*SVGMatrix*/   this.getTransformToElement = function(/*SVGElement*/ element ){
2728     var s = this.getScreenCTM().inverse().multiply(element.getScreenCTM());
2729     return s;
2730   };
2731 }).apply(SVGElement.prototype);
2732
2733 function SVGAnimatedBoolean() {
2734   /*boolean*/  this.animVal = this.baseVal = true;
2735   return this;
2736 };
2737
2738 function SVGAnimatedString() {
2739   /*String*/ this.animVal = this.baseVal = "";
2740   return this;
2741 };
2742
2743 function SVGStringList() {
2744   return this;
2745 };
2746 SVGStringList.prototype = new Array();
2747 (function(){
2748   /*readonly unsigned long*/ this.numberOfItems = 0;
2749   /*void*/   this.clear = function(){
2750     for (var i=0, tli=this.length;i<tli;++i) {
2751       delete this[i];
2752     }
2753     this.numberOfItems = 0;
2754   };
2755   /*DOMString*/ this.initialize = function(/*DOMString*/ newItem ) {
2756     this.clear();
2757     this[0] = newItem;
2758     this.numberOfItems = 1;
2759     return newItem;
2760   };
2761   /*DOMString*/ this.getItem = function(/*unsigned long*/ index ) {
2762     if (index >= this.numberOfItems || index < 0) {
2763       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
2764     } else {
2765       return (this[index]);
2766     }
2767   };
2768   /*DOMString*/ this.insertItemBefore = function(/*DOMString*/ newItem, /*unsigned long*/ index ){
2769     if (index >= this.numberOfItems) {
2770       this.appendItem(newItem);
2771     } else {
2772       this.splice(index, 1, newItem, this.getItem[index]);
2773       ++this.numberOfItems;
2774     }
2775     return newItem;
2776   };
2777   /*DOMString*/ this.replaceItem = function(/*DOMString*/ newItem, /*unsigned long*/ index ){
2778     if (index >= this.numberOfItems || index < 0) {
2779       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
2780     } else {
2781       this.splice(index, 1, newItem);
2782     }
2783     return newItem;
2784   };
2785                   //raises( DOMException, SVGException );
2786   /*DOMString*/ this.removeItem = function(/*unsigned long*/ index ){
2787     if (index >= this.numberOfItems || index < 0) {
2788       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
2789     } else {
2790       this.splice(index, 1);
2791       --this.numberOfItems;
2792     }
2793     return newItem;
2794   };
2795   /*DOMString*/ this.appendItem = function(/*DOMString*/ newItem ){
2796     this[this.numberOfItems] = newItem;
2797     ++this.numberOfItems;
2798   };
2799 }).apply(SVGStringList.prototype);
2800
2801 function SVGAnimatedEnumeration() {
2802   /*unsigned short*/ this.baseVal = 0;
2803                          // raises DOMException on setting
2804   /*readonly unsigned short*/ this.animVal = 0;
2805   return this;
2806 };
2807 function SVGAnimatedInteger() {
2808   /*long*/ this.baseVal = 0;
2809                          // raises DOMException on setting
2810   /*readonly long*/ this.animVal = 0;
2811   return this;
2812 };
2813 function SVGNumber() {
2814   /*float*/ this.value = 0;
2815                          // raises DOMException on setting
2816   return this;
2817 };
2818 function SVGAnimatedNumber() {
2819   /*float*/ this.baseVal = this.animVal = 0;
2820   return this;
2821 };
2822
2823 function SVGNumberList() {
2824   return this;
2825 };
2826 /*SVGUnmberListのメソッドはSVGPathSegListを参照*/
2827
2828 function SVGAnimatedNumberList() {
2829   /*readonly SVGNumberList*/ this.animVal = this.baseVal = new SVGNumberList();
2830   return this;
2831 };
2832 /*SVGLengthクラス
2833  *長さを設定する(単位pxに統一する方便として使う)
2834  *valueInSpecifiedUnitsプロパティはpxに統一する前の数値。valueプロパティはpxに統一した後の数値
2835  */
2836 function SVGLength() {
2837   return this;
2838 };
2839 (function(t) {
2840     // Length Unit Types
2841   /*const unsigned short*/ t.SVG_LENGTHTYPE_UNKNOWN    = 0;
2842   /*const unsigned short*/ t.SVG_LENGTHTYPE_NUMBER     = 1;
2843   /*const unsigned short*/ t.SVG_LENGTHTYPE_PERCENTAGE = 2;
2844   /*const unsigned short*/ t.SVG_LENGTHTYPE_EMS        = 3;
2845   /*const unsigned short*/ t.SVG_LENGTHTYPE_EXS        = 4;
2846   /*const unsigned short*/ t.SVG_LENGTHTYPE_PX         = 5;
2847   /*const unsigned short*/ t.SVG_LENGTHTYPE_CM         = 6;
2848   /*const unsigned short*/ t.SVG_LENGTHTYPE_MM         = 7;
2849   /*const unsigned short*/ t.SVG_LENGTHTYPE_IN         = 8;
2850   /*const unsigned short*/ t.SVG_LENGTHTYPE_PT         = 9;
2851   /*const unsigned short*/ t.SVG_LENGTHTYPE_PC         = 10;
2852 })(SVGLength);
2853
2854 SVGLength.prototype = {
2855   /*readonly attribute unsigned short*/ unitType : SVGLength.SVG_LENGTHTYPE_UNKNOWN,
2856   /*attribute float*/          value : 0,                  //利用単位における値
2857   /*attribute float*/          valueInSpecifiedUnits : SVGLength.SVG_LENGTHTYPE_UNKNOWN,  //unitTypeにおける値
2858   /*attribute DOMString*/      valueAsString : "0",
2859   _percent : 0.01, //単位に%が使われていた場合、このプロパティの数値を1%として使う
2860   _fontSize : 12, //単位のemとexで使われるfont-sizeの値
2861 /*newValueSpedifiedUnitsメソッド
2862  *新しくunitTypeにおける値を設定する
2863  *例:2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる
2864  */
2865   newValueSpecifiedUnits : function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) {
2866     var n = 1,
2867        _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す
2868     if (unitType === /*SVGLength.SVG_LENGTHTYPE_NUMBER*/ 1) {
2869     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_PX*/ 5) {
2870       _s = "px";
2871     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2) {
2872       n = this._percent;
2873       _s = "%"
2874     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3) {
2875       n = this._fontSize;
2876       _s = "em";
2877     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_EXS*/ 4) {
2878       n = this._fontSize * 0.5;
2879       _s = "ex";
2880     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_CM*/ 6) {
2881       n = 35.43307;
2882       _s = "cm";
2883     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_MM*/ 7) {
2884       n = 3.543307;
2885       _s = "mm";
2886     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_IN*/ 8) {
2887       n = 90;
2888       _s = "in";
2889     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_PT*/ 9) {
2890       n = 1.25;
2891       _s = "pt";
2892     } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_PC*/ 10) {
2893       n = 15;
2894       _s = "pc";
2895     } else {
2896       throw new DOMException(DOMException.NOT_SUPPORTED_ERR);
2897     }
2898     this.unitType = unitType;
2899     this.value = valueInSpecifiedUnits * n;
2900     this.valueInSpecifiedUnits = valueInSpecifiedUnits;
2901     this.valueAsString = valueInSpecifiedUnits + _s;
2902     valueInSpecifiedUnits = unitType = n = _s = void 0;
2903   },
2904 /*convertToSpecifiedUnitsメソッド
2905  *valueプロパティを書き換えずに、単位だけを変換する
2906  *例:2cmをmmに変換したい場合
2907  * x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_CM, 2);
2908  * x.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_MM);
2909  * alert(x.valueAsString); //20mm
2910  */
2911   convertToSpecifiedUnits : function (/*unsigned short*/ unitType) {
2912     if (this.value === 0) {
2913       this.newValueSpecifiedUnits(unitType, 0);
2914       return;
2915     }
2916     var v = this.value;
2917     this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits);
2918     v = v / this.value * this.valueInSpecifiedUnits;
2919     this.newValueSpecifiedUnits(unitType, v); 
2920   },
2921   /*_emToUnitメソッド
2922    *emやexが単位に使われていたときに、@fontSizeの値を手がかりに、新たな値へとvalueを変換させる
2923    *単位が%の場合は、新しいvalueへと変換させておく
2924    */
2925   _emToUnit : function (/*float*/ fontSize) {
2926     if ((this.unitType === /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3) || (this.unitType === 4)) {
2927       this._fontSize = fontSize;
2928       this.newValueSpecifiedUnits(this.unitType, this.valueInSpecifiedUnits);
2929     }
2930   }
2931 };
2932 function SVGAnimatedLength() {
2933   /*readonly SVGLength*/ this.animVal;
2934   this.baseVal = new SVGLength();
2935   this.baseVal.unitType = 1;
2936   return this;
2937 };
2938 function SVGLengthList() {
2939   return this;
2940 };
2941 /*SVGLengthListのメソッドはSVGPathSegListを参照*/
2942
2943 function SVGAnimatedLengthList() {
2944   /*readonly SVGNumberList*/ this.animVal = this.baseVal = new SVGLengthList();
2945   return this;
2946 };
2947 function SVGAngle() { 
2948   return this;
2949 };
2950 SVGAngle.prototype = {
2951   /*readonly attribute unsigned short*/ unitType : 0,
2952   /*attribute float*/     value : 0,
2953                          // raises DOMException on setting
2954   /*attribute float*/     valueInSpecifiedUnits : 0,
2955                          // raises DOMException on setting
2956   /*attribute DOMString*/ valueAsString : "0",
2957                          // raises DOMException on setting
2958   /*void*/ newValueSpecifiedUnits : function (/*in unsigned short*/ unitType, /*in float*/ valueInSpecifiedUnits ) {
2959     var n = 1,
2960         _s = ""; //nは各単位から度への変換数値。_sは単位の文字列を表す
2961     if (unitType === SVGAngle.SVG_ANGLETYPE_UNSPECIFIED) {
2962     } else if (unitType === SVGAngle.SVG_ANGLETYPE_DEG) {
2963       _s = "deg"
2964     } else if (unitType === SVGAngle.SVG_ANGLETYPE_RAD) {
2965       n =  Math.PI / 180;
2966       _s = "rad";
2967     } else if (unitType === SVGAngle.SVG_ANGLETYPE_GRAD) {
2968       n = 9 / 10;
2969       _s = "grad";
2970     } else {
2971       throw new DOMException(DOMException.NOT_SUPPORTED_ERR);
2972     }
2973     this.unitType = unitType;
2974     this.value = valueInSpecifiedUnits * n;
2975     this.valueInSpecifiedUnits = valueInSpecifiedUnits;
2976     this.valueAsString = valueInSpecifiedUnits + _s;
2977     n = _s = void 0;
2978     //raises( DOMException );
2979   },
2980   /*void*/ convertToSpecifiedUnits : function (/*in unsigned short*/ unitType ) {
2981     if (this.value === 0) {
2982       this.newValueSpecifiedUnits(unitType, 0);
2983       return;
2984     }
2985     var v = this.value;
2986     this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits);
2987     v = v / this.value * this.valueInSpecifiedUnits;
2988     this.newValueSpecifiedUnits(unitType, v); 
2989     //raises( DOMException );
2990   }
2991 };
2992 // Angle Unit Types
2993 /*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_UNKNOWN     = 0;
2994 /*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_UNSPECIFIED = 1;
2995 /*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_DEG         = 2;
2996 /*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_RAD         = 3;
2997 /*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_GRAD        = 4;
2998 function SVGAnimatedAngle() { 
2999   /*readonly attribute SVGAngle*/ this.baseVal = new SVGAngle();
3000   /*readonly attribute SVGAngle*/ this.animVal = this.baseVal;
3001   return this;
3002 };
3003 function SVGColor() {
3004   CSSValue.apply(this);
3005   /*readonly css::RGBColor*/  this.rgbColor  = new RGBColor();
3006   return this;
3007 };
3008
3009   // Color Types
3010 /*unsigned short*/ SVGColor.SVG_COLORTYPE_UNKNOWN           = 0;
3011 /*unsigned short*/ SVGColor.SVG_COLORTYPE_RGBCOLOR          = 1;
3012 /*unsigned short*/ SVGColor.SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2;
3013 /*unsigned short*/ SVGColor.SVG_COLORTYPE_CURRENTCOLOR      = 3;
3014 SVGColor.prototype = new CSSValue();  //ノードのプロトタイプチェーンを作って、継承
3015
3016 (function(){
3017   /*readonly unsigned short*/ this.colorType = /*SVGColor.SVG_COLORTYPE_UNKNOWN*/ 0;
3018   /*readonly SVGICCColor*/    this.iccColor = null;
3019   this._regD = /\d+/g;
3020   this._regDP = /[\d.]+%/g;
3021   this._exceptionsvg = SVGException.SVG_INVALID_VALUE_ERR;
3022   /*void*/ this.setRGBColor = function(/*DOMString*/ rgbColor ){
3023   var s,
3024       _parseInt,
3025       r, g, b;
3026   if (!rgbColor || (typeof rgbColor !== "string")) {
3027     throw new SVGException(this._exceptionsvg);
3028   }
3029   rgbColor = this._keywords[rgbColor] || rgbColor;
3030   if (rgbColor.indexOf("%", 5) > 0) {      // %を含むrgb形式の場合
3031     rgbColor = rgbColor.replace(this._regDP, function(s) {
3032       return Math.round((2.55 * parseFloat(s)));
3033     });
3034     s = rgbColor.match(this._regD);
3035   } else if (rgbColor.indexOf("#") === 0) {  //#を含む場合
3036     s = [];
3037     _parseInt = parseInt;
3038     if (rgbColor.length < 5) {
3039       r = rgbColor.charAt(1);
3040       g = rgbColor.charAt(2);
3041       b = rgbColor.charAt(3)
3042       rgbColor = "#" + r + r + g + g + b + b;
3043     }
3044     s[0] = _parseInt(rgbColor.slice(1, 3), 16)+ "";
3045     s[1] = _parseInt(rgbColor.slice(3, 5), 16)+ "";
3046     s[2] = _parseInt(rgbColor.slice(5, 7), 16)+ "";
3047     r = g = b = void 0;
3048   } else {
3049     s = rgbColor.match(this._regD);
3050     if (!s || (s.length < 3)) { //数値が含まれていなければ強制的に終了
3051       rgbColor = void 0;
3052       throw new SVGException(this._exceptionsvg);
3053     }
3054   }
3055   this.rgbColor.red.setFloatValue(/*CSSPrimitiveValue.CSS_NUMBER*/ 1, s[0]);
3056   this.rgbColor.green.setFloatValue(1, s[1]);
3057   this.rgbColor.blue.setFloatValue(1, s[2]);
3058   rgbColor = s = _parseInt = void 0;
3059 };
3060
3061 //                    raises( SVGException );
3062 /*void*/ this.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){
3063   this.colorType = colorType;
3064   if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) && iccColor) {
3065     throw new SVGException(this._exceptionsvg);
3066   } else if (colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) {
3067     this.setRGBColor(rgbColor);
3068   } else if (rgbColor && (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
3069     this.setRGBColor(rgbColor);
3070   } else if ((colorType === /*SVGColor.SVG_COLORTYPE_UNKNOWN*/ 0) && (rgbColor || iccColor)) {
3071     throw new SVGException(this._exceptionsvg);
3072   } else if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR_ICCCOLOR*/ 2) && (rgbColor || !iccColor)) {
3073     throw new SVGException(this._exceptionsvg);
3074   }
3075   colorType = rgbColor = void 0;
3076 }
3077 //                    raises( SVGException );
3078 //色キーワード
3079 this._keywords = {
3080     aliceblue:    "rgb(240,248,255)",
3081     antiquewhite: "rgb(250,235,215)",
3082     aqua:         "rgb(0,255,255)",
3083     aquamarine:   "rgb(127,255,212)",
3084     azure:        "rgb(240,255,255)",
3085     beige:        "rgb(245,245,220)",
3086     bisque:       "rgb(255,228,196)",
3087     black:        "rgb(0,0,0)",
3088     blanchedalmond:"rgb(255,235,205)",
3089     blue:         "rgb(0,0,255)",
3090     blueviolet:   "rgb(138,43,226)",
3091     brown:        "rgb(165,42,42)",
3092     burlywood:    "rgb(222,184,135)",
3093     cadetblue:    "rgb(95,158,160)",
3094     chartreuse:   "rgb(127,255,0)",
3095     chocolate:    "rgb(210,105,30)",
3096     coral:        "rgb(255,127,80)",
3097     cornflowerblue:"rgb(100,149,237)",
3098     cornsilk:     "rgb(255,248,220)",
3099     crimson:      "rgb(220,20,60)",
3100     cyan:         "rgb(0,255,255)",
3101     darkblue:     "rgb(0,0,139)",
3102     darkcyan:     "rgb(0,139,139)",
3103     darkgoldenrod:"rgb(184,134,11)",
3104     darkgray:     "rgb(169,169,169)",
3105     darkgreen:    "rgb(0,100,0)",
3106     darkgrey:     "rgb(169,169,169)",
3107     darkkhaki:    "rgb(189,183,107)",
3108     darkmagenta:  "rgb(139,0,139)",
3109     darkolivegreen:"rgb(85,107,47)",
3110     darkorange:    "rgb(255,140,0)",
3111     darkorchid:   "rgb(153,50,204)",
3112     darkred:      "rgb(139,0,0)",
3113     darksalmon:   "rgb(233,150,122)",
3114     darkseagreen: "rgb(143,188,143)",
3115     darkslateblue:"rgb(72,61,139)",
3116     darkslategray:"rgb(47,79,79)",
3117     darkslategrey:"rgb(47,79,79)",
3118     darkturquoise:"rgb(0,206,209)",
3119     darkviolet:   "rgb(148,0,211)",
3120     deeppink:     "rgb(255,20,147)",
3121     deepskyblue:  "rgb(0,191,255)",
3122     dimgray:      "rgb(105,105,105)",
3123     dimgrey:      "rgb(105,105,105)",
3124     dodgerblue:   "rgb(30,144,255)",
3125     firebrick:    "rgb(178,34,34)",
3126     floralwhite:  "rgb(255,250,240)",
3127     forestgreen:  "rgb(34,139,34)",
3128     fuchsia:      "rgb(255,0,255)",
3129     gainsboro:    "rgb(220,220,220)",
3130     ghostwhite:   "rgb(248,248,255)",
3131     gold:         "rgb(255,215,0)",
3132     goldenrod:    "rgb(218,165,32)",
3133     gray:         "rgb(128,128,128)",
3134     grey:         "rgb(128,128,128)",
3135     green:        "rgb(0,128,0)",
3136     greenyellow:  "rgb(173,255,47)",
3137     honeydew:     "rgb(240,255,240)",
3138     hotpink:      "rgb(255,105,180)",
3139     indianred:    "rgb(205,92,92)",
3140     indigo:       "rgb(75,0,130)",
3141     ivory:        "rgb(255,255,240)",
3142     khaki:        "rgb(240,230,140)",
3143     lavender:     "rgb(230,230,250)",
3144     lavenderblush:"rgb(255,240,245)",
3145     lawngreen:    "rgb(124,252,0)",
3146     lemonchiffon: "rgb(255,250,205)",
3147     lightblue:    "rgb(173,216,230)",
3148     lightcoral:   "rgb(240,128,128)",
3149     lightcyan:    "rgb(224,255,255)",
3150     lightgoldenrodyellow:"rgb(250,250,210)",
3151     lightgray:    "rgb(211,211,211)",
3152     lightgreen:   "rgb(144,238,144)",
3153     lightgrey:    "rgb(211,211,211)",
3154     lightpink:    "rgb(255,182,193)",
3155     lightsalmon:  "rgb(255,160,122)",
3156     lightseagree: "rgb(32,178,170)",
3157     lightskyblue: "rgb(135,206,250)",
3158     lightslategray:"rgb(119,136,153)",
3159     lightslategrey:"rgb(119,136,153)",
3160     lightsteelblue:"rgb(176,196,222)",
3161     lightyellow:  "rgb(255,255,224)",
3162     lime:         "rgb(0,255,0)",
3163     limegreen:    "rgb(50,205,50)",
3164     linen:        "rgb(250,240,230)",
3165     magenta:      "rgb(255,0,255)",
3166     maroon:       "rgb(128,0,0)",
3167     mediumaquamarine:"rgb(102,205,170)",
3168     mediumblue:    "rgb(0,0,205)",
3169     mediumorchid:  "rgb(186,85,211)",
3170     mediumpurple:  "rgb(147,112,219)",
3171     mediumseagreen:"rgb(60,179,113)",
3172     mediumslateblue:"rgb(123,104,238)",
3173     mediumspringgreen:"rgb(0,250,154)",
3174     mediumturquoise:"rgb(72,209,204)",
3175     mediumvioletred:"rgb(199,21,133)",
3176     midnightblue:  "rgb(25,25,112)",
3177     mintcream:     "rgb(245,255,250)",
3178     mistyrose:     "rgb(255,228,225)",
3179     moccasin:      "rgb(255,228,181)",
3180     navajowhite:   "rgb(255,222,173)",
3181     navy:          "rgb(0,0,128)",
3182     oldlace:       "rgb(253,245,230)",
3183     olive:         "rgb(128,128,0)",
3184     olivedrab:     "rgb(107,142,35)",
3185     orange:        "rgb(255,165,0)",
3186     orangered:     "rgb(255,69,0)",
3187     orchid:        "rgb(218,112,214)",
3188     palegoldenrod: "rgb(238,232,170)",
3189     palegreen:     "rgb(152,251,152)",
3190     paleturquoise: "rgb(175,238,238)",
3191     palevioletred: "rgb(219,112,147)",
3192     papayawhip:    "rgb(255,239,213)",
3193     peachpuff:     "rgb(255,218,185)",
3194     peru:          "rgb(205,133,63)",
3195     pink:          "rgb(255,192,203)",
3196     plum:          "rgb(221,160,221)",
3197     powderblue:    "rgb(176,224,230)",
3198     purple:        "rgb(128,0,128)",
3199     red:           "rgb(255,0,0)",
3200     rosybrown:     "rgb(188,143,143)",
3201     royalblue:     "rgb(65,105,225)",
3202     saddlebrown:   "rgb(139,69,19)",
3203     salmon:        "rgb(250,128,114)",
3204     sandybrown:    "rgb(244,164,96)",
3205     seagreen:      "rgb(46,139,87)",
3206     seashell:      "rgb(255,245,238)",
3207     sienna:        "rgb(160,82,45)",
3208     silver:        "rgb(192,192,192)",
3209     skyblue:       "rgb(135,206,235)",
3210     slateblue:     "rgb(106,90,205)",
3211     slategray:     "rgb(112,128,144)",
3212     slategrey:     "rgb(112,128,144)",
3213     snow:          "rgb(255,250,250)",
3214     springgreen:   "rgb(0,255,127)",
3215     steelblue:     "rgb(70,130,180)",
3216     tan:           "rgb(210,180,140)",
3217     teal:          "rgb(0,128,128)",
3218     thistle:       "rgb(216,191,216)",
3219     tomato:        "rgb(255,99,71)",
3220     turquoise:     "rgb(64,224,208)",
3221     violet:        "rgb(238,130,238)",
3222     wheat:         "rgb(245,222,179)",
3223     white:         "rgb(255,255,255)",
3224     whitesmoke:    "rgb(245,245,245)",
3225     yellow:        "rgb(255,255,0)",
3226     yellowgreen:   "rgb(154,205,50)"
3227 };
3228 }).apply(SVGColor.prototype);
3229
3230 function SVGRect() { 
3231   /*float*/ this.x      = 0;
3232                          // raises DOMException on setting
3233   /*float*/ this.y      = 0;
3234                          // raises DOMException on setting
3235   /*float*/ this.width  = 0;
3236                          // raises DOMException on setting
3237   /*float*/ this.height = 0;
3238                          // raises DOMException on setting
3239   return this;
3240 };
3241
3242 function SVGAnimatedRect() { 
3243   /*readonly SVGRect*/ this.animVal = this.baseVal = new SVGRect();
3244   return this;
3245 };
3246
3247 SVGUnitTypes = { 
3248   // Unit Types
3249   /*unsigned short*/ SVG_UNIT_TYPE_UNKNOWN           : 0,
3250   /*unsigned short*/ SVG_UNIT_TYPE_USERSPACEONUSE    : 1,
3251   /*unsigned short*/ SVG_UNIT_TYPE_OBJECTBOUNDINGBOX : 2
3252 };
3253 function SVGStylable() {
3254   /*readonly attribute SVGAnimatedString*/ this.className = new SVGAnimatedString();
3255   /*readonly attribute css::CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration();
3256   this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する
3257   //styleのcssTextプロパティを解析するリスナーを登録しておく
3258 };
3259 /*getPresentationAttributeメソッド
3260  *プレゼンテーション属性の値をCSSValueとして得る。これはCSSのスタイルの設定値を定めるときや、内部の動的処理に役立つ
3261  */
3262 /*css::CSSValue*/ SVGElement.prototype.getPresentationAttribute = function( /*DOMString*/ name ){
3263   var s = this._attributeStyle.getPropertyCSSValue(name);
3264   if (s) {
3265     return s;
3266   } else {
3267     return null;
3268   }
3269 };
3270
3271 /*SVGURIReferenceオブジェクトはURI参照を用いる要素に適用される
3272  *SIEでは、もっぱらXLink言語の処理を行う
3273  */
3274 function SVGURIReference() {
3275   /*readonly SVGAnimatedString*/ this.href = new SVGAnimatedString();
3276   this._instance = null; //埋め込みの場合に、読み込んだDOMツリーを結び付けておくプロパティ
3277   this._text = "";
3278   this.addEventListener("DOMAttrModified", function(evt){
3279     if ((evt.relatedNode.namespaceURI === "http://www.w3.org/1999/xlink") && (evt.attrName === "xlink:href")) {
3280       evt.target.href.baseVal = evt.newValue;
3281       /*_svgload_limitedを+1とすることで、
3282        *SVGLoadイベントは発火されなくなる。1を引く必要がある
3283        */
3284       evt.target.ownerDocument.documentElement._svgload_limited++;
3285     }
3286     evt = void 0;
3287   }, false);
3288   this.addEventListener("DOMNodeInserted", function(evt){
3289     var tar = evt.target;
3290     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3291       return; //強制終了させる
3292     }
3293     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
3294       var tar = evt.target,
3295           base,
3296           href = tar.href.baseVal,
3297           show, egbase, ep, b, lh, uri, xmlhttp, ui, id, doc, ele, ev;
3298       /*xlink:href属性とxml:base属性を手がかりに、
3299        *ハイパーリンクのURIを決定する処理を行う
3300        */
3301       if (href !== "") { //xlink:href属性が指定されたとき
3302         egbase = tar.xmlbase;
3303         if (!egbase) {
3304           ep = tar.parentNode;
3305           b = null;
3306           while (!b && ep) {
3307             b = ep.xmlbase;
3308             ep = ep.parentNode;
3309           }
3310           base = b;
3311           if (!b) {                        //xml:baseの指定がなければ
3312             if (href.indexOf("#") !== 0) { //href属性において#が一番につかない場合
3313               lh = location.href;
3314               base = lh.replace(/\/[^\/]+?$/, "/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/
3315             } else {
3316               base = location.href;
3317             }
3318           }
3319         } else {
3320           base = egbase;
3321         }
3322         if (href.indexOf(":") !== -1) { //絶対URIの場合
3323           base =  "";
3324         }
3325         uri = base + href;
3326         show = tar.getAttributeNS("http://www.w3.org/1999/xlink", "show") || "embed";
3327         if (href.indexOf(".") === 0) {  //相対URIの場合
3328           uri = href;
3329         }
3330         if (show === "replace") {
3331           tar._tar.setAttribute("href", uri);
3332         } else if (show === "new") {
3333           tar._tar.setAttribute("target", "_blank");
3334           tar._tar.setAttribute("href", uri);
3335         } else if (show === "embed") {
3336           xmlhttp = NAIBU.xmlhttp;
3337           ui = uri.indexOf("#");
3338           if (ui > -1) {
3339             id = uri.slice(ui+1);
3340             uri = uri.replace(/#.+$/, "");
3341           } else {
3342             id = null;
3343           }
3344           if (href.indexOf("#") === 0) { //URIが#で始まるのであれば
3345             doc = tar.ownerDocument;
3346             ele = doc.getElementById(id);
3347             tar._instance = ele;
3348             ev = doc.createEvent("SVGEvents");
3349             ev.initEvent("S_Load", false, false);
3350             tar.dispatchEvent(ev);
3351             tar = xmlhttp = void 0;
3352           } else if (uri.indexOf("data:") > -1) {
3353             tar._tar.src = uri;
3354             tar = xmlhttp = void 0;
3355           } else if ((uri.indexOf("http:") > -1) || (uri.indexOf(".") === 0)){
3356             if ((tar.localName === "image") && (uri.indexOf(".svg") === -1)) {
3357               tar._tar.src = uri;
3358             } else {
3359               /*ここの_svgload_limitedは、リンクを読み込んだ後でSVGLoadイベントを実行させるという遅延処理で必要*/
3360               tar.ownerDocument.documentElement._svgload_limited++;
3361               xmlhttp.open("GET", uri, false);
3362               xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
3363               xmlhttp.onreadystatechange = function() {
3364                 if ((xmlhttp.readyState === 4) && (xmlhttp.status === 200)) {
3365                   var type = xmlhttp.getResponseHeader('Content-Type') || "text",
3366                       doc, str, ele, ev;
3367                   if ((type.indexOf("text") > -1) || (type.indexOf("xml") > -1) || (type.indexOf("script") > -1)) { //ファイルがtext形式である場合
3368                     /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因はcontent-typeが"text/xml"など特定のものでないと受け付けないため)、
3369                      *ここでは、responseTextを用いる
3370                      */
3371                     /*script要素とstyle要素は、
3372                      *_textプロパティに読み込んだテキストを格納しておく
3373                      *それら以外は、_instanceプロパティにDOMツリーを格納しておく
3374                      */
3375                     if (tar.localName !== "script" && tar.localName !== "style") {
3376                       doc = new ActiveXObject("MSXML2.DomDocument");
3377                       str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->");
3378                       NAIBU.doc.async = false;
3379                       NAIBU.doc.validateOnParse = false;
3380                       NAIBU.doc.resolveExternals = false;
3381                       NAIBU.doc.preserveWhiteSpace = false;
3382                       doc.loadXML(str);
3383                       ele = doc.documentElement;
3384                       tar._instance = tar.ownerDocument.importNode(ele, true);
3385                       if (id) {
3386                         tar._instance = tar._instance.ownerDocument.getElementById(id);
3387                       }
3388                     } else {
3389                       tar._text = xmlhttp.responseText;
3390                     }
3391                   } else if (!!tar._tar) {
3392                     tar._tar.src = uri;
3393                   }
3394                   /*S_LoadイベントとはSIE独自のイベント。
3395                    *XLink言語によって、リンク先のコンテンツが読み込まれた時点で発火する
3396                    */
3397                   ev = tar.ownerDocument.createEvent("SVGEvents");
3398                   ev.initEvent("S_Load", false, false);
3399                   tar.dispatchEvent(ev);
3400                   tar.ownerDocument.documentElement._svgload_limited--;
3401                   /*すべてのリンクが読み込みを終了した場合、SVGLoadイベントを発火*/
3402                   if (tar.ownerDocument.documentElement._svgload_limited < 0) {
3403                     ev = tar.ownerDocument.createEvent("SVGEvents");
3404                     ev.initEvent("SVGLoad", false, false);
3405                     tar.ownerDocument.documentElement.dispatchEvent(ev);
3406                   }
3407                   tar = type = doc = str = ev = void 0;
3408                   /*IEのメモリリーク対策として、空関数を入力*/
3409                   xmlhttp.onreadystatechange = NAIBU.emptyFunction;
3410                   xmlhttp = void 0;
3411                 }
3412               };
3413               xmlhttp.send(null);
3414             }
3415           }
3416         }
3417         tar.ownerDocument.documentElement._svgload_limited--;
3418       }
3419       evt = base = href = egbase = ep = b = lh = uri = ui = id = doc = ele = ev = show= void 0;
3420     }, false);
3421     tar = evt = void 0;
3422   }, false);
3423   return this;
3424 };
3425 function SVGCSSRule() { 
3426   CSSRule.apply(this, arguments);
3427   // Additional CSS RuleType to support ICC color specifications
3428   /*const unsigned short*/ this.COLOR_PROFILE_RULE = 7;
3429   return this;
3430 };
3431 SVGCSSRule.prototype = new CSSRule();  //ノードのプロトタイプチェーンを作って、継承
3432
3433 /*SVGDocument
3434  *SVGの文書オブジェクト
3435  */
3436 function SVGDocument(){
3437   Document.apply(this);
3438   DocumentStyle.apply(this);
3439   /*readonly DOMString*/     this.title    = "";
3440   /*readonly DOMString*/     this.referrer = document.referrer;
3441   /*readonly DOMString*/     this.domain   = document.domain;
3442   /*readonly DOMString*/     this.URL      = document.location;
3443   /*readonly SVGSVGElement*/ this.rootElement;
3444   return this;
3445 };
3446 SVGDocument.prototype = new Document();  //ノードのプロトタイプチェーンを作って、継承
3447
3448 /*軽量化のために、頻繁に使われる処理をSVGDocumentの独自メソッドとしてまとめておく*/
3449 SVGDocument.prototype._domnodeEvent = function() {
3450   var evtt = this.createEvent("MutationEvents");
3451   evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
3452   return evtt;
3453 };
3454
3455 /*SVGSVGElement
3456  *svg要素をあらわすオブジェクト
3457  */
3458 function SVGSVGElement(_doc) {
3459   SVGElement.apply(this, arguments);
3460   this._tar = _doc.createElement("v:group");
3461   _doc = void 0;
3462   /*_svgload_limitedはSVGLoadイベントを発火させる判定基準。
3463    * Xlink言語が使われていない限り0であり、SVGLoadイベントが発火される*/
3464   this._svgload_limited = 0;
3465 /*                SVGElement,
3466                 SVGTests,
3467                 SVGLangSpace,
3468                 SVGExternalResourcesRequired,
3469                 SVGStylable,
3470                 SVGLocatable,
3471                 SVGFitToViewBox,
3472                 SVGZoomAndPan,
3473                 events::EventTarget,
3474                 events::DocumentEvent,
3475                 css::ViewCSS,
3476                 css::DocumentCSS {*/
3477   /*以下のx,y,width,heightプロパティは
3478    *それぞれ、svg要素の同名属性に対応。たとえば、xならば、x属性に対応している
3479    *1000というのは、W3Cで触れていないため、独自の初期値を採用
3480    */
3481   var slen = SVGAnimatedLength;
3482   /*readonly SVGAnimatedLength*/ this.x      = new slen();
3483   /*readonly SVGAnimatedLength*/ this.y      = new slen();
3484   /*readonly SVGAnimatedLength*/ this.width  = new slen();
3485   /*readonly SVGAnimatedLength*/ this.height = new slen();
3486   slen = void 0;
3487   /*DOMString*/                  this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript
3488   /*DOMString*/                  this.contentStyleType  = "text/css";
3489   /*readonly SVGRect*/           this.viewport          = this.createSVGRect();
3490   /*useCurrentViewプロパティ
3491    * view要素やハイパーリンクなどで呼び出された場合、true。それ以外の通常表示はfalse。
3492    */
3493   /*boolean*/                    this.useCurrentView    = false;
3494   /*currentViewプロパティ
3495    * ズームやパンがされていない初期表示のviewBoxプロパティなどを示す。通常はDOM属性と連動
3496    */
3497   /*readonly SVGViewSpec*/       this.currentView       = new SVGViewSpec(this);
3498   /*もし、画像をズームやパンしたとき、どのような倍率になるかを
3499    *以下のプロパティを使って次の行列で示すことができる
3500    *2x3 行列 [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y] 
3501    */
3502   /*float*/                      this.currentScale     = 1;
3503   /*readonly SVGPoint*/          this.currentTranslate = this.createSVGPoint();
3504   /*以下は、SVGFitToViewBoxのインターフェースを用いる
3505    *もし、ズームやパンがあれば、真っ先にこれらのプロパティを別のオブジェクトに変更すること
3506    */
3507   /*readonly SVGAnimatedRect*/   this.viewBox = this.currentView.viewBox;
3508   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio;
3509   /*unsigned short*/             this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
3510   this._tx = 0;
3511   this._ty = 0;
3512   /*int*/                       this._currentTime = 0;
3513   /*DOMAttrModifiedイベントを利用して、
3514    *随時、属性の値をDOMプロパティに変換しておくリスナー登録
3515    */
3516   this.addEventListener("DOMAttrModified", function(evt){
3517     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3518       return; //強制終了させる
3519     }
3520     var tar = evt.target,
3521         name = evt.attrName,
3522         tv, ovb, par, tp, sa, mos;
3523     if (name === "viewBox") {
3524       tar._cacheScreenCTM = null;
3525       tv = tar.viewBox.baseVal;
3526       ovb = evt.newValue.replace(/^\s+|\s+$/g, "").split(/[\s,]+/);
3527       tv.x = parseFloat(ovb[0]);
3528       tv.y = parseFloat(ovb[1]);
3529       tv.width = parseFloat(ovb[2]);
3530       tv.height = parseFloat(ovb[3]);
3531       tar.viewBox.baseVal._isUsed = 1;
3532     } else if (name === "preserveAspectRatio") {
3533       tar._cacheScreenCTM = null;
3534       par = evt.newValue;
3535       tp = tar.preserveAspectRatio.baseVal;
3536       sa = 1;
3537       mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN;
3538       if (!!par.match(/x(Min|Mid|Max)Y(Min|Mid|Max)(?:\s+(meet|slice))?/)) {
3539         switch (RegExp.$1) {
3540           case "Min":
3541             sa += 1;
3542           break;
3543           case "Mid":
3544             sa += 2;
3545           break;
3546           case "Max":
3547             sa += 3;
3548           break;
3549         }
3550         switch (RegExp.$2) {
3551           case "Min":
3552           break;
3553           case "Mid":
3554             sa += 3;
3555           break;
3556           case "Max":
3557             sa += 6;
3558           break;
3559         }
3560         if (RegExp.$3 === "slice") {
3561           mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
3562         } else {
3563           mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
3564         }
3565       }
3566       tp.align = sa;
3567       tp.meetOrSlice = mos;
3568     } else if (name === "width") {
3569       /*viewportを更新する*/
3570       tar.viewport.width = tar.width.baseVal.value;
3571     } else if (name === "height") {
3572       tar.viewport.height = tar.height.baseVal.value;
3573     }
3574     evt = name = tv = ovb = par = tp = sa = mos = void 0;
3575   }, false);
3576   this.addEventListener("SVGLoad", function(evt){
3577     /*以下のDOMAttrModifiedは浮上フェーズのときに、再描画をするように
3578      *処理を書いたもの。属性が書き換わるたびに、再描画される
3579      */
3580     evt.target.addEventListener("DOMAttrModified", function(evt){
3581       var tar,
3582           evtt, tce, slist;
3583       if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3584         tar = evt.target;
3585         if (tar.parentNode) {
3586           evtt = tar.ownerDocument._domnodeEvent();
3587           evtt.target = tar;
3588           evtt.eventPhase = /*Event.AT_TARGET*/ 2;
3589           tce = tar._capter; //tceは登録しておいたリスナーのリスト
3590           for (var j=0,tcli=tce.length;j<tcli;++j){
3591             if (tce[j]) {
3592               tce[j].handleEvent(evtt);
3593             }
3594           }
3595           if (((tar.localName === "g") || (tar.localName === "a")) && (tar.namespaceURI === "http://www.w3.org/2000/svg")) {
3596             tar._cacheMatrix = void 0; //キャッシュを消去
3597             if (tar.firstChild) {
3598               slist = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
3599               for (var i=0,sli=slist.length;i<sli;++i) {
3600                 tar = slist[i];
3601                 tar._cacheMatrix = void 0;
3602                 evtt = tar.ownerDocument.createEvent("MutationEvents");
3603                 evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
3604                 evtt.target = tar;
3605                 evtt.eventPhase = /*Event.AT_TARGET*/ 2;
3606                 tce = tar._capter; //tceは登録しておいたリスナーのリスト
3607                 for (var j=0,tcli=tce.length;j<tcli;++j){
3608                   if (tce[j]) {
3609                     tce[j].handleEvent(evtt);
3610                   }
3611                 }
3612               }
3613             }
3614           }
3615         }
3616       }
3617       evtt = tar = evt = tce = slist = void 0;
3618     }, false)
3619     evt.target.addEventListener("DOMNodeRemovedFromDocument", function(evt){
3620       var tar = evt.target;
3621       tar._tar && tar._tar.parentNode && tar._tar.parentNode.removeChild(tar._tar);
3622       evt = tar = void 0;
3623     }, true);
3624     evt = void 0;
3625   }, false);
3626   return this;
3627 };
3628 SVGSVGElement.prototype = new SVGElement();
3629 /*void*/          SVGSVGElement.prototype.forceRedraw = function() {
3630 };
3631 /*float*/         SVGSVGElement.prototype.getCurrentTime = function(){
3632   return (this._currentTime);
3633 };
3634 /*void*/          SVGSVGElement.prototype.setCurrentTime = function(/*float*/ seconds ){
3635   this._currentTime = seconds;
3636 };
3637 /*SVGNumber*/     SVGSVGElement.prototype.createSVGNumber = function(){
3638   var s = new SVGNumber();
3639   s.value = 0;
3640   return s;
3641 };
3642 /*SVGAngle*/     SVGSVGElement.prototype.createSVGAngle = function(){
3643   var s = new SVGAngle();
3644   s.value = 0;
3645   s.unitType = 1;
3646   return s;
3647 };
3648 /*SVGLength*/     SVGSVGElement.prototype.createSVGLength = function(){
3649   var s = new SVGLength();
3650   s.unitType = /*SVG_LENGTHTYPE_NUMBER*/ 1;
3651   return s;
3652 };
3653 /*SVGPoint*/      SVGSVGElement.prototype.createSVGPoint = function(){
3654   return new SVGPoint();
3655 };
3656 /*SVGMatrix*/     SVGSVGElement.prototype.createSVGMatrix = function(){
3657   //単位行列を作成
3658   return new SVGMatrix();
3659 };
3660 /*SVGRect*/       SVGSVGElement.prototype.createSVGRect = function(){
3661   return new SVGRect();
3662 };
3663 /*SVGTransform*/  SVGSVGElement.prototype.createSVGTransform = function(){
3664   var s = this.createSVGTransformFromMatrix(this.createSVGMatrix());
3665   return s;
3666 };
3667 /*SVGTransform*/  SVGSVGElement.prototype.createSVGTransformFromMatrix = function(/*SVGMatrix*/ matrix ){
3668   var s = new SVGTransform();
3669   s.setMatrix(matrix);
3670   return s;
3671 };
3672 /*getScreenCTM
3673  *SVGElement(SVGLocatable)で指定しておいたメソッドであるが、ここで、算出方法が違うため、再定義をする
3674  */
3675 /*SVGMatrix*/ SVGSVGElement.prototype.getScreenCTM = function(){
3676   if (!!this._cacheScreenCTM) { //キャッシュがあれば
3677     return (this._cacheScreenCTM);
3678   }
3679   var vw = this.viewport.width,
3680       vh = this.viewport.height,
3681       vB, par, m, vbx, vby, vbw, vbh, rw, rh, xr, yr, tx, ty, ttps;
3682   if (!this.useCurrentView) {
3683     vB = this.viewBox.baseVal;
3684     par = this.preserveAspectRatio.baseVal;    
3685   } else {
3686     vB = this.currentView.viewBox.baseVal;
3687     par = this.currentView.preserveAspectRatio.baseVal;
3688   }
3689   if (!!!vB._isUsed) { //viewBox属性が指定されていなければ
3690     this._tx = this._ty = 0;
3691     m = this.createSVGMatrix();
3692     this._cacheScreenCTM = m; //キャッシュを作っておく
3693     return m;
3694   } else {
3695     vbx = vB.x;
3696     vby = vB.y;
3697     vbw = vB.width;
3698     vbh = vB.height;
3699     rw = vw / vbw;
3700     rh = vh / vbh;
3701     xr = 1;
3702     yr = 1;
3703     tx = 0;
3704     ty = 0;
3705     if (par.align === 1) { //none
3706       xr = rw;
3707       yr = rh;
3708       tx = -vbx * xr;
3709       ty = -vby * yr;
3710     } else {
3711       var ax = (par.align + 1) % 3 + 1;
3712       var ay = Math.round(par.align / 3);
3713       switch (par.meetOrSlice) {
3714         case 1: //meet
3715           xr = yr = Math.min(rw, rh);
3716         break;
3717         case 2: //slice
3718           xr = yr = Math.max(rw, rh);
3719         break;
3720       }
3721       tx = -vbx * xr;
3722       ty = -vby * yr;
3723       switch (ax) {
3724         case 1: //xMin
3725         break;
3726         case 2: //xMid
3727           tx += (vw - vbw * xr) / 2;
3728         break;
3729         case 3: //xMax
3730           tx += vw - vbw * xr;
3731         break;
3732       }
3733       switch (ay) {
3734         case 1: //YMin
3735         break;
3736         case 2: //YMid
3737           ty += (vh - vbh * yr) / 2;
3738         break;
3739         case 3: //YMax
3740           ty += vh - vbh * yr;
3741         break;
3742       }
3743     }
3744   }
3745   //text要素の位置調整に使うため、ここで、viewの移動量を記録しておく
3746   this._tx = tx;
3747   this._ty = ty;
3748   ttps =  this._tar.style;
3749   ttps.marginLeft = tx+ "px";
3750   ttps.marginTop = ty+ "px";
3751   m = this.createSVGMatrix();
3752   m.a = xr;
3753   m.d = yr;
3754   this._cacheScreenCTM = m; //キャッシュを作っておく
3755   vw = vh = vB = par = vbx = vby = vbw = vbh = rw = rh = xr = yr = tx = ty = ttps = void 0;
3756   return m;
3757 };
3758
3759   /*interface SVGZoomAndPan*/
3760   // Zoom and Pan Types
3761 SVGZoomAndPan = {
3762   /*const unsigned short*/ SVG_ZOOMANDPAN_UNKNOWN : 0,
3763   /*const unsigned short*/ SVG_ZOOMANDPAN_DISABLE : 1,
3764   /*const unsigned short*/ SVG_ZOOMANDPAN_MAGNIFY : 2
3765 };
3766
3767 function SVGFitToViewBox() {
3768   /*readonly SVGAnimatedRect*/ this.viewBox = new SVGAnimatedRect();
3769   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();
3770   return this;
3771 };
3772 function SVGViewSpec(ele) {
3773   SVGFitToViewBox.apply(this, arguments);
3774   /*readonly SVGTransformList*/ this.transform = new SVGTransformList();
3775   /*readonly SVGElement*/       this.viewTarget = ele;
3776   /*readonly DOMString*/        this.viewBoxString = this.preserveAspectRatioString = this.transformString = this.viewTargetString = "";
3777   return this;
3778 };
3779 SVGViewSpec.prototype = new SVGFitToViewBox();
3780
3781 function SVGGElement(_doc) {
3782   SVGElement.apply(this);
3783   this._tar = _doc.createElement("v:group");
3784   _doc = void 0;
3785   /*以下の処理は、この子要素ノードがDOMツリーに追加されて初めて、
3786    *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。
3787    */
3788   this.addEventListener("DOMNodeInserted", function(evt){
3789     var tar = evt.target;
3790     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3791       return; //強制終了させる
3792     }
3793     var tnext = tar.nextSibling,
3794         tpart = tar.parentNode._tar,
3795         isLast = true;
3796     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
3797       tpart.insertBefore(tar._tar, tnext._tar);
3798     } else if (tnext && !tnext._tar && tpart) {
3799       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
3800        *use要素や実体参照などは_tarプロパティがないことに注意
3801        */
3802       while (tnext) {
3803         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
3804           tpart.insertBefore(tar._tar, tnext._tar);
3805           isLast = false;
3806         } 
3807         tnext = tnext.nextSibling;
3808       }
3809       if (isLast) {
3810         tpart.appendChild(tar._tar);
3811       }
3812     } else if (!tnext && tpart) {
3813       tpart.appendChild(tar._tar);      
3814     }
3815     tnext = tpart = isLast = evt = tar = void 0;
3816   }, false);
3817   return this;
3818 };
3819 SVGGElement.prototype = new SVGElement();
3820
3821 function SVGDefsElement() {
3822   SVGElement.apply(this, arguments);
3823   this.style.setProperty("display", "none");
3824   return this;
3825 };
3826 SVGDefsElement.prototype = new SVGElement();
3827
3828 function SVGDescElement() {
3829   SVGElement.apply(this, arguments);
3830   return this;
3831 }
3832 SVGDescElement.prototype = new SVGElement();
3833
3834 function SVGTitleElement() {
3835   SVGElement.apply(this, arguments);
3836   this.addEventListener("DOMCharacterDataModified", function(evt){
3837     evt.target.ownerDocument.title = evt.target.firstChild.nodeValue;
3838   }, false);
3839   return this;
3840 }
3841 SVGTitleElement.prototype = new SVGElement();
3842
3843 function SVGSymbolElement(_doc) {
3844   SVGElement.apply(this, arguments);
3845   return this;
3846 }
3847 SVGSymbolElement.prototype = new SVGElement();
3848
3849 function SVGUseElement() {
3850   SVGGElement.apply(this, arguments);
3851   var slen = SVGAnimatedLength;
3852   /*readonly SVGAnimatedLength*/   this.x = new slen();           //use要素のx属性に対応(以下、同様)
3853   /*readonly SVGAnimatedLength*/   this.y = new slen();
3854   /*readonly SVGAnimatedLength*/   this.width = new slen();
3855   /*readonly SVGAnimatedLength*/   this.height = new slen();
3856   slen = void 0;
3857   /*readonly SVGElementInstance*/ this.instanceRoot = new SVGElementInstance(); //参照先インスタンスのルート
3858   /*readonly SVGElementInstance*/ this.animatedInstanceRoot = new SVGElementInstance();//アニメの最中のインスタンス。静止中は通常
3859   this.addEventListener("DOMNodeInserted", function(evt){
3860     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3861       return; //強制終了させる
3862     }
3863     evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
3864   }, false);
3865   this.addEventListener("S_Load", function(evt){
3866     var tar = evt.target,
3867         style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
3868         fontSize = parseFloat(style.getPropertyValue("font-size")),
3869         trans = tar.ownerDocument.documentElement.createSVGTransform(),
3870         tari = tar._instance,
3871         svg, ti, ta, tn;
3872     tar.x.baseVal._emToUnit(fontSize);
3873     tar.y.baseVal._emToUnit(fontSize);
3874     tar.width.baseVal._emToUnit(fontSize);
3875     tar.height.baseVal._emToUnit(fontSize);
3876     tar.instanceRoot = tar.animatedInstanceRoot = tar.ownerDocument.importNode(tari, true);
3877     trans.setTranslate(tar.x.baseVal.value, tar.y.baseVal.value);
3878     tar.transform.baseVal.appendItem(trans);
3879     if (tar._instance.localName === "symbol") {
3880       /*symbol要素の場合、別途svg要素に置き換える*/
3881       svg = tar.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "svg");
3882       svg.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
3883         /*viewportをsymbol要素として新規に設定*/
3884         evt.target.nearestViewportElement = evt.currentTarget;
3885       }, true);
3886       tar._tar.appendChild(svg._tar);
3887       tn = tar.getScreenCTM();
3888       svg.setAttributeNS(null, "width", tar.width.baseVal.value);
3889       svg.setAttributeNS(null, "height", tar.height.baseVal.value);
3890         tari.hasAttributeNS(null, "viewBox") &&  svg.setAttributeNS(null, "viewBox", tari.getAttributeNS(null, "viewBox"));
3891         tari.hasAttributeNS(null, "preserveAspectRatio") &&  svg.setAttributeNS(null, "preserveAspectRatio", tari.getAttributeNS(null, "preserveAspectRatio"));
3892          svg._cacheScreenCTM = tn.multiply(svg.getScreenCTM());
3893       ti = tar.instanceRoot.firstChild;
3894       while (ti) {
3895         ta = ti.nextSibling;
3896         svg.appendChild(ti);
3897                ti.getScreenCTM && ti.getScreenCTM();
3898         ti = ta;
3899       }
3900       tar.appendChild(svg);
3901     } else {
3902       tar.appendChild(tar.instanceRoot);
3903     }
3904     evt = trans = tar = evtt = style = fontSize = svg = ti = ta = tn = void 0;
3905   }, false);
3906   SVGURIReference.apply(this);
3907   return this;
3908 };
3909 SVGUseElement.prototype = new SVGElement();
3910
3911 function SVGElementInstance() {
3912   /*EventTargetの代用として
3913    *Nodeオブジェクトを継承させる
3914    */
3915   Node.apply(this, arguments);
3916   /*readonly SVGElement*/ this.correspondingElement;       //use要素で使われる参照先の要素
3917   /*readonly SVGUseElement*/ this.correspondingUseElement; //参照先の要素にuse要素が含まれているとき、ここにuse要素を収納
3918   /*readonly SVGElementInstance*/ this.parentNode;
3919   /*readonly SVGElementInstanceList*/ this.childNodes;
3920   /*readonly SVGElementInstance*/ this.firstChild;
3921   /*readonly SVGElementInstance*/ this.lastChild;
3922   /*readonly SVGElementInstance*/ this.previousSibling;
3923   /*readonly SVGElementInstance*/ this.nextSibling;
3924   return this;
3925 };
3926 SVGElementInstance.prototype = new Node();
3927 /*SVGElementInstanceList
3928  */
3929 function SVGElementInstanceList() { 
3930   /*readonly unsigned long*/ this.length = 0;
3931   return this;
3932 };
3933 /*SVGElementInstance*/ SVGElementInstanceList.prototype.item = function(/*unsigned long*/ index ) {
3934   return (this[index]);
3935 }
3936 function SVGImageElement(_doc) {
3937   SVGElement.apply(this, arguments);
3938   this._tar = _doc.createElement("v:image");
3939   //以下は、与えられた属性の値に対応する
3940   var slen = SVGAnimatedLength;
3941   /*readonly SVGAnimatedLength*/ this.x = new slen();
3942   /*readonly SVGAnimatedLength*/ this.y = new slen();
3943   /*readonly SVGAnimatedLength*/ this.width = new slen();
3944   /*readonly SVGAnimatedLength*/ this.height = new slen();
3945   _doc = slen = void 0;
3946   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();
3947   this.addEventListener("DOMNodeInserted", function(evt){
3948     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
3949       return; //強制終了させる
3950     }
3951     var tar = evt.target;
3952     tar.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
3953     if (tar.nextSibling) {
3954       if (!!tar.parentNode._tar && !!tar.nextSibling._tar) {
3955         tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar);
3956       }
3957     } else if (!!tar.parentNode._tar){
3958       tar.parentNode._tar.appendChild(tar._tar);
3959     }
3960     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
3961       var tar = evt.target,
3962           style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
3963           fontSize = parseFloat(style.getPropertyValue("font-size")),
3964           ts = tar._tar.style,
3965           ctm = tar.getScreenCTM(),
3966           po = tar.ownerDocument.documentElement.createSVGPoint(),
3967           fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")),
3968           ttfia;
3969       tar.x.baseVal._emToUnit(fontSize);
3970       tar.y.baseVal._emToUnit(fontSize);
3971       tar.width.baseVal._emToUnit(fontSize);
3972       tar.height.baseVal._emToUnit(fontSize);
3973       ts.position = "absolute";
3974       po.x = tar.x.baseVal.value;
3975       po.y = tar.y.baseVal.value;
3976       po = po.matrixTransform(ctm);
3977       ts.left = po.x + "px";
3978       ts.top = po.y + "px";
3979       ts.width = tar.width.baseVal.value * ctm.a + "px";
3980       ts.height = tar.height.baseVal.value * ctm.d + "px";
3981       if (fillOpacity !== 1) {
3982         ts.filter = "progid:DXImageTransform.Microsoft.Alpha";
3983         ttfia = tar._tar.filters.item('DXImageTransform.Microsoft.Alpha');
3984         ttfia.Style = 0;
3985         ttfia.Opacity = fillOpacity * 100;
3986         ttfia = void 0;
3987       }
3988       evt = tar = style = fontSize = ts = ctm = po = fillOpacity = void 0;
3989     }, false);
3990     evt = tar = void 0;
3991   }, false);
3992   SVGURIReference.apply(this);
3993   return this;
3994 };
3995 SVGImageElement.prototype = new SVGElement();
3996
3997 function SVGSwitchElement() {
3998   SVGElement.apply(this, arguments);
3999   return this;
4000 };
4001 SVGSwitchElement.prototype = new SVGElement();
4002
4003 //bookmarkletから呼び出されたらtrue
4004 var sieb_s;
4005 function GetSVGDocument(ele) {
4006   this._tar = ele;
4007   this._next = null;
4008   return this;
4009 }
4010 function _ca_() {
4011   if ((NAIBU._that.xmlhttp.readyState === 4)  &&  (NAIBU._that.xmlhttp.status === 200)) {
4012     NAIBU._that._ca();
4013   }
4014 };
4015  GetSVGDocument.prototype = {
4016   /*_initメソッド
4017    *object(embed)要素で指定されたSVG文書を読み込んで、SVGを処理して表示させるメソッド
4018    */
4019   _init : function() {
4020     /*objeiはobject要素かembed要素*/
4021     var xmlhttp = NAIBU.xmlhttp,
4022         objei = this._tar,
4023         data;
4024     if (this._tar.nodeName === "OBJECT") {
4025       data = "data";
4026     } else {
4027       data = "src";
4028     }
4029     xmlhttp.open("GET", objei.getAttribute(data), true);
4030     objei.style.display = "none";
4031     xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
4032     this.xmlhttp = xmlhttp;
4033     /*クロージャを利用しないことで、軽量化を計る*/
4034     NAIBU._that = this;
4035     xmlhttp.onreadystatechange = _ca_;
4036     xmlhttp.send(null);
4037     xmlhttp = objei = data = void 0;
4038   },
4039   /*コール関数。全処理を担う*/
4040   _ca : function() {
4041     /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因はcontent-typeが"text/xml"など特定のものでないと受け付けないため)、
4042      *ここでは、responseTextを用いる
4043      */
4044     var ifr = this._tar.previousSibling,
4045         ifcw = ifr.contentWindow,
4046         _doc;
4047     if (ifcw) {
4048       ifr.contentWindow.screen.updateInterval = 999;
4049       _doc = ifr.contentWindow.document;
4050       _doc.write("");
4051       _doc.close(); // これがないと document.body は null になる
4052     } else {        //インラインSVGの場合
4053       _doc = document;
4054     }
4055     if (("namespaces" in _doc) && !_doc.namespaces["v"]) {
4056       _doc.namespaces.add("v","urn:schemas-microsoft-com:vml");
4057       _doc.namespaces.add("o","urn:schemas-microsoft-com:office:office");
4058       var st = _doc.createStyleSheet(),
4059           vmlUrl = "behavior: url(#default#VML);display: inline-block;} "; //inline-blockはIEのバグ対策
4060       st.cssText = "v\\:rect{" +vmlUrl+ "v\\:image{" +vmlUrl+ "v\\:fill{" +vmlUrl+ "v\\:stroke{" +vmlUrl+ "o\\:opacity2{" +vmlUrl
4061         + "dn\\:defs{display:none}"
4062         + "v\\:group{text-indent:0px;position:relative;width:100%;height:100%;" +vmlUrl
4063         + "v\\:shape{width:100%;height:100%;" +vmlUrl;
4064       st = vmlUrl = void 0;
4065     }
4066     DOMImplementation._doc_ = _doc; //_doc_プロパティはcreateDocumentメソッドで使う
4067     var str = this.xmlhttp.responseText,
4068         objei = this._tar,
4069         s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"),
4070         tar = s.documentElement,
4071         tview = tar.viewport,
4072         objw, objh, fi, n, attr, att, w, h,
4073         sdt = tar._tar,
4074         sp = _doc.createElement("div"),
4075         dcp = _doc.createElement("v:group"),
4076         backr = _doc.createElement("v:rect"),
4077         style, fontSize, sw, sh, trstyle, backrs, viewWidth, viewHeight, backdown, backright,
4078         bfl, bft, bl, text,
4079         _parseFloat = parseFloat,
4080         ndoc = NAIBU.doc || this.xmlhttp.responseXML,
4081           oba = _doc.createElement("div"); //obaはradialGradient要素で使う
4082     if (!ndoc) { //何らかの原因で読み込み失敗した場合、実行させないようにする
4083       this.xmlhttp.onreadystatechange = NAIBU.emptyFunction;
4084       return;
4085     }
4086     s._iframe = ifr;                     //_iframeプロパティはSVGAElementでリンク置換のときに扱う
4087     oba.setAttribute("id","_NAIBU_outline");
4088     _doc.body.appendChild(oba);
4089     sp.style.margin = "-1px,0px,0px,-1px"
4090     if (ifcw) {
4091        _doc.body.style.backgroundColor = objei.parentNode.currentStyle.backgroundColor;
4092     }
4093     ndoc.async = false;
4094     /*下記のプロパティについては、Microsoftのサイトを参照
4095      *ResolveExternals Property [Second-level DOM]
4096      * http://msdn.microsoft.com/en-us/library/ms761375%28VS.85%29.aspx
4097      *ValidateOnParse Property [Second-level DOM]
4098      * http://msdn.microsoft.com/en-us/library/ms760286%28VS.85%29.asp
4099      */
4100     ndoc.validateOnParse = false;
4101     ndoc.resolveExternals = false;
4102     ndoc.preserveWhiteSpace = true;
4103     ndoc.loadXML(str.replace(/^[\s\S]*?<svg/, "<svg")); //XML宣言のUTF-8は問題が起きるので削除
4104     /*IE6-8のみで使えるupdateIntervalは、
4105      *描画間隔の調整が可能。デフォルトは0。
4106      *スクロール時にバグが起きるので、0に戻してやる必要がある。
4107      */
4108     screen.updateInterval = 999;
4109     if (/&[^;]+;/.test(str)) {
4110       /*以下の処理は、実体参照を使ったとき
4111        *代替の処理を用いて、実体参照を処理するもの
4112        */
4113       var tmp = str;
4114       var enti = (ndoc.doctype)? ndoc.doctype.entities: { length:0 };
4115       for (var i=0; i<enti.length; i++) {
4116       var map = enti.item(i);
4117       var regex = new RegExp("&"+map.nodeName+";", "g");
4118       tmp = tmp.replace(regex, map.firstChild.xml);
4119       }
4120       ndoc.loadXML(tmp);
4121       tmp = void 0;
4122     }
4123     tview.top = 0;
4124     tview.left = 0;
4125     tview.width = objei.clientWidth;
4126     tview.height = objei.clientHeight;
4127     if (tview.height < 24) { //IEの標準モードではclientHeightプロパティの値が小さくなることがある
4128       tview.height = screen.availHeight;
4129     }
4130     if (tar.viewport.height < 24) { //IEの標準モードではclientHeightプロパティの値が小さくなることがある
4131       tar.viewport.height = screen.width;
4132     }
4133     objw = objei.getAttribute("width");
4134     objh = objei.getAttribute("height");
4135     if (objw) {
4136       tar.setAttributeNS(null, "width", objw);
4137     }
4138     if (objh) {
4139       tar.setAttributeNS(null, "height", objh);
4140     }
4141     fi = ndoc.documentElement.firstChild;
4142     attr = ndoc.documentElement.attributes;
4143     /*ルート要素のNamedNodeMapを検索する*/
4144     for (var i=0,atli=attr.length;i<atli;++i) {
4145       att = s.importNode(attr[i], false);
4146       tar.setAttributeNodeNS(att);
4147     }
4148     str = attr = void 0;
4149     dcp.style.width = tview.width+ "px";
4150     dcp.style.height = tview.height+ "px";
4151     dcp.coordsize = tview.width+ " " +tview.height;
4152     sp.appendChild(dcp);
4153     if (ifcw) {
4154       _doc.body.appendChild(sp);
4155     } else {
4156       this._tar.parentNode.insertBefore(sp, this._tar);
4157     }
4158     dcp.appendChild(sdt);
4159     while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する
4160       n = s.importNode(fi, true);
4161       tar.appendChild(n);
4162       fi = fi.nextSibling;
4163     }
4164     fi = void 0;
4165     /*dom/event.jsのaddEventListenerメソッドなどで、iframe要素のwindowオブジェクトを利用する必要があるため、
4166      *ドキュメントにそのオブジェクトを結び付けておく
4167      */
4168     s._window = ifcw;
4169     /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を
4170      *作り出す作業を行う。これは必須
4171      */
4172     style = tar.ownerDocument.defaultView.getComputedStyle(tar, "");
4173     fontSize = _parseFloat(style.getPropertyValue("font-size"));
4174     tar.x.baseVal._emToUnit(fontSize);
4175     tar.y.baseVal._emToUnit(fontSize);
4176     tar.width.baseVal._emToUnit(fontSize);
4177     tar.height.baseVal._emToUnit(fontSize);
4178     sw = tar.width.baseVal.value;
4179     sh = tar.height.baseVal.value;
4180     backr.style.position = "absolute";
4181     w = tview.width;
4182     h = tview.height;
4183     backr.style.width = w+ "px";
4184     backr.style.height = h+ "px";
4185     backr.style.zIndex = -1;
4186     backr.stroked = "false";
4187     backr.filled = "false";
4188     tar._tar.appendChild(backr);
4189     trstyle = tar._tar.style;
4190     trstyle.visibility = "visible";
4191     trstyle.position = "absolute";
4192     /*以下、画像を切り取り*/
4193     trstyle.overflow = "hidden";
4194     /*ウィンドウ枠の長さを決定する*/
4195     viewWidth = w > sw ? sw : w;
4196     viewHeight = h > sh ? sh : h;
4197     backrs = backr.currentStyle;
4198     bfl = _parseFloat(backrs.left);
4199     bft = _parseFloat(backrs.top);
4200     bl = -tar._tx;                  //blやbtは、ずれを調整するのに使う
4201     bt = -tar._ty;
4202     if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため)
4203       bl = bfl;
4204       dcp.style.left = -bl+ "px";
4205     }
4206     if (bft !== 0 && !isNaN(bfl)) {
4207       bt = bft;
4208       dcp.style.top = -bt+ "px";
4209     }
4210     backright = bl + viewWidth + 1;
4211     backdown = bt + viewHeight + 1;
4212     trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)";
4213     this._document = s;
4214     if ("_svgload_limited" in s.documentElement) {
4215       /*_svgload_limitedプロパティはXlink言語が使われていない限り、0である。
4216        *xlink:href属性が指定されるたびに+1となる。
4217        *0以外は、SVGLoadイベントが発火されない仕組みとなっている
4218        *
4219        *目的:
4220        * Xlinkのリンク先のソースを読み込むまで、SVGLoadイベントを発火させないため
4221        */
4222       s.documentElement._svgload_limited--;
4223       if (s.documentElement._svgload_limited < 0) {
4224         var evt = s.createEvent("SVGEvents");
4225         evt.initEvent("SVGLoad", false, false);
4226         s.documentElement.dispatchEvent(evt);
4227       }
4228     }
4229     //以下、テキストの位置を修正
4230     text = s.documentElement._tar.getElementsByTagName("div");
4231     for (var i=0, texti;text[i];++i) {
4232       texti = text[i];
4233       if (texti.firstChild.nodeName !== "shape") { //radialGradient用のdiv要素でないならば
4234         var tis = texti.style;
4235         tis.left = _parseFloat(tis.left) + bl + "px";
4236         tis.top = _parseFloat(tis.top) + bt + "px";
4237         tis = void 0;
4238       }
4239     }
4240     //ビューポートの位置をスクロールで調整 (なお、_txプロパティはSVGSVGElementのSIEコードを参照)
4241     ifcw && ifcw.scroll(-s.documentElement._tx, -s.documentElement._ty);
4242     s._isLoaded = 1;  //_isLoadedプロパティはevents::dispatchEventメソッドで使う
4243     s.defaultView._cache = s.defaultView._cache_ele = null;
4244     oba = _doc = evt = ndoc = objei = tar = tview = objw = objh = n = att = sdt = sp = dcp = backr = sw = sh = style = fontSize = void 0;
4245     trstyle = backrs = text = texti = i = bfl = bft = bl = bt = text = _parseFloat = w = h = viewWidth = viewHeight = backdown = backright = void 0;
4246     /*IEのメモリリーク対策として、空関数を入力*/
4247     this.xmlhttp.onreadystatechange = NAIBU.emptyFunction;
4248     if (this._next) {
4249       ifcw && (ifr.contentWindow.screen.updateInterval = 0);
4250       ifr = ifcw = s = void 0;
4251       this._next._init();
4252     } else {
4253       /*全要素の読み込みが終了した場合*/
4254       if (s.implementation._buffer_) {
4255         screen.updateInterval = 0;
4256         /*以下はバッファリングにためておいた要素とイベントを、後から実行する*/
4257         NAIBU._buff_num = 0;
4258         NAIBU._buff = setInterval(function(){
4259           var n = NAIBU._buff_num,
4260               dbuf = DOMImplementation._buffer_,
4261               dbufli = dbuf ? dbuf.length : 0, //極端な負荷がかかると、dbufはnullになる可能性あり
4262               s, evt;
4263           if (dbufli === 0) {
4264             clearInterval(NAIBU._buff);              
4265           } else {
4266             for (var i=0;i<50;++i) {
4267               s = dbuf[n];
4268               evt = dbuf[n+1];
4269               s.dispatchEvent(evt);
4270               n += 2;
4271               s = evt = void 0;
4272               if (n >= dbufli) {
4273                 clearInterval(NAIBU._buff);
4274                 DOMImplementation._buffer_ = null;
4275                 NAIBU.Time.start();
4276                 dbuf = n = dbufli = void 0;
4277                 return;
4278               }
4279             }
4280             NAIBU._buff_num = n;
4281           }
4282           dbuf = n = dbufli = void 0;
4283         }, 1);
4284         ifr = ifcw = s = void 0;
4285       } else {
4286         ifr = ifcw = s = void 0;
4287         NAIBU.Time.start();
4288       }
4289       delete NAIBU.doc;
4290     }
4291   },
4292   /*SVGDocument*/  getSVGDocument : function() {
4293     return (this._document);
4294   }
4295 };
4296 /*空関数(IEのメモリリーク対策)*/
4297 NAIBU.emptyFunction = function() {};
4298
4299 /*SVGStyleElement
4300  *style要素をあらわすオブジェクト
4301  */
4302 function SVGStyleElement(_doc) {
4303   SVGElement.apply(this);
4304   LinkStyle.apply(this);
4305   /*LinkStyleに関しては、以下の仕様を参照のこと。なお、これはSVG DOMでは継承されていないので要注意。
4306    *CSS2 1. Document Object Model Style Sheets
4307    * 1.3. Document Extensions
4308    *   Interface LinkStyle (introduced in DOM Level 2)
4309    * http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-LinkStyle
4310    */
4311   /*以下はそれぞれ、属性の値に対応している*/
4312   /*DOMString*/ this.xmlspace;
4313   /*DOMString*/ this.type = "text/css";
4314   /*DOMString*/ this.media;
4315   /*DOMString*/ this.title;
4316   SVGURIReference.apply(this);
4317   this.addEventListener("DOMAttrModified", function(evt){
4318     if (evt.attrName === "type") {
4319       evt.target.type = evt.newValue;
4320     } else if (evt.attrName === "title") {
4321       evt.target.title = evt.newValue;
4322     }
4323     evt = void 0;
4324   }, false);
4325   this.addEventListener("S_Load", function(evt){
4326     var tar = evt.target,
4327         sheet = tar.sheet,
4328         styleText = tar._text,
4329         tod = tar.ownerDocument,
4330         style = _doc.createElement("style"),
4331         ri, rsc, scri, rsi;
4332     NAIBU._temp_doc = tod;
4333     sheet = tod.styleSheets[tod.styleSheets.length] = DOMImplementation.createCSSStyleSheet(tar.title, tar.media);
4334     sheet.ownerNode = tar;
4335     /*以下は、IEのCSSパーサを使って、スタイルシートのルールを実装していく*/
4336     _doc.documentElement.firstChild.appendChild(style);
4337     style.styleSheet.cssText = styleText;
4338     for (var i=0, rules=style.styleSheet.rules, rli=rules.length;i<rli;++i) {
4339       ri = rules[i];
4340       scri = new CSSStyleRule();
4341       scri.selectorText = ri.selectorText;
4342       scri.style.cssText = ri.style.cssText;
4343       rsc = scri.style.cssText.split(";");
4344       for (var j=0, rsli=rsc.length;j<rsli;++j) {
4345         rsi = rsc[j].split(": ");
4346         scri.style.setProperty(rsi[0], rsi[1]);
4347       }
4348       sheet.cssRules[sheet.cssRules.length] = scri;
4349     }
4350     tod.documentElement.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
4351       var tar = evt.target,
4352           doc = tar.ownerDocument,
4353           rules = doc.styleSheets[0] ? doc.styleSheets[0].cssRules : [],
4354           selector, ru, tcb = tar.className.baseVal || ".,.";
4355       for (var i=0, rli=rules.length;i<rli;++i) {
4356         selector = rules[i].selectorText;
4357         /*_rulesプロパティはCSSモジュールのgetCoumputedStyleメソッドで使う*/
4358         ru = tar._rules || [];
4359         if ((selector.indexOf("." +tcb) > -1) || (selector.indexOf("#" +tar.id) > -1)
4360             || (tar.nodeName === selector)) {
4361           ru[ru.length] = rules[i];
4362         }
4363         tar._rules = ru;
4364       }
4365       tar = doc = rules = void 0;
4366     }, true);
4367     tar = evt = style = sheet = styleText = tod = i = rules = rli = void 0;
4368   }, false);
4369   this.addEventListener("DOMNodeInserted", function(evt){
4370     var tar = evt.target;
4371     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
4372       if (tar.nodeName === "#cdata-section") {
4373         evt.currentTarget._text = tar.data;
4374       }
4375       return;
4376     }
4377     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
4378       var tar = evt.target;
4379       if ((evt.eventPhase === Event.AT_TARGET) && !tar.getAttributeNodeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
4380         var evtt = tar.ownerDocument.createEvent("SVGEvents");
4381         evtt.initEvent("S_Load", false, false);
4382         evt.currentTarget.dispatchEvent(evtt);
4383       }
4384       tar = evt = void 0;
4385     }, false);
4386   }, false);
4387   return this;
4388 };
4389 SVGStyleElement.prototype = new SVGElement();
4390
4391 /*SVGPoint
4392  *2次元座標の点(x,y)を表すオブジェクト
4393  */
4394 function SVGPoint() { 
4395   return this;
4396 };
4397 /*float*/SVGPoint.prototype.x = SVGPoint.prototype.y = 0;
4398 SVGPoint.prototype.matrixTransform = function(/*SVGMatrix*/ matrix ) {
4399   if (!isFinite(matrix.a) || !isFinite(matrix.b) || !isFinite(matrix.c) || !isFinite(matrix.d) || !isFinite(matrix.e) || !isFinite(matrix.f)) {
4400     throw (new Error("Type Error: 引数の値がNumber型ではありません"));
4401   }
4402   var s = new SVGPoint();
4403   s.x = matrix.a * this.x + matrix.c * this.y + matrix.e;
4404   s.y = matrix.b * this.x + matrix.d * this.y + matrix.f;
4405   return s;
4406 };
4407
4408 function SVGPointList() { 
4409   return this;
4410 };
4411 /*SVGPointListのメソッドはSVGPathSegListを参照*/
4412
4413 /*SVGMatrix
4414  *行列をあらわすオブジェクト。写像に用いる。以下のように表現できる
4415  *[a c e]
4416  *[b d f]
4417  *[0 0 1]
4418  */
4419 function SVGMatrix() { 
4420   return this;
4421 };
4422 SVGMatrix.prototype = {
4423   /*float*/ a : 1,
4424   /*float*/ b : 0,
4425   /*float*/ c : 0,
4426   /*float*/ d : 1,
4427   /*float*/ e : 0,
4428   /*float*/ f : 0,
4429   /*multiplyメソッド
4430    *行列の積を求めて返す
4431    */
4432   /*SVGMatrix*/ multiply : function(/*SVGMatrix*/ secondMatrix ) {
4433     var s = new SVGMatrix(), m = secondMatrix;
4434     if (!isFinite(m.a) || !isFinite(m.b) || !isFinite(m.c) || !isFinite(m.d) || !isFinite(m.e) || !isFinite(m.f)) {
4435       throw (new Error("Type Error: 引数の値がNumber型ではありません"));
4436     }
4437     s.a = this.a * m.a + this.c * m.b;
4438     s.b = this.b * m.a + this.d * m.b;
4439     s.c = this.a * m.c + this.c * m.d;
4440     s.d = this.b * m.c + this.d * m.d;
4441     s.e = this.a * m.e + this.c * m.f + this.e;
4442     s.f = this.b * m.e + this.d * m.f + this.f;
4443     m = secondMatrix = void 0;
4444     return s;
4445   },
4446   /*inverseメソッド
4447    *逆行列を返す
4448    */
4449   /*SVGMatrix*/ inverse : function() {
4450     var s = new SVGMatrix(), n = this._determinant();
4451     if (n !== 0) {
4452       s.a = this.d / n;
4453       s.b = -this.b / n;
4454       s.c = -this.c / n;
4455       s.d = this.a / n;
4456       s.e = (this.c * this.f - this.d * this.e) / n;
4457       s.f = (this.b * this.e - this.a * this.f) / n;
4458       return s;
4459     } else {
4460       throw (new SVGException(SVGException.SVG_MATRIX_NOT_INVERTABLE));
4461     }
4462   },
4463   /*SVGMatrix*/ translate : function(/*float*/ x, /*float*/ y ) {
4464     var m = new SVGMatrix();
4465     m.e = x;
4466     m.f = y;
4467     var s =  this.multiply(m);
4468     m = void 0;
4469     return s;
4470   },
4471   /*SVGMatrix*/ scale : function(/*float*/ scaleFactor ) {
4472     var m = new SVGMatrix();
4473     m.a = scaleFactor;
4474     m.d = scaleFactor;
4475     var s =  this.multiply(m);
4476     m = void 0;
4477     return s;
4478   },
4479   /*SVGMatrix*/ scaleNonUniform : function(/*float*/ scaleFactorX, /*float*/ scaleFactorY ) {
4480     var m = new SVGMatrix();
4481     m.a = scaleFactorX;
4482     m.d = scaleFactorY;
4483     var s =  this.multiply(m);
4484     m = void 0;
4485     return s;
4486   },
4487   /*SVGMatrix*/ rotate : function(/*float*/ angle ) {
4488     var m = new SVGMatrix(), rad = angle / 180 * Math.PI; //ラジアン変換
4489     m.a = Math.cos(rad);
4490     m.b = Math.sin(rad);
4491     m.c = -m.b;
4492     m.d = m.a;
4493     var s =  this.multiply(m);
4494     m = rad = void 0;
4495     return s;
4496   },
4497   //座標(x, y)と原点の角度の分だけ、回転する
4498   /*SVGMatrix*/ rotateFromVector : function(/*float*/ x, /*float*/ y ) {
4499     if ((x === 0) || (y === 0) || !isFinite(x) || !isFinite(y)) {
4500       throw (new SVGException(SVGException.SVG_INVALID_VALUE_ERR))
4501     }
4502     var m = new SVGMatrix(), rad = Math.atan2(y, x);
4503     m.a = Math.cos(rad);
4504     m.b = Math.sin(rad);
4505     m.c = -m.b;
4506     m.d = m.a;
4507     var s =  this.multiply(m);
4508     m = rad = void 0;
4509     return s;
4510   },
4511   /*SVGMatrix*/ flipX : function() {
4512     var m = new SVGMatrix();
4513     m.a = -m.a;
4514     var s =  this.multiply(m);
4515     m = void 0;
4516     return s;
4517   },
4518   /*SVGMatrix*/ flipY : function() {
4519     var m = new SVGMatrix();
4520     m.d = -m.d;
4521     var s =  this.multiply(m);
4522     m = void 0;
4523     return s;
4524   },
4525   /*SVGMatrix*/ skewX : function(/*float*/ angle ){
4526     var m = new SVGMatrix(), rad = angle / 180 * Math.PI; //ラジアン変換
4527     m.c = Math.tan(rad);
4528     var s =  this.multiply(m);
4529     m = void 0;
4530     return s;
4531   },
4532   /*SVGMatrix*/ skewY : function(/*float*/ angle ){
4533     var m = new SVGMatrix(), rad = angle / 180 * Math.PI;
4534     m.b = Math.tan(rad);
4535     var s =  this.multiply(m);
4536     m = void 0;
4537     return s;
4538   },
4539   //行列式
4540   /*float*/ _determinant : function() {
4541     return (this.a * this.d - this.b * this.c);
4542   }
4543 };
4544
4545 function SVGTransform() { 
4546   /*readonly SVGMatrix*/ this.matrix = new SVGMatrix();
4547   return this;
4548 };
4549     // Transform Types
4550   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_UNKNOWN   = 0;
4551   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_MATRIX    = 1;
4552   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_TRANSLATE = 2;
4553   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_SCALE     = 3;
4554   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_ROTATE    = 4;
4555   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_SKEWX     = 5;
4556   /*unsigned short*/ SVGTransform.SVG_TRANSFORM_SKEWY     = 6;
4557 SVGTransform.prototype = {
4558   /*ダミーの単位行列。各メソッドで使う*/
4559   _matrix : (new SVGMatrix()),
4560   /*readonly unsigned short*/ type : SVGTransform.SVG_TRANSFORM_UNKNOWN,
4561   /*readonly float*/ angle : 0,
4562   /*void*/ setMatrix : function(/*SVGMatrix*/ matrix ) {
4563     this.type = /*SVGTransform.SVG_TRANSFORM_MATRIX*/ 1;
4564     this.matrix = this._matrix.multiply(matrix);
4565   },
4566   /*void*/ setTranslate : function(/*float*/ tx, /*float*/ ty ) {
4567     this.type = /*SVGTransform.SVG_TRANSFORM_TRANSLATE*/ 2;
4568     this.matrix = this._matrix.translate(tx, ty);
4569   },
4570   /*void*/ setScale : function(/*float*/ sx, /*float*/ sy ) {
4571     this.type = /*SVGTransform.SVG_TRANSFORM_SCALE*/ 3;
4572     this.matrix = this._matrix.scaleNonUniform(sx, sy);
4573   },
4574   /*void*/ setRotate : function(/*float*/ angle, /*float*/ cx, /*float*/ cy ) {
4575     this.angle = angle;
4576     this.type = /*SVGTransform.SVG_TRANSFORM_ROTATE*/ 4;
4577     this.matrix = this._matrix.rotate(angle);
4578     this.matrix.e = (1-this.matrix.a)*cx - this.matrix.c*cy;
4579     this.matrix.f = -this.matrix.b*cx + (1-this.matrix.d)*cy;
4580   },
4581   /*void*/ setSkewX : function(/*float*/ angle ) {
4582     this.angle = angle;
4583     this.type = /*SVGTransform.SVG_TRANSFORM_SKEWX*/ 5;
4584     this.matrix = this._matrix.skewX(angle);
4585   },
4586   /*void*/ setSkewY : function(/*float*/ angle ) {
4587     this.angle = angle;
4588     this.type = /*SVGTransform.SVG_TRANSFORM_SKEWY*/ 6;
4589     this.matrix = this._matrix.skewY(angle);
4590   }
4591 };
4592
4593 function SVGTransformList() { 
4594   return this;
4595 };
4596 /*SVGTransformListのメソッドはSVGPathSegListを参照*/
4597
4598 /*SVGTransform*/ SVGTransformList.prototype.createSVGTransformFromMatrix = function(/*SVGMatrix*/ matrix ) {
4599   var t = new SVGTransform();
4600   t.setMatrix(matrix);
4601   return t;
4602 }
4603 /*SVGTransform*/ SVGTransformList.prototype.consolidate = function() {
4604   if(this.numberOfItems === 0) {
4605     return null;
4606   } else {
4607     var s = this.getItem(0), m = s.matrix;
4608     for (var i=1,nli=this.numberOfItems;i<nli;++i) {
4609       m = m.multiply(this.getItem(i).matrix);
4610     }
4611     s.setMatrix(m);
4612     this.initialize(s);
4613     return s;
4614   }
4615 }
4616
4617 function SVGAnimatedTransformList() { 
4618   /*readonly SVGTransformList*/ this.animVal = this.baseVal = new SVGTransformList();
4619   return this;
4620 };
4621 function SVGPreserveAspectRatio() { 
4622   /*unsigned short*/ this.align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
4623   /*unsigned short*/ this.meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
4624   return this;
4625 };
4626 (function(t) {
4627     // Alignment Types
4628   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_UNKNOWN  = 0;
4629   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_NONE     = 1;
4630   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMINYMIN = 2;
4631   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3;
4632   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4;
4633   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMINYMID = 5;
4634   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMIDYMID = 6;
4635   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMAXYMID = 7;
4636   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMINYMAX = 8;
4637   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9;
4638   /*unsigned short*/ t.SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10;
4639     // Meet-or-slice Types
4640   /*unsigned short*/ t.SVG_MEETORSLICE_UNKNOWN   = 0;
4641   /*unsigned short*/ t.SVG_MEETORSLICE_MEET  = 1;
4642   /*unsigned short*/ t.SVG_MEETORSLICE_SLICE = 2;
4643 })(SVGPreserveAspectRatio);
4644
4645 function SVGAnimatedPreserveAspectRatio() { 
4646   /*readonly SVGPreserveAspectRatio*/ this.animVal = this.baseVal = new SVGPreserveAspectRatio();
4647   return this;
4648 };
4649
4650 function SVGPathSeg() { 
4651   /*readonly unsigned short*/ this.pathSegType = SVGPathSeg.PATHSEG_UNKNOWN;
4652   /*readonly DOMString*/      this.pathSegTypeAsLetter = null;
4653   return this;
4654 };
4655
4656 (function(t) {
4657     // Path Segment Types
4658   /*unsigned short*/ t.PATHSEG_UNKNOWN                      = 0;
4659   /*unsigned short*/ t.PATHSEG_CLOSEPATH                    = 1;
4660   /*unsigned short*/ t.PATHSEG_MOVETO_ABS                   = 2;
4661   /*unsigned short*/ t.PATHSEG_MOVETO_REL                   = 3;
4662   /*unsigned short*/ t.PATHSEG_LINETO_ABS                   = 4;
4663   /*unsigned short*/ t.PATHSEG_LINETO_REL                   = 5;
4664   /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_ABS            = 6;
4665   /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_REL            = 7;
4666   /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_ABS        = 8;
4667   /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_REL        = 9;
4668   /*unsigned short*/ t.PATHSEG_ARC_ABS                      = 10;
4669   /*unsigned short*/ t.PATHSEG_ARC_REL                      = 11;
4670   /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_ABS        = 12;
4671   /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_REL        = 13;
4672   /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_ABS          = 14;
4673   /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_REL          = 15;
4674   /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS     = 16;
4675   /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_REL     = 17;
4676   /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
4677   /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
4678 })(SVGPathSeg);
4679 /*SVGPathSegxx
4680  *軽量化のために、SVGPathSegの継承をしない。また、{}オブジェクトで代用する予定
4681  */
4682 function SVGPathSegClosePath() {
4683   return this;
4684 };
4685 SVGPathSegClosePath.prototype = {
4686   pathSegType : SVGPathSeg.PATHSEG_CLOSEPATH,
4687   pathSegTypeAsLetter : "z"
4688 };
4689 function SVGPathSegMovetoAbs() { 
4690   /*float* this.x;
4691   /*float* this.y;*/
4692   return this;
4693 };
4694 SVGPathSegMovetoAbs.prototype = {
4695   pathSegType : SVGPathSeg.PATHSEG_MOVETO_ABS,
4696   pathSegTypeAsLetter : "M"
4697 };
4698 function SVGPathSegMovetoRel() { 
4699   /*float*/ this.x;
4700   /*float*/ this.y;
4701   return this;
4702 };
4703 SVGPathSegMovetoRel.prototype = {
4704   pathSegType : SVGPathSeg.PATHSEG_MOVETO_REL,
4705   pathSegTypeAsLetter : "m"
4706 };
4707 function SVGPathSegLinetoAbs() { 
4708   /*float* this.x;
4709   /*float* this.y;*/
4710   return this;
4711 };
4712 SVGPathSegLinetoAbs.prototype = {
4713   pathSegType : SVGPathSeg.PATHSEG_LINETO_ABS,
4714   pathSegTypeAsLetter : "L"
4715 };
4716 function SVGPathSegLinetoRel() { 
4717   /*float*/ this.x;
4718   /*float*/ this.y;
4719   return this;
4720 };
4721 SVGPathSegLinetoRel.prototype = {
4722   pathSegType : SVGPathSeg.PATHSEG_LINETO_REL,
4723   pathSegTypeAsLetter : "l"
4724 };
4725 function SVGPathSegCurvetoCubicAbs() { 
4726   /*float* this.x;
4727   /*float* this.y;
4728   /*float* this.x1;
4729   /*float* this.y1;
4730   /*float* this.x2;
4731   /*float* this.y2;*/
4732   return this;
4733 };
4734 SVGPathSegCurvetoCubicAbs.prototype = {
4735   pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,
4736   pathSegTypeAsLetter : "C"
4737 };
4738 function SVGPathSegCurvetoCubicRel() { 
4739   /*float* this.x;
4740   /*float* this.y;
4741   /*float* this.x1;
4742   /*float* this.y1;
4743   /*float* this.x2;
4744   /*float* this.y2;*/
4745   return this;
4746 };
4747 SVGPathSegCurvetoCubicRel.prototype = {
4748   pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,
4749   pathSegTypeAsLetter : "c"
4750 };
4751 function SVGPathSegCurvetoQuadraticAbs() { 
4752   /*float*/ this.x;
4753   /*float*/ this.y;
4754   /*float*/ this.x1;
4755   /*float*/ this.y1;
4756   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;
4757   this.pathSegTypeAsLetter = "Q";
4758   return this;
4759 };
4760 function SVGPathSegCurvetoQuadraticRel() { 
4761   /*float*/ this.x;
4762   /*float*/ this.y;
4763   /*float*/ this.x1;
4764   /*float*/ this.y1;
4765   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;
4766   this.pathSegTypeAsLetter = "q";
4767   return this;
4768 };
4769
4770 function SVGPathSegArcAbs() { 
4771   /*float*/ this.x;
4772   /*float*/ this.y;
4773   /*float*/ this.r1;
4774   /*float*/ this.r2;
4775   /*float*/ this.angle;
4776   return this;
4777 };
4778 SVGPathSegArcAbs.prototype = {
4779   /*boolean*/ largeArcFlag : true,
4780   /*boolean*/ sweepFlag : true,
4781   pathSegType : SVGPathSeg.PATHSEG_ARC_ABS,
4782   pathSegTypeAsLetter : "A"
4783 };
4784 function SVGPathSegArcRel() { 
4785   /*float*/ this.x;
4786   /*float*/ this.y;
4787   /*float*/ this.r1;
4788   /*float*/ this.r2;
4789   /*float*/ this.angle;
4790   return this;
4791 };
4792 SVGPathSegArcRel.prototype = {
4793   /*boolean*/ largeArcFlag : true,
4794   /*boolean*/ sweepFlag : true,
4795   pathSegType : SVGPathSeg.PATHSEG_ARC_REL,
4796   pathSegTypeAsLetter : "a"
4797 };
4798 function SVGPathSegLinetoHorizontalAbs() { 
4799   /*float*/ this.x;
4800   this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;
4801   this.pathSegTypeAsLetter = "H";
4802   return this;
4803 };
4804 function SVGPathSegLinetoHorizontalRel() { 
4805   /*float*/ this.x;
4806   this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;
4807   this.pathSegTypeAsLetter = "h";
4808   return this;
4809 };
4810 function SVGPathSegLinetoVerticalAbs() { 
4811   /*float*/ this.y;
4812   this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;
4813   this.pathSegTypeAsLetter = "V";
4814   return this;
4815 };
4816 function SVGPathSegLinetoVerticalRel() { 
4817   /*float*/ this.y;
4818   this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;
4819   this.pathSegTypeAsLetter = "v";
4820   return this;
4821 };
4822 function SVGPathSegCurvetoCubicSmoothAbs() { 
4823   /*float*/ this.x;
4824   /*float*/ this.y;
4825   /*float*/ this.x2;
4826   /*float*/ this.y2;
4827   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
4828   this.pathSegTypeAsLetter = "S";
4829   return this;
4830 };
4831 function SVGPathSegCurvetoCubicSmoothRel() {
4832   /*float*/ this.x;
4833   /*float*/ this.y;
4834   /*float*/ this.x2;
4835   /*float*/ this.y2;
4836   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
4837   this.pathSegTypeAsLetter = "s";
4838   return this;
4839 };
4840 function SVGPathSegCurvetoQuadraticSmoothAbs() {
4841   /*float*/ this.x;
4842   /*float*/ this.y;
4843   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
4844   this.pathSegTypeAsLetter = "T";
4845   return this;
4846 };
4847 function SVGPathSegCurvetoQuadraticSmoothRel() {
4848   /*float*/ this.x;
4849   /*float*/ this.y;
4850   this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
4851   this.pathSegTypeAsLetter = "t";
4852   return this;
4853 };
4854 function SVGPathSegList() {
4855   return this;
4856 };
4857 for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う
4858   SVGNumberList.prototype[prop] = SVGLengthList.prototype[prop] = SVGPointList.prototype[prop] = SVGTransformList.prototype[prop] = SVGPathSegList.prototype[prop] = SVGStringList.prototype[prop];
4859 };
4860 prop = void 0;
4861
4862 /*documentは引数の変数として登録しておく*/
4863 (function(_doc, _math) {
4864 //freeArg関数はunloadで使う解放処理
4865 NAIBU.freeArg = function() {
4866   SVGPathElement = _doc = _math = void 0;
4867 };
4868 //仮のfill属性とstroke属性の処理
4869 NAIBU._setPaint = function(tar, matrix) {
4870   /*以下では、スタイルシートを用いて、fill-とstroke-関連の
4871    *処理を行う。SVGPaintインターフェースをも用いる
4872    */
4873   var tod = tar.ownerDocument,
4874       _doc = tod._document_,
4875       el = tar._tar,
4876       style = tod.defaultView.getComputedStyle(tar, ""),
4877       fill = style.getPropertyCSSValue("fill"),
4878       stroke = style.getPropertyCSSValue("stroke"),
4879       fp = fill.paintType,
4880       sp = stroke.paintType,
4881       fillElement, fc,
4882       num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1,
4883       t, evtt, fillOpacity, strs, cursor, vis, disp,
4884       strokeElement, strokeOpacity, tgebtstroke, sgsw, w, h, swx, tsd, strokedasharray;
4885   if (!el) {
4886     return;
4887   }
4888   /*あらかじめ、v:fill要素とv:stroke要素は消しておく*/
4889   while (el.firstChild) {
4890     el.removeChild(el.firstChild);
4891   }
4892   if ((fp === /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1) || (fp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
4893     if (fp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
4894       /*再度、設定。css.jsのsetPropertyを参照*/
4895       style.setProperty("color", style.getPropertyValue("color"));
4896     }
4897     fillElement = _doc.createElement("v:fill");
4898     fc = fill.rgbColor;
4899     num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
4900     fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
4901     fillOpacity = +(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
4902     if (fillOpacity < 1) {
4903       fillElement.setAttribute("opacity", fillOpacity+"");
4904     }
4905     el.appendChild(fillElement);
4906     fillElement = fc = fillOpacity = void 0;
4907   } else if (fill.uri) {
4908     /*以下では、Gradation関連の要素に、イベントを渡すことで、
4909      *この要素の、グラデーション描画を行う
4910      */
4911     t = tod.getElementById(fill.uri);
4912     if (t) {
4913       evtt = tod._domnodeEvent();
4914       evtt._tar = _doc.createElement("v:fill");
4915       evtt._style = style;
4916       evtt._ttar = tar;
4917       t.dispatchEvent(evtt);
4918       if (t.localName !== "radialGradient") {
4919         el.appendChild(evtt._tar);
4920       }
4921       t = evtt = void 0;
4922     }
4923   } else {
4924     el.filled = "false";
4925   }
4926   if ((sp === /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1) || (sp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
4927     if (sp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
4928       /*再度、設定。css.jsのsetPropertyを参照*/
4929       style.setProperty("color", style.getPropertyValue("color"));
4930     }
4931     strokeElement = _doc.createElement("v:stroke");
4932     sgsw = style.getPropertyCSSValue("stroke-width");
4933     w = tod.documentElement.viewport.width;
4934     h = tod.documentElement.viewport.height;
4935     sgsw._percent = _math.sqrt((w*w + h*h) / 2);
4936     swx = sgsw.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) * _math.sqrt(_math.abs(matrix._determinant()));
4937     strokeElement.setAttribute("weight", swx + "px");
4938     sgsw = w = h = void 0;
4939     if (!stroke.uri) {
4940       fc = stroke.rgbColor;
4941       strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
4942       strokeOpacity = +(style.getPropertyValue("stroke-opacity")) * (+(style.getPropertyValue("opacity"))); //opacityを掛け合わせる
4943       if (swx < 1) {
4944         strokeOpacity *= swx; //太さが1px未満なら色を薄くする
4945       }
4946       if (strokeOpacity < 1) {
4947         strokeElement.setAttribute("opacity", strokeOpacity+"");
4948       }
4949       fc = strokeOpacity = void 0;
4950     }
4951     strokeElement.setAttribute("miterlimit", style.getPropertyValue("stroke-miterlimit"));
4952     strokeElement.setAttribute("joinstyle", style.getPropertyValue("stroke-linejoin"));
4953     if (style.getPropertyValue("stroke-linecap") === "butt") {
4954       strokeElement.setAttribute("endcap", "flat");
4955     } else {
4956       strokeElement.setAttribute("endcap", style.getPropertyValue("stroke-linecap"));
4957     }
4958     tsd = style.getPropertyValue("stroke-dasharray");
4959     if (tsd !== "none") {
4960       if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
4961         strs = tsd.split(",");
4962         for (var i = 0, sli = strs.length; i < sli; ++i) {
4963           strs[i] = _math.ceil(+(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
4964         }
4965         strokedasharray = strs.join(" ");
4966         if (strs.length % 2 === 1) {
4967           strokedasharray += " " + strokedasharray;
4968         }
4969       }
4970       strokeElement.setAttribute("dashstyle", strokedasharray);
4971       tsd = strs = void 0;
4972     }
4973     el.appendChild(strokeElement);
4974     strokeElement = tsd = void 0;
4975   } else {
4976     el.stroked = "false";
4977   }
4978   cursor = style.getPropertyCSSValue("cursor");
4979   if (cursor && !cursor._isDefault) { //初期値でないならば
4980     el.style.cursor = cursor.cssText.split(":")[1];
4981   }
4982   vis = style.getPropertyCSSValue("visibility");
4983   if (vis && !vis._isDefault) {
4984     el.style.visibility = vis.cssText.split(":")[1];
4985   }
4986   disp = style.getPropertyCSSValue("display");
4987   if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) {
4988     el.style.display = "none";
4989    } else if (disp && !disp._isDefault && (disp.indexOf("inline-block") === -1)) {
4990     el.style.display = "inline-block";
4991   }
4992   tod = _doc = el = fill = stroke = sp = fp = style = cursor = tar = matrix = vis = disp = num = void 0;
4993 };
4994
4995 function SVGPathElement(_doc) {
4996   SVGElement.apply(this);
4997   this._tar = _doc.createElement("v:shape");
4998   //interface SVGAnimatedPathData
4999   var sp = SVGPathSegList;
5000   /*readonly SVGPathSegList*/ this.pathSegList = new sp();
5001   this.animatedPathSegList = this.pathSegList;
5002   /*readonly SVGPathSegList*/ this.normalizedPathSegList = new sp();
5003   sp = _doc = void 0;
5004   this.animatedNormalizedPathSegList = this.normalizedPathSegList;
5005   /*readonly SVGAnimatedNumber*/ this.pathLength = new SVGAnimatedNumber();
5006   //以下は、d属性に変更があった場合の処理
5007   this.addEventListener("DOMAttrModified", this._attrModi, false);
5008   /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、
5009    *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。
5010    */
5011   this.addEventListener("DOMNodeInserted", this._nodeInsert, false);
5012   return this;
5013 };
5014 SVGPathElement.prototype = new SVGElement();
5015 (function(_sproto) {
5016 _sproto._attrModi = function(evt){
5017   var tar = evt.target;
5018   if (evt.attrName === "d" && evt.newValue !== ""){
5019     /* d属性の値が空の場合は、描画を行わないようにする
5020      * 
5021      *SVG1.1 「8.3.9 The grammar for path data」の項目にある最後の文章を参照
5022      */
5023     var tnl = tar.normalizedPathSegList,
5024         tlist = tar.pathSegList;
5025     if (tnl.numberOfItems > 0) {
5026       tnl.clear();
5027       tlist.clear();
5028     }
5029     /*d属性の値を正規表現を用いて、二次元配列Dに変換している。もし、d属性の値が"M 20 30 L20 40"ならば、
5030      *JSONにおける表現は以下のとおり
5031      *D = [["M", 20, 30], ["L", 20 40]]
5032      */
5033     var taco = tar._com,
5034         sgs = taco.isSp,
5035         dd = evt.newValue
5036     .replace(taco.isRa, " -")
5037     .replace(taco.isRb, " ")
5038     .replace(taco.isRc, ",$1 ")
5039     .replace(taco.isRd, ",$1 1")
5040     .replace(taco.isRe, "")
5041     .split(","),
5042         dli=dd.length,
5043         isZ = taco._isZ,
5044         isM = taco._isM,
5045         isC = taco._isC,
5046         isL = taco._isL,
5047         tcc = tar.createSVGPathSegCurvetoCubicAbs,
5048         tcll = tar.createSVGPathSegLinetoAbs;
5049     for (var i=0;i<dli;++i) {
5050       var di = dd[i].match(sgs),
5051           s;
5052       for (var j=1, dii=di[0], dili=di.length; j < dili; ++j) {
5053         if (isC[dii]) {
5054           s = tcc(+di[j+4], +di[j+5], +di[j], +di[j+1], +di[j+2], +di[j+3]);
5055           j += 5;
5056         } else if (isL[dii]) {
5057           s = tcll(+di[j], +di[j+1]);
5058           ++j;
5059         } else if (isM[dii]) {
5060           s = tar.createSVGPathSegMovetoAbs(+di[j], +di[j+1]);
5061           ++j;
5062         } else if (isZ[dii]) {
5063           s = tar.createSVGPathSegClosePath();
5064         } else if (dii === "A") {
5065           s = tar.createSVGPathSegArcAbs(+di[j+5], +di[j+6], +di[j], +di[j+1], +di[j+2], +di[j+3], +di[j+4]);
5066           j += 6;
5067         } else if (dii === "m") {
5068           s = tar.createSVGPathSegMovetoRel(+di[j], +di[j+1]);
5069           ++j;
5070         } else if (dii === "l") {
5071           s = tar.createSVGPathSegLinetoRel(+di[j], +di[j+1]);
5072           ++j;
5073         } else if (dii === "c") {
5074           s = tar.createSVGPathSegCurvetoCubicRel(+di[j+4], +di[j+5], +di[j], +di[j+1], +di[j+2], +di[j+3]);
5075           j += 5;
5076         } else if (dii === "Q") {
5077           s = tar.createSVGPathSegCurvetoQuadraticAbs(+di[j+2], +di[j+3], +di[j], +di[j+1]);
5078           j += 3;
5079         } else if (dii === "q") {
5080           s = tar.createSVGPathSegCurvetoQuadraticRel(+di[j+2], +di[j+3], +di[j], +di[j+1]);
5081           j += 3;
5082         } else if (dii === "a") {
5083           s = tar.createSVGPathSegArcRel(+di[j+5], +di[j+6], +di[j], +di[j+1], +di[j+2], +di[j+3], +di[j+4]);
5084           j += 6;
5085         } else if (dii === "S") {
5086           s = tar.createSVGPathSegCurvetoCubicSmoothAbs(+di[j+2], +di[j+3], +di[j], +di[j+1]);
5087           j += 3;
5088         } else if (dii === "s") {
5089           s = tar.createSVGPathSegCurvetoCubicSmoothRel(+di[j+2], +di[j+3], +di[j], +di[j+1]);
5090           j += 3;
5091         } else if (dii === "T") {
5092           s = tar.createSVGPathSegCurvetoQuadraticSmoothAbs(+di[j], +di[j+1]);
5093           ++j;
5094         } else if (dii === "t") {
5095           s = tar.createSVGPathSegCurvetoQuadraticSmoothRel(+di[j], +di[j+1]);
5096           ++j;
5097         } else if (dii === "H") {
5098           s = tar.createSVGPathSegLinetoHorizontalAbs(+di[j]);
5099         } else if (dii === "h") {
5100           s = tar.createSVGPathSegLinetoHorizontalRel(+di[j]);
5101         } else if (dii === "V") {
5102           s = tar.createSVGPathSegLinetoVerticalAbs(+di[j]);
5103         } else if (dii === "v") {
5104           s = tar.createSVGPathSegLinetoVerticalRel(+di[j]);
5105         } else {
5106           s = new SVGPathSeg();
5107         }
5108         tlist.appendItem(s);
5109       }
5110     }
5111     di = s = sgs = dd = void 0;
5112     /*以下の処理は、pathSegListからnormalizedPathSegListへの
5113      *変換をする処理。相対座標を絶対座標に変換して、M、L、Cコマンドに正規化していく
5114      */
5115     var cx = 0, cy = 0,         //現在セグメントの終了点の絶対座標を示す (相対座標を絶対座標に変換するときに使用)
5116         xn = 0, yn = 0,         //T,tコマンドで仮想的な座標を算出するのに用いる。第一コントロール点
5117         startx = 0, starty = 0; //M,mコマンドにおける始点座標(Z,zコマンドで用いる)
5118     for (var j=0, tli=tlist.numberOfItems;j<tli;++j) {
5119       var ti = tlist.getItem(j),
5120           ts = ti.pathSegType,
5121           dii = ti.pathSegTypeAsLetter;
5122       if (ts === /*SVGPathSeg.PATHSEG_UNKNOWN*/ 0) {
5123       } else {
5124         var rx = cx, ry = cy;   //rx, ryは前のセグメントの終了点
5125         if (ts % 2 === 1) {     //相対座標ならば
5126           cx += ti.x;
5127           cy += ti.y;
5128         } else {
5129           cx = ti.x;
5130           cy = ti.y;
5131         }
5132         if (isC[dii]) {
5133           tnl.appendItem(ti);
5134         } else if (isL[dii]) {
5135           tnl.appendItem(ti);
5136         } else if (isM[dii]) {
5137           if (j !== 0) {
5138             /*Mコマンドが続いた場合は、2番目以降はLコマンドと解釈する
5139              *W3C SVG1.1の「8.3.2 The "moveto" commands」を参照
5140              *http://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands
5141              */
5142             var tg = tlist.getItem(j-1);
5143             if (tg.pathSegTypeAsLetter === "M") {
5144               tnl.appendItem(tcll(cx, cy));
5145               continue;
5146             }
5147           }
5148           startx = cx;
5149           starty = cy;
5150           tnl.appendItem(ti);
5151         } else if (dii === "m") {
5152           if (j !== 0) {
5153             var tg = tlist.getItem(j-1);
5154             if (tg.pathSegTypeAsLetter === "m") {
5155               tnl.appendItem(tcll(cx, cy));
5156               continue;
5157             }
5158           }
5159           startx = cx;
5160           starty = cy;
5161           tnl.appendItem(tar.createSVGPathSegMovetoAbs(cx, cy));
5162         } else if (dii === "l") {
5163           tnl.appendItem(tcll(cx, cy));
5164         } else if (dii === "c") {
5165           tnl.appendItem(tcc(cx, cy, ti.x1+rx, ti.y1+ry, ti.x2+rx, ti.y2+ry));
5166         } else if (isZ[dii]) {
5167           cx = startx;
5168           cy = starty;
5169           tnl.appendItem(ti);
5170         } else if (dii === "Q") {
5171           xn = 2*cx - ti.x1;
5172           yn = 2*cy - ti.y1;
5173           //2次スプライン曲線は近似的な3次ベジェ曲線に変換している
5174           tnl.appendItem(tcc(cx, cy, (rx + 2*ti.x1) / 3, (ry + 2*ti.y1) / 3, (2*ti.x1 + cx) / 3, (2*ti.y1 + cy) / 3));
5175         } else if (dii === "q") {
5176           var x1 = ti.x1 + rx, y1 = ti.y1 + ry;
5177           xn = 2*cx - x1;
5178           yn = 2*cy - y1;
5179           tnl.appendItem(tcc(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3));
5180           x1 = y1 = void 0;
5181         } else if (dii === "A" || dii === "a") {
5182           (function(ti, cx, cy, rx, ry, tar, tnl) { //変数を隠蔽するためのfunction
5183             /*以下は、Arctoを複数のCuvetoに変換する処理
5184              *SVG 1.1 「F.6 Elliptical arc implementation notes」の章を参照
5185              *http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
5186              */
5187             if (ti.r1 === 0 || ti.r2 === 0) {
5188               return;
5189             }
5190             var fS = ti.sweepFlag,
5191                 psai = ti.angle,
5192                 r1 = _math.abs(ti.r1),
5193                 r2 = _math.abs(ti.r2),
5194                 ctx = (rx - cx) / 2,  cty = (ry - cy) / 2,
5195                 cpsi = _math.cos(psai * _math.PI / 180),
5196                 spsi = _math.sin(psai * _math.PI / 180),
5197                 rxd = cpsi*ctx + spsi*cty,
5198                 ryd = -1*spsi*ctx + cpsi*cty,
5199                 rxdd = rxd * rxd, rydd = ryd * ryd,
5200                 r1x = r1 * r1,
5201                 r2y = r2 * r2,
5202                 lamda = rxdd/r1x + rydd/r2y,
5203                 sds;
5204             if (lamda > 1) {
5205               r1 = _math.sqrt(lamda) * r1;
5206               r2 = _math.sqrt(lamda) * r2;
5207               sds = 0;
5208             }  else{
5209               var seif = 1;
5210               if (ti.largeArcFlag === fS) {
5211                 seif = -1;
5212               }
5213               sds = seif * _math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd));
5214             }
5215             var txd = sds*r1*ryd / r2,
5216                 tyd = -1 * sds*r2*rxd / r1,
5217                 tx = cpsi*txd - spsi*tyd + (rx+cx)/2,
5218                 ty = spsi*txd + cpsi*tyd + (ry+cy)/2,
5219                 rad = _math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - _math.atan2(0, 1),
5220                 s1 = (rad >= 0) ? rad : 2 * _math.PI + rad,
5221                 rad = _math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - _math.atan2((ryd-tyd)/r2, (rxd-txd)/r1),
5222                 dr = (rad >= 0) ? rad : 2 * _math.PI + rad;
5223             if (!fS  &&  dr > 0) {
5224               dr -=   2*_math.PI;
5225             } else if (fS  &&  dr < 0) {
5226               dr += 2*_math.PI;
5227             }
5228             var sse = dr * 2 / _math.PI,
5229                 seg = _math.ceil(sse<0 ? -1*sse  :  sse),
5230                 segr = dr / seg,
5231                 t = 8/3 * _math.sin(segr/4) * _math.sin(segr/4) / _math.sin(segr/2),
5232                 cpsir1 = cpsi * r1, cpsir2 = cpsi * r2,
5233                 spsir1 = spsi * r1, spsir2 = spsi * r2,
5234                 mc = _math.cos(s1),
5235                 ms = _math.sin(s1),
5236                 x2 = rx - t * (cpsir1*ms + spsir2*mc),
5237                 y2 = ry - t * (spsir1*ms - cpsir2*mc);
5238             for (var n = 0; n < seg; ++n) {
5239               s1 += segr;
5240               mc = _math.cos(s1);
5241               ms = _math.sin(s1);
5242               var x3 = cpsir1*mc - spsir2*ms + tx,
5243                   y3 = spsir1*mc + cpsir2*ms + ty,
5244                   dx = -t * (cpsir1*ms + spsir2*mc),
5245                   dy = -t * (spsir1*ms - cpsir2*mc);
5246               tnl.appendItem(tcc(x3, y3, x2, y2, x3-dx, y3-dy));
5247               x2 = x3 + dx;
5248               y2 = y3 + dy;
5249             }
5250             ti= cx= cy= rx= ry= tar= tnl = void 0;
5251           })(ti, cx, cy, rx, ry, tar, tnl);
5252         } else if (dii === "S") {
5253           if (j !== 0) {
5254             var tg = tnl.getItem(tnl.numberOfItems-1);
5255             if (tg.pathSegTypeAsLetter === "C") {
5256               var x1 = 2*tg.x - tg.x2,
5257                   y1 = 2*tg.y - tg.y2;
5258             } else { //前のコマンドがCでなければ、現在の座標を第1コントロール点に用いる
5259               var x1 = rx,
5260                   y1 = ry;
5261             }
5262           } else {
5263             var x1 = rx,
5264                 y1 = ry;
5265           }
5266           tnl.appendItem(tcc(cx, cy, x1, y1, ti.x2, ti.y2));
5267           x1 = y1 = void 0;
5268         } else if (dii === "s") {
5269           if (j !== 0) {
5270             var tg = tnl.getItem(tnl.numberOfItems-1);
5271             if (tg.pathSegTypeAsLetter === "C") {
5272               var x1 = 2*tg.x - tg.x2,
5273                   y1 = 2*tg.y - tg.y2;
5274             } else {
5275               var x1 = rx,
5276                   y1 = ry;
5277             }
5278           } else {
5279             var x1 = rx,
5280                 y1 = ry;
5281           }
5282           tnl.appendItem(tcc(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry));
5283           x1 = y1 = void 0;
5284         } else if (dii === "T" || dii === "t") {
5285           if (j !== 0) {
5286             var tg = tlist.getItem(j-1);
5287             if ("QqTt".indexOf(tg.pathSegTypeAsLetter) > -1) {
5288              } else {
5289               xn = rx, yn = ry;
5290             }
5291           } else {
5292             xn = rx, yn = ry;
5293           }
5294           tnl.appendItem(tcc(cx, cy, (rx + 2*xn) / 3, (ry + 2*yn) / 3, (2*xn + cx) / 3, (2*yn + cy) / 3));
5295           xn = 2*cx - xn;
5296           yn = 2*cy - yn;
5297           xx1 = yy1 = void 0;
5298         } else if (dii === "H" || dii === "h") {
5299           tnl.appendItem(tcll(cx, ry));
5300           cy = ry; //勝手にti.yが0としているため
5301         } else if (dii === "V" || dii === "v") {
5302           tnl.appendItem(tcll(rx, cy));
5303           cx = rx;
5304         }
5305       }
5306     }
5307   }
5308   evt = tar = taco = cx = cy = xn = yn = startx = starty = tnl = tlist = ti = dii = ts = isZ = isM = isL = isC = s = tcc = tcll = void 0;
5309 };
5310 _sproto._nodeInsert = function(evt){
5311   var tar = evt.target;
5312   if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
5313     return; //強制終了させる
5314   }
5315   var tnext = tar.nextSibling,
5316       tpart = tar.parentNode._tar,
5317       isLast = true;
5318   if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
5319     tpart.insertBefore(tar._tar, tnext._tar);
5320   } else if (tnext && !tnext._tar && tpart) {
5321     /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
5322      *use要素や実体参照などは_tarプロパティがないことに注意
5323      */
5324     while (tnext) {
5325       if (tnext._tar && (tnext._tar.parentNode === tpart)) {
5326         tpart.insertBefore(tar._tar, tnext._tar);
5327         isLast = false;
5328       } 
5329       tnext = tnext.nextSibling;
5330     }
5331     if (isLast) {
5332       tpart.appendChild(tar._tar);
5333     }
5334   } else if (!tnext && tpart) {
5335     tpart.appendChild(tar._tar);      
5336   }
5337   tnext = tpart = isLast = void 0;
5338   tar.addEventListener("DOMNodeInsertedIntoDocument", tar._nodeInsertInto, false);
5339   evt = tar = void 0;
5340 };
5341 _sproto._nodeInsertInto = function(evt){
5342   /*以下の処理は、normalizedpathSegListとCTMに基づいて、
5343    *SVGのd属性をVMLに変換していく処理である。
5344    */
5345   var tar = evt.target,
5346       matrix = tar.getScreenCTM(),
5347       tlist = tar.normalizedPathSegList,
5348       dat = [],
5349       ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f,
5350       cname = tar._com._nameCom,
5351       isZ = tar._com._isZ, isC = tar._com._isC,
5352       mr = _math.round;
5353   for (var i=0, tli=tlist.numberOfItems;i<tli;++i) {
5354     var ti = tlist[i],
5355         tx = ti.x,
5356         ty = ti.y,
5357         tps = ti.pathSegTypeAsLetter,
5358         t = cname[tps];
5359     if (isC[tps]) {
5360       /*CTM(mx)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり
5361        *[ma mc me]   [x]
5362        *[mb md mf] * [y]
5363        *[0  0  1 ]   [1]
5364        */
5365       t += [mr(ma*ti.x1 + mc*ti.y1 + me),
5366              mr(mb*ti.x1 + md*ti.y1 + mf),
5367              mr(ma*ti.x2 + mc*ti.y2 + me),
5368              mr(mb*ti.x2 + md*ti.y2 + mf),
5369              mr(ma*tx + mc*ty + me),
5370              mr(mb*tx + md*ty + mf)].join(" ");
5371     } else if (!isZ[tps]) {
5372       t += mr(ma*tx + mc*ty + me)+ " " +mr(mb*tx + md*ty + mf);
5373     }
5374     dat[i] = t;
5375   }
5376   var vi = tar.ownerDocument.documentElement,
5377       tt = tar._tar;
5378   dat.push(" e");
5379   tt.path = dat.join(" ");
5380   tt.coordsize = vi.width.baseVal.value + " " + vi.height.baseVal.value;
5381   NAIBU._setPaint(tar, matrix);
5382   delete tar._cacheMatrix;
5383   evt = tar = dat = t = tx = ty = matrix = tlist = x = y = mr = ma = mb = mc = md = me = mf = vi = isZ = isC = i = tli = tps = ti = cname = tt = void 0;
5384 };
5385 _sproto._com = {
5386   _nameCom : {
5387     z : " x ",
5388     Z : " x ",
5389     C : "c",
5390     L : "l",
5391     M : "m"
5392   },
5393   _isZ : {
5394     z : 1,
5395     Z : 1
5396   },
5397   _isC : {
5398     C : 1
5399   },
5400   _isL : {
5401     L : 1
5402   },
5403   _isM : {
5404     M : 1
5405   },
5406   isRa : /\-/g,
5407   isRb : /,/g,
5408   isRc : /([a-yA-Y])/g,
5409   isRd : /([zZ])/g,
5410   isRe : /,/,
5411   isSp : /\S+/g
5412 };
5413   /*float*/         _sproto.getTotalLength = function() {
5414     var s = 0,
5415         nl = this.normalizedPathSegList;
5416     for (var i=1,nln=nl.numberOfItems,ms=null;i<nln;++i) {
5417       var seg = nl.getItem(i);
5418       if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
5419         var ps = nl.getItem(i-1);
5420         s += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5421       } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
5422         var ps = nl.getItem(i-1), dd = 0;
5423         /*2点のハンドルを結んだ線分の3辺と、
5424          *セグメントの始点と終点を結んだ1辺を足して2で割ったものを、ベジェ曲線の距離の近似値とする
5425          *
5426          *注意
5427          *本来は積分とシンプソン法などの解析を使って、媒介曲線であるベジェ曲線の距離を割り出すのが、
5428          *精密であり望ましいが、ここでは時間がかかりすぎるので別の方法をとる
5429          */
5430         dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
5431         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5432         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5433         dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5434         s += dd / 2;
5435       } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
5436         var ps = nl.getItem(i-1), ms = nl.getItem(0);
5437         s += _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
5438       }
5439
5440     }
5441     this.pathLength.baseVal = s;
5442     return s;
5443   };
5444   /*SVGPoint*/      _sproto.getPointAtLength = function(/*float*/ distance ) {
5445     var segn = this.getPathSegAtLength(distance),
5446         x = 0,
5447         y = 0,
5448         nl = this.normalizedPathSegList,
5449         seg = nl.getItem(segn),
5450         s = this.ownerDocument.documentElement.createSVGPoint();
5451     if ((segn-1) <= 0) {
5452       s.x = seg.x;
5453       s.y = seg.y;
5454       return s;
5455     }
5456     var ps = nl.getItem(segn-1);
5457     if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
5458       var segl = _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5459       var t = (segl + this._dis) / segl;
5460       s.x = ps.x + t * (seg.x-ps.x);
5461       s.y = ps.y + t * (seg.y-ps.y);
5462     } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
5463       var dd = 0;
5464       dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
5465       dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5466       dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5467       dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5468       var segl = dd / 2;
5469       var t = (segl + this._dis) / segl;
5470       /*以下はベジェ曲線の公式について、パラメータtによってまとめて整理したものを、
5471        *使って、ポイントの座標を演算する
5472        */
5473       s.x = (3*seg.x1 + seg.x - 3*seg.x2 - ps.x) * _math.pow(t, 3)
5474            +3*(ps.x - 2*seg.x1 + seg.x2) * _math.pow(t, 2)
5475            +3*(seg.x1 - ps.x) * t
5476            +ps.x;
5477       s.y = (3*seg.y1 + seg.y - 3*seg.y2 - ps.y) * _math.pow(t, 3)
5478            +3*(ps.y - 2*seg.y1 + seg.y2) * _math.pow(t, 2)
5479            +3*(seg.y1 - ps.y) * t
5480            +ps.y;
5481     } else if (seg.pathSegType === SVGPathSeg.MOVETO_ABS) {
5482       s.x = seg.x;
5483       s.y = seg.y;
5484     } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
5485       var ms = nl.getItem(0), segl = _math.sqrt(_math.pow((seg.x-mx.x), 2) + _math.pow((seg.y-ms.y), 2));
5486       var t = (segl + this._dis) / segl;
5487       s.x = ms.x + t * (seg.x-ms.x);
5488       s.y = ms.y + t * (seg.y-ms.y);
5489     }
5490     return s;
5491   };
5492   /*unsigned long*/ _sproto.getPathSegAtLength = function(/*float*/ distance ) {
5493     var nl = this.normalizedPathSegList; //仕様ではpathSegList
5494     for (var i=0,nln=nl.numberOfItems,ms=null;i<nln;++i) {
5495       var seg = nl.getItem(i);
5496       if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
5497         var ps = nl.getItem(i-1);
5498         distance -= _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5499       } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
5500         var ps = nl.getItem(i-1), dd = 0;
5501         dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
5502         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5503         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
5504         dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
5505         distance -= dd / 2;
5506         dd = void 0;
5507       } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
5508         var ps = nl.getItem(i-1), ms = nl.getItem(0);
5509         distance -= _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
5510       }
5511       if (distance <= 0) {
5512         /*_disプロパティは前述のgetPointAtLengthメソッドで使う*/
5513         this._dis = distance;
5514         distance = void 0;
5515         return i;
5516       }
5517     }
5518     /*もし、distanceがパスの距離よりも長い場合、
5519      *最後のセグメントの番号を返す
5520      *なお、これはSVG1.1の仕様の想定外のこと
5521      */
5522     return (nl.numberOfItems - 1);
5523   };
5524   /*SVGPathSegClosePath*/    _sproto.createSVGPathSegClosePath = function() {
5525     var _SVGPathSegClosePath = SVGPathSegClosePath;
5526     return (new _SVGPathSegClosePath());
5527   };
5528   /*SVGPathSegMovetoAbs*/    _sproto.createSVGPathSegMovetoAbs = function(/*float*/ x, /*float*/ y ) {
5529     var _SVGPathSegMovetoAbs = SVGPathSegMovetoAbs, s = new _SVGPathSegMovetoAbs();
5530     s.x = x;
5531     s.y = y;
5532     return s;
5533   };
5534   /*SVGPathSegMovetoRel*/    _sproto.createSVGPathSegMovetoRel = function(/*float*/ x, /*float*/ y ) {
5535     var s = new SVGPathSegMovetoRel();
5536     s.x = x;
5537     s.y = y;
5538     return s;
5539   };
5540   /*SVGPathSegLinetoAbs*/    _sproto.createSVGPathSegLinetoAbs = function(/*float*/ x, /*float*/ y ) {
5541     var s = new SVGPathSegLinetoAbs();
5542     s.x = x;
5543     s.y = y;
5544     return s;
5545   };
5546   /*SVGPathSegLinetoRel*/    _sproto.createSVGPathSegLinetoRel = function(/*float*/ x, /*float*/ y ) {
5547     var s = new SVGPathSegLinetoRel();
5548     s.x = x;
5549     s.y = y;
5550     return s;
5551   };
5552   /*SVGPathSegCurvetoCubicAbs*/    _sproto.createSVGPathSegCurvetoCubicAbs = function(/*float*/ x, /*float*/ y, /*float*/ x1, /*float*/ y1, /*float*/ x2, /*float*/ y2 ) {
5553     var _SVGPathSegCurvetoCubicAbs = SVGPathSegCurvetoCubicAbs, s = new _SVGPathSegCurvetoCubicAbs();
5554     s.x = x;
5555     s.y = y;
5556     s.x1 = x1;
5557     s.y1 = y1;
5558     s.x2 = x2;
5559     s.y2 = y2;
5560     return s;
5561   };
5562   /*SVGPathSegCurvetoCubicRel*/    _sproto.createSVGPathSegCurvetoCubicRel = function(/*float*/ x, /*float*/ y, /*float*/ x1, /*float*/ y1, /*float*/ x2, /*float*/ y2 ) {
5563     var s = new SVGPathSegCurvetoCubicRel();
5564     s.x = x;
5565     s.y = y;
5566     s.x1 = x1;
5567     s.y1 = y1;
5568     s.x2 = x2;
5569     s.y2 = y2;
5570     return s;
5571   };
5572   /*SVGPathSegCurvetoQuadraticAbs*/    _sproto.createSVGPathSegCurvetoQuadraticAbs = function(/*float*/ x, /*float*/ y, /*float*/ x1, /*float*/ y1 ) {
5573     var s = new SVGPathSegCurvetoQuadraticAbs();
5574     s.x = x;
5575     s.y = y;
5576     s.x1 = x1;
5577     s.y1 = y1;
5578     return s;
5579   };
5580   /*SVGPathSegCurvetoQuadraticRel*/    _sproto.createSVGPathSegCurvetoQuadraticRel = function(/*float*/ x, /*float*/ y, /*float*/ x1, /*float*/ y1 ) {
5581     var s = new SVGPathSegCurvetoQuadraticRel();
5582     s.x = x;
5583     s.y = y;
5584     s.x1 = x1;
5585     s.y1 = y1;
5586     return s;
5587   };
5588   /*SVGPathSegArcAbs*/    _sproto.createSVGPathSegArcAbs = function(/*float*/ x, /*float*/ y, /*float*/ r1, /*float*/ r2, /*float*/ angle, /*boolean*/ largeArcFlag, /*boolean*/ sweepFlag ) {
5589     var s = new SVGPathSegArcAbs();
5590     s.x = x;
5591     s.y = y;
5592     s.r1 = r1;
5593     s.r2 = r2;
5594     s.angle = angle;
5595     s.largeArcFlag = largeArcFlag;
5596     s.sweepFlag = sweepFlag;
5597     return s;
5598   };
5599   /*SVGPathSegArcRel*/    _sproto.createSVGPathSegArcRel = function(/*float*/ x, /*float*/ y, /*float*/ r1, /*float*/ r2, /*float*/ angle, /*boolean*/ largeArcFlag, /*boolean*/ sweepFlag ) {
5600     var s = new SVGPathSegArcRel();
5601     s.x = x;
5602     s.y = y;
5603     s.r1 = r1;
5604     s.r2 = r2;
5605     s.angle = angle;
5606     s.largeArcFlag = largeArcFlag;
5607     s.sweepFlag = sweepFlag;
5608     return s;
5609   };
5610   /*SVGPathSegLinetoHorizontalAbs*/    _sproto.createSVGPathSegLinetoHorizontalAbs = function(/*float*/ x ) {
5611     var s = new SVGPathSegLinetoHorizontalAbs();
5612     s.x = x;
5613     s.y = 0; //DOMでは指定されていないが、変換処理が楽なので用いる
5614     return s;
5615   };
5616   /*SVGPathSegLinetoHorizontalRel*/    _sproto.createSVGPathSegLinetoHorizontalRel = function(/*float*/ x ) {
5617     var s = new SVGPathSegLinetoHorizontalRel();
5618     s.x = x;
5619     s.y = 0;
5620     return s;
5621   };
5622   /*SVGPathSegLinetoVerticalAbs*/    _sproto.createSVGPathSegLinetoVerticalAbs = function(/*float*/ y ) {
5623     var s = new SVGPathSegLinetoVerticalAbs();
5624     s.x = 0;
5625     s.y = y;
5626     return s;
5627   };
5628   /*SVGPathSegLinetoVerticalRel*/    _sproto.createSVGPathSegLinetoVerticalRel = function(/*float*/ y ) {
5629     var s = new SVGPathSegLinetoVerticalRel();
5630     s.x = 0;
5631     s.y = y;
5632     return s;
5633   };
5634   /*SVGPathSegCurvetoCubicSmoothAbs*/    _sproto.createSVGPathSegCurvetoCubicSmoothAbs = function(/*float*/ x, /*float*/ y, /*float*/ x2, /*float*/ y2 ) {
5635     var s = new SVGPathSegCurvetoCubicSmoothAbs();
5636     s.x = x;
5637     s.y = y;
5638     s.x2 = x2;
5639     s.y2 = y2;
5640     return s;
5641   };
5642   /*SVGPathSegCurvetoCubicSmoothRel*/    _sproto.createSVGPathSegCurvetoCubicSmoothRel = function(/*float*/ x, /*float*/ y, /*float*/ x2, /*float*/ y2 ) {
5643     var s = new SVGPathSegCurvetoCubicSmoothRel();
5644     s.x = x;
5645     s.y = y;
5646     s.x2 = x2;
5647     s.y2 = y2;
5648     return s;
5649   };
5650   /*SVGPathSegCurvetoQuadraticSmoothAbs*/    _sproto.createSVGPathSegCurvetoQuadraticSmoothAbs = function(/*float*/ x, /*float*/ y ) {
5651     var s = new SVGPathSegCurvetoQuadraticSmoothAbs();
5652     s.x = x;
5653     s.y = y;
5654     return s;
5655   };
5656   /*SVGPathSegCurvetoQuadraticSmoothRel*/    _sproto.createSVGPathSegCurvetoQuadraticSmoothRel = function(/*float*/ x, /*float*/ y ) {
5657     var s = new SVGPathSegCurvetoQuadraticSmoothRel();
5658     s.x = x;
5659     s.y = y;
5660     return s;
5661   };
5662 })(SVGPathElement.prototype)
5663   NAIBU.SVGPathElement = SVGPathElement; //IE8では、SVGPathElementはローカル変数
5664 })(document, Math);
5665
5666 function SVGRectElement(_doc) {
5667   SVGElement.apply(this);
5668   this._tar = _doc.createElement("v:shape");
5669   var slen = SVGAnimatedLength;
5670   /*readonly SVGAnimatedLength*/ this.x = new slen();
5671   /*readonly SVGAnimatedLength*/ this.y = new slen();
5672   /*readonly SVGAnimatedLength*/ this.width = new slen();
5673   /*readonly SVGAnimatedLength*/ this.height = new slen();
5674   /*readonly SVGAnimatedLength*/ this.rx = new slen();
5675   /*readonly SVGAnimatedLength*/ this.ry = new slen();
5676   _doc = slen = void 0;
5677   this.addEventListener("DOMNodeInserted", function(evt){
5678     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
5679       return; //強制終了させる
5680     }
5681     var tar = evt.target,
5682         tnext = tar.nextSibling,
5683         tpart = tar.parentNode._tar,
5684         isLast = true;
5685     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
5686       tpart.insertBefore(tar._tar, tnext._tar);
5687     } else if (tnext && !tnext._tar && tpart) {
5688       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
5689        *use要素や実体参照などは_tarプロパティがないことに注意
5690        */
5691       while (tnext) {
5692         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
5693           tpart.insertBefore(tar._tar, tnext._tar);
5694           isLast = false;
5695         } 
5696         tnext = tnext.nextSibling;
5697       }
5698       if (isLast) {
5699         tpart.appendChild(tar._tar);
5700       }
5701     } else if (!tnext && tpart) {
5702       tpart.appendChild(tar._tar);      
5703     }
5704     tnext = tpart = isLast = void 0;
5705     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
5706       var tar = evt.target,
5707           style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
5708           fontSize = parseFloat(style.getPropertyValue("font-size"));
5709       tar.x.baseVal._emToUnit(fontSize);
5710       tar.y.baseVal._emToUnit(fontSize);
5711       tar.width.baseVal._emToUnit(fontSize);
5712       tar.height.baseVal._emToUnit(fontSize);
5713       var rx = tar.getAttributeNS(null, "rx"),
5714           ry = tar.getAttributeNS(null, "ry"),
5715           x = tar.x.baseVal.value,
5716           y = tar.y.baseVal.value,
5717           xw = x + tar.width.baseVal.value,
5718           yh = y + tar.height.baseVal.value,
5719           list;
5720       if ((rx || ry) && (rx !== "0") && (ry !== "0")) {
5721         tar.rx.baseVal._emToUnit(fontSize);
5722         tar.ry.baseVal._emToUnit(fontSize);
5723         var thrx = tar.rx.baseVal,
5724             thry = tar.ry.baseVal,
5725             twidth = tar.width.baseVal.value,
5726             theight = tar.height.baseVal.value;
5727         thrx.value = rx ? thrx.value : thry.value;
5728         thry.value = ry ? thry.value : thrx.value;
5729         //rx属性が幅より大きければ、幅の半分を属性に設定(ry属性は高さと比較する)
5730         if (thrx.value > twidth / 2) {
5731           thrx.value = twidth / 2;
5732         }
5733         if (thry.value > theight / 2) {
5734           thry.value = theight / 2;
5735         }
5736         var rxv = thrx.value,
5737             ryv = thry.value,
5738             rrx = rxv * 0.55228,
5739             rry = ryv * 0.55228,
5740             a = xw - rxv,
5741             b = x + rxv,
5742             c = y + ryv,
5743             d = yh - ryv;
5744         list = ["m",b,y, "l",a,y, "c",a+rrx,y,xw,c-rry,xw,c, "l",xw,d, "c",xw,d+rry,a+rrx,yh,a,yh, "l",b,yh, "c",b-rrx,yh,x,d+rry,x,d, "l",x,c, "c",x,c-rry,b-rrx,y,b,y];
5745       } else {
5746         list = ["m",x,y, "l",x,yh, xw,yh, xw,y, "x e"];
5747       }
5748       //以下は、配列listそのものをCTMで座標変換していく処理
5749       var par = tar.ownerDocument.documentElement,
5750           ctm = tar.getScreenCTM(),
5751           dat, p, pmt,
5752           ele = tar._tar,
5753           vi = tar.ownerDocument.documentElement,
5754           w = vi.width.baseVal.value,
5755           h = vi.height.baseVal.value,
5756           mr = Math.round;
5757       for (var i=0, lili=list.length;i<lili;) {
5758         if (isNaN(list[i])) { //コマンド文字は読み飛ばす
5759           ++i;
5760           continue;
5761         }
5762         p = par.createSVGPoint();
5763         p.x = list[i];
5764         p.y = list[i+1];
5765         pmt = p.matrixTransform(ctm);
5766         list[i] = mr(pmt.x);
5767         ++i;
5768         list[i] = mr(pmt.y);
5769         ++i;
5770         p = pmt = void 0;
5771       }
5772       dat = list.join(" ");
5773       //VMLに結び付けていく
5774       ele.path = dat;
5775       ele.coordsize = w + " " + h;
5776       NAIBU._setPaint(tar, ctm);
5777       delete tar._cacheMatrix;
5778       evt = tar = style = list = mr = dat = ele = vi = fontSize = void 0;
5779     }, false);
5780     evt = tar = void 0;
5781   }, false);
5782   return this;
5783 };
5784 SVGRectElement.prototype = new SVGElement();
5785
5786 function SVGCircleElement(_doc) { 
5787   SVGElement.apply(this);
5788   this._tar = _doc.createElement("v:shape");
5789   var sl = SVGAnimatedLength;
5790   /*readonly SVGAnimatedLength*/ this.cx = new sl();
5791   /*readonly SVGAnimatedLength*/ this.cy = new sl();
5792   /*readonly SVGAnimatedLength*/ this.r = new sl();
5793   _doc = sl = void 0;
5794   this.addEventListener("DOMNodeInserted", function(evt){
5795     var tar = evt.target;
5796     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
5797       return; //強制終了させる
5798     }
5799     var tnext = tar.nextSibling,
5800         tpart = tar.parentNode._tar,
5801         isLast = true;
5802     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
5803       tpart.insertBefore(tar._tar, tnext._tar);
5804     } else if (tnext && !tnext._tar && tpart) {
5805       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
5806        *use要素や実体参照などは_tarプロパティがないことに注意
5807        */
5808       while (tnext) {
5809         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
5810           tpart.insertBefore(tar._tar, tnext._tar);
5811           isLast = false;
5812         } 
5813         tnext = tnext.nextSibling;
5814       }
5815       if (isLast) {
5816         tpart.appendChild(tar._tar);
5817       }
5818     } else if (!tnext && tpart) {
5819       tpart.appendChild(tar._tar);      
5820     }
5821     tnext = tpart = isLast = void 0;
5822     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
5823       var tar = evt.target,
5824           style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
5825           fontSize = parseFloat(style.getPropertyValue("font-size"));
5826       tar.cx.baseVal._emToUnit(fontSize);
5827       tar.cy.baseVal._emToUnit(fontSize);
5828       tar.r.baseVal._emToUnit(fontSize);
5829       var cx = tar.cx.baseVal.value,
5830           cy = tar.cy.baseVal.value,
5831           rx = ry = tar.r.baseVal.value,
5832           top = cy - ry,
5833           left = cx - rx,
5834           bottom = cy + ry,
5835           right = cx + rx,
5836           rrx = rx * 0.55228,
5837           rry = ry * 0.55228,
5838           list = ["m", cx,top, "c", cx-rrx,top, left,cy-rry, left,cy, left,cy+rry, cx-rrx,bottom, cx,bottom, cx+rrx,bottom, right,cy+rry, right,cy, right,cy-rry, cx+rrx,top, cx,top, "x e"];
5839         //以下は、配列listそのものをCTMで座標変換していく処理
5840         var par = tar.ownerDocument.documentElement,
5841             ctm = tar.getScreenCTM(),
5842             mr = Math.round;
5843         for (var i=0, lili=list.length;i<lili;) {
5844           if (isNaN(list[i])) { //コマンド文字は読み飛ばす
5845             ++i;
5846             continue;
5847           }
5848           var p = par.createSVGPoint();
5849           p.x = list[i];
5850           p.y = list[i+1];
5851           var pmt = p.matrixTransform(ctm);
5852           list[i] = mr(pmt.x);
5853           ++i;
5854           list[i] = mr(pmt.y);
5855           ++i;
5856           p = pmt = void 0;
5857         }
5858         var dat = list.join(" "),
5859             ele = tar._tar,
5860             vi = tar.ownerDocument.documentElement,
5861             w = vi.width.baseVal.value,
5862             h = vi.height.baseVal.value;
5863         //VMLに結び付けていく
5864         ele.path = dat;
5865         ele.coordsize = w + " " + h;
5866         NAIBU._setPaint(tar, ctm);
5867         delete tar._cacheMatrix;
5868         evt = tar = list = mr = style = fontSize = dat = ele = void 0;
5869     }, false);
5870     evt = tar = void 0;
5871   }, false);
5872   return this;
5873 };
5874 SVGCircleElement.prototype = new SVGElement();
5875
5876 function SVGEllipseElement(_doc) { 
5877   SVGElement.apply(this);
5878   this._tar = _doc.createElement("v:shape");
5879   var sl = SVGAnimatedLength;
5880   /*readonly SVGAnimatedLength*/ this.cx = new sl();
5881   /*readonly SVGAnimatedLength*/ this.cy = new sl();
5882   /*readonly SVGAnimatedLength*/ this.rx = new sl();
5883   /*readonly SVGAnimatedLength*/ this.ry = new sl();
5884   _doc = sl = void 0;
5885   this.addEventListener("DOMNodeInserted", function(evt){
5886     var tar = evt.target;
5887     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
5888       return; //強制終了させる
5889     }
5890     var tnext = tar.nextSibling,
5891     tpart = tar.parentNode._tar,
5892     isLast = true;
5893     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
5894       tpart.insertBefore(tar._tar, tnext._tar);
5895     } else if (tnext && !tnext._tar && tpart) {
5896       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
5897        *use要素や実体参照などは_tarプロパティがないことに注意
5898        */
5899       while (tnext) {
5900         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
5901           tpart.insertBefore(tar._tar, tnext._tar);
5902           isLast = false;
5903         } 
5904         tnext = tnext.nextSibling;
5905       }
5906       if (isLast) {
5907         tpart.appendChild(tar._tar);
5908       }
5909     } else if (!tnext && tpart) {
5910       tpart.appendChild(tar._tar);      
5911     }
5912     tnext = tpart = isLast = void 0;
5913     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
5914       var tar = evt.target,
5915           style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
5916           fontSize = parseFloat(style.getPropertyValue("font-size"));
5917       tar.cx.baseVal._emToUnit(fontSize);
5918       tar.cy.baseVal._emToUnit(fontSize);
5919       tar.rx.baseVal._emToUnit(fontSize);
5920       tar.ry.baseVal._emToUnit(fontSize);
5921       var cx = tar.cx.baseVal.value,
5922           cy = tar.cy.baseVal.value,
5923           rx = tar.rx.baseVal.value,
5924           ry = tar.ry.baseVal.value,
5925           top = cy - ry,
5926           left = cx - rx,
5927           bottom = cy + ry,
5928           right = cx + rx,
5929           rrx = rx * 0.55228,
5930           rry = ry * 0.55228,
5931           list = ["m", cx,top, "c", cx-rrx,top, left,cy-rry, left,cy, left,cy+rry, cx-rrx,bottom, cx,bottom, cx+rrx,bottom, right,cy+rry, right,cy, right,cy-rry, cx+rrx,top, cx,top, "x e"];
5932       //以下は、配列listそのものをCTMで座標変換していく処理
5933       var par = tar.ownerDocument.documentElement,
5934           ctm = tar.getScreenCTM(),
5935           mr = Math.round;
5936       for (var i=0, lili=list.length;i<lili;) {
5937         if (isNaN(list[i])) { //コマンド文字は読み飛ばす
5938           ++i;
5939           continue;
5940         }
5941         var p = par.createSVGPoint();
5942         p.x = list[i];
5943         p.y = list[i+1];
5944         var pmt = p.matrixTransform(ctm);
5945         list[i] = mr(pmt.x);
5946         ++i;
5947         list[i] = mr(pmt.y);
5948         ++i;
5949         p = pmt = void 0;
5950       }
5951       var dat = list.join(" "),
5952           ele = tar._tar, 
5953           vi = tar.ownerDocument.documentElement,
5954           w = vi.width.baseVal.value,
5955           h = vi.height.baseVal.value;
5956       //VMLに結び付けていく
5957       ele.path = dat;
5958       ele.coordsize = w + " " + h;
5959       NAIBU._setPaint(tar, ctm);
5960       delete tar._cacheMatrix;
5961       evt = ele = tar = style = fontSize = dat = list = mr = ctm = w = h = void 0;
5962     }, false);
5963     evt = tar = void 0;
5964   }, false);
5965   return this;
5966 };
5967 SVGEllipseElement.prototype = new SVGElement();
5968
5969 function SVGLineElement(_doc) { 
5970   SVGElement.apply(this);
5971   this._tar = _doc.createElement("v:shape");
5972   var sl = SVGAnimatedLength;
5973   /*readonly SVGAnimatedLength*/ this.x1 = new sl();
5974   /*readonly SVGAnimatedLength*/ this.y1 = new sl();
5975   /*readonly SVGAnimatedLength*/ this.x2 = new sl();
5976   /*readonly SVGAnimatedLength*/ this.y2 = new sl();
5977   _doc = sl = void 0;
5978   this.addEventListener("DOMNodeInserted", function(evt){
5979     var tar = evt.target;
5980     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
5981       return; //強制終了させる
5982     }
5983     var tnext = tar.nextSibling,
5984         tpart = tar.parentNode._tar,
5985         isLast = true;
5986     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
5987       tpart.insertBefore(tar._tar, tnext._tar);
5988     } else if (tnext && !tnext._tar && tpart) {
5989       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
5990        *use要素や実体参照などは_tarプロパティがないことに注意
5991        */
5992       while (tnext) {
5993         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
5994           tpart.insertBefore(tar._tar, tnext._tar);
5995           isLast = false;
5996         } 
5997         tnext = tnext.nextSibling;
5998       }
5999       if (isLast) {
6000         tpart.appendChild(tar._tar);
6001       }
6002     } else if (!tnext && tpart) {
6003       tpart.appendChild(tar._tar);      
6004     }
6005     tnext = tpart = isLast = void 0;
6006     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
6007       var tar = evt.target,
6008           style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""),
6009           fontSize = parseFloat(style.getPropertyValue("font-size"));
6010       tar.x1.baseVal._emToUnit(fontSize);
6011       tar.y1.baseVal._emToUnit(fontSize);
6012       tar.x2.baseVal._emToUnit(fontSize);
6013       tar.y2.baseVal._emToUnit(fontSize);
6014       //以下は、配列listそのものをCTMで座標変換していく処理
6015       var vi = tar.ownerDocument.documentElement,
6016           ctm = tar.getScreenCTM(),
6017           dat = "m ",
6018           mr = Math.round,
6019           p = vi.createSVGPoint();
6020       p.x = tar.x1.baseVal.value;
6021       p.y = tar.y1.baseVal.value;
6022       var pmt = p.matrixTransform(ctm);
6023       dat += mr(pmt.x)+ " " +mr(pmt.y)+ " l ";
6024       p.x = tar.x2.baseVal.value;
6025       p.y = tar.y2.baseVal.value;
6026       pmt = p.matrixTransform(ctm);
6027       dat += mr(pmt.x)+ " " +mr(pmt.y);
6028       p = pmt = void 0;
6029       //VMLに結び付けていく
6030       var ele = tar._tar,
6031           w = vi.width.baseVal.value,
6032           h = vi.height.baseVal.value;
6033       ele.path = dat;
6034       ele.coordsize = w + " " + h;
6035       NAIBU._setPaint(tar, ctm);
6036       delete tar._cacheMatrix;
6037       evt = ele = tar = style = fontSize = dat = list = mr = ctm = vi = w = h = void 0;
6038     }, false);
6039     evt = tar = void 0;
6040   }, false);
6041   return this;
6042 };
6043 SVGLineElement.prototype = new SVGElement();
6044
6045 /*_GenericSVGPolyElementインターフェース
6046  * このインターフェースはpolygonとpolyline要素共通のインターフェースとして使用。
6047  * ファイルサイズを軽量にすることができる
6048  */
6049 NAIBU._GenericSVGPolyElement = function (_doc, xclose) {
6050   SVGElement.apply(this);
6051   this._tar = _doc.createElement("v:shape");
6052   _doc = void 0;
6053   //interface SVGAnimatedPoints
6054   /*readonly SVGPointList*/   this.animatedPoints = this.points = new SVGPointList();
6055   this.addEventListener("DOMAttrModified", function(evt){
6056     var tar = evt.target;
6057     if (evt.attrName === "points") {
6058       var tp = tar.points, par = tar.ownerDocument.documentElement;
6059       var list = evt.newValue.replace(/^\s+|\s+$/g, "").split(/[\s,]+/);
6060       for (var i=0, p, lili=list.length;i<lili;i+=2) {
6061         if (isNaN(list[i])) {
6062           --i;
6063           continue;
6064         }
6065         p = par.createSVGPoint();
6066         p.x = parseFloat(list[i]);
6067         p.y = parseFloat(list[i+1]);
6068         tp.appendItem(p);
6069       }
6070     }
6071     evt = tar = list = tp = par = p = void 0;
6072   }, false);
6073   this.addEventListener("DOMNodeInserted", function(evt){
6074     var tar = evt.target;
6075     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
6076       return; //強制終了させる
6077     }
6078     var tnext = tar.nextSibling,
6079         tpart = tar.parentNode._tar,
6080         isLast = true;
6081     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
6082       tpart.insertBefore(tar._tar, tnext._tar);
6083     } else if (tnext && !tnext._tar && tpart) {
6084       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
6085        *use要素や実体参照などは_tarプロパティがないことに注意
6086        */
6087       while (tnext) {
6088         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
6089           tpart.insertBefore(tar._tar, tnext._tar);
6090           isLast = false;
6091         } 
6092         tnext = tnext.nextSibling;
6093       }
6094       if (isLast) {
6095         tpart.appendChild(tar._tar);
6096       }
6097     } else if (!tnext && tpart) {
6098       tpart.appendChild(tar._tar);      
6099     }
6100     tnext = tpart = isLast = void 0;
6101     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
6102       var tar = evt.target,
6103           tp = tar.points,
6104           ctm = tar.getScreenCTM(),
6105           mr = Math.round;
6106       //以下は、配列listそのものをCTMで座標変換していく処理
6107       for (var i=0, list = [], lili=tp.numberOfItems;i<lili;++i) {
6108         var p = tp.getItem(i),
6109             pmt = p.matrixTransform(ctm);
6110         list[2*i] = mr(pmt.x);
6111         list[2*i + 1] = mr(pmt.y);
6112         p = pmt = void 0;
6113       }
6114       list.splice(2, 0, "l");
6115       var dat = "m" + list.join(" ") + xclose,
6116           ele = tar._tar,
6117           vi = tar.ownerDocument.documentElement;
6118           w = vi.width.baseVal.value,
6119           h = vi.height.baseVal.value;
6120       //VMLに結び付けていく
6121       ele.path = dat;
6122       ele.coordsize = w + " " + h;
6123       NAIBU._setPaint(tar, ctm);
6124       delete tar._cacheMatrix;
6125       evt = ele = tar = dat = list = mr = ctm = w = h = vi = void 0;
6126     }, false);
6127     evt = tar = void 0;
6128   }, false);
6129   return this;
6130 }
6131 function SVGPolylineElement(_doc) {
6132   NAIBU._GenericSVGPolyElement.call(this, _doc, "e");
6133   _doc = void 0;
6134   return this;
6135 };
6136 SVGPolylineElement.prototype = new SVGElement();
6137
6138 function SVGPolygonElement(_doc) {
6139   NAIBU._GenericSVGPolyElement.call(this, _doc, "x e");
6140   _doc = void 0;
6141   return this;
6142 };
6143 SVGPolygonElement.prototype = new SVGElement();
6144
6145 function SVGTextContentElement(_doc) { 
6146   SVGElement.apply(this);
6147   /*readonly SVGAnimatedLength*/      this.textLength = new SVGAnimatedLength();
6148   /*readonly SVGAnimatedEnumeration*/ this.lengthAdjust = new SVGAnimatedEnumeration(SVGTextContentElement.LENGTHADJUST_UNKNOWN);
6149   this.addEventListener("DOMNodeInserted", function(evt){
6150     var tar = evt.target,
6151         cur = evt.currentTarget,
6152         eph = evt.eventPhase;
6153     /*Bubblingフェーズの時にはもう、div要素をDOMツリーに挿入しておく必要があるため、
6154      *あらかじめ、Capturingフェーズで処理しておく
6155      */
6156     if ((eph === /*Event.CAPTURING_PHASE*/ 1) && (tar.localName === "a") && (tar.namespaceURI === "http://www.w3.org/2000/svg") && tar.firstChild) {
6157       /*a要素の場合はtarをすりかえておく*/
6158       tar = tar.firstChild;
6159     }
6160     if ((eph === /*Event.CAPTURING_PHASE*/ 1) && (tar.nodeType === /*Node.TEXT_NODE*/ 3) && !tar._tars) {
6161       /*Textノードにdiv要素を格納したリストをプロパティとして蓄えておく*/
6162       tar._tars = [];
6163       var data = tar.data.replace(/^\s+/, "").replace(/\s+$/, "");
6164       tar.data = data;
6165       data = data.split('');
6166       for (var i=0, tdli=data.length;i<tdli;++i) {
6167         var d = _doc.createElement("div"),
6168             dstyle = d.style;
6169         dstyle.position = "absolute";
6170         dstyle.textIndent = dstyle.marginLeft = dstyle.marginRight = dstyle.marginTop = dstyle.paddingTop = dstyle.paddingLeft = "0px";
6171         dstyle.whiteSpace = "nowrap";
6172         d.appendChild(_doc.createTextNode(data[i]));
6173         tar._tars[tar._tars.length] = d;
6174       }
6175       data = void 0;
6176     }
6177     evt = tar = cur = eph = void 0;
6178   }, true);
6179   this.addEventListener("DOMNodeRemoved", function(evt){
6180     var tar = evt.target;
6181     if ((evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) && (tar.nodeType === /*Node.TEXT_NODE*/ 3)) {
6182       delete evt.currentTarget._length;
6183       tar = evt = void 0;
6184     }
6185   }, false);
6186  return this;
6187 };
6188
6189 (function(t) {
6190 t.prototype = new SVGElement();
6191     // lengthAdjust Types
6192   /*unsigned short*/ t.LENGTHADJUST_UNKNOWN           = 0;
6193   /*unsigned short*/ t.LENGTHADJUST_SPACING           = 1;
6194   /*unsigned short*/ t.LENGTHADJUST_SPACINGANDGLYPHS  = 2;
6195   t.prototype._list = null;         //文字の位置を格納しておくリストのキャッシュ
6196   t.prototype._length = null;       //全文字数のキャッシュ
6197   t.prototype._stx = t.prototype._sty = 0; //初めの文字の位置
6198   t.prototype._chars = 0;           //tspan (tref)要素が全体の何文字目から始まっているか
6199   t.prototype._isYokogaki = true;   //横書きかどうか
6200 /*long*/     t.prototype.getNumberOfChars = function() {
6201   if (this._length) {
6202     return (this._length);
6203   } else {
6204     var t = this.firstChild,
6205         s = 0;
6206     while (t) {
6207       if (t.length && (t.nodeType === /*Node.TEXT_NODE*/ 3)) {
6208         s += t.length;
6209       } else if (t.getNumberOfChars) { //tspan要素などであれば
6210         s += t.getNumberOfChars();
6211       }
6212       t = t.nextSibling;
6213     }
6214     this._length = s;
6215     t = void 0;
6216     return s;
6217   }
6218 };
6219 /*float*/    t.prototype.getComputedTextLength = function() {
6220   var l = this.textLength.baseVal;
6221   if ((l.value === 0) && (this.getNumberOfChars() > 0)) {
6222     /*何も設定されていない場合のみ、初期化を行う*/
6223     l.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, this.getSubStringLength(0, this.getNumberOfChars()));
6224   }
6225   l = void 0;
6226   return (this.textLength.baseVal.value);
6227 };
6228 /*getSubStringLengthメソッド
6229  *charnum番目の文字からnchars+charnum-1番目までの文字列の長さを求めて返す
6230  */
6231 /*float*/    t.prototype.getSubStringLength = function(/*unsigned long*/ charnum, /*unsigned long*/ nchars ) {
6232   if (nchars === 0) {
6233     return 0;
6234   }
6235   var tg = this.getNumberOfChars();
6236   if (tg < (nchars+charnum)) {
6237     /*ncharsが文字列の長さよりも長くなってしまったときには、
6238      *文字列の末端までの長さを求めるとする(SVG1.1の仕様より)
6239      */
6240     nchars = tg - charnum + 1;
6241   }
6242   var end = this.getEndPositionOfChar(nchars+charnum-1), st = this.getStartPositionOfChar(charnum);
6243   if (this._isYokogaki) {
6244     var s = end.x - st.x;
6245   } else {
6246     var s = end.y - st.y;
6247   }
6248   tg = end = st = void 0;
6249   return s;
6250 }
6251 /*SVGPoint*/ t.prototype.getStartPositionOfChar = function (/*unsigned long*/ charnum ) {
6252   if (charnum > this.getNumberOfChars() || charnum < 0) {
6253     throw (new DOMException(DOMException.INDEX_SIZE_ERR));
6254   } else {
6255     var tar = this,
6256         ti = tar.firstChild,
6257         tp = tar.parentNode;
6258     if (!!!tar._list) {
6259       tar._list = [];
6260       var chars = tar._chars, //現在、何文字目にあるのか
6261           x = tar._stx, y = tar._sty, n = 0, //現在のテキスト位置と順番
6262           style = tar.ownerDocument.defaultView.getComputedStyle(tar, null),
6263           isYokogaki = ((style.getPropertyValue("writing-mode")) === "lr-tb") ? true : false,
6264           fontSize = parseFloat(style.getPropertyValue("font-size")),
6265           tx = tar.x.baseVal, ty = tar.y.baseVal, tdx = tar.dx.baseVal, tdy = tar.dy.baseVal;
6266       /*親要素の属性も参照しておく*/
6267       if (tp && ((tp.localName === "text") ||(tp.localName === "tspan"))) {
6268         var ptx = tp.x.baseVal,
6269             pty = tp.y.baseVal,
6270             ptdx = tp.dx.baseVal,
6271             ptdy = tp.dy.baseVal;
6272       } else {
6273         var ptx = pty = ptdx = ptdy = {numberOfItems : 0};
6274       }
6275       var kern = "f ijltIr.,:;'-\"()",
6276           akern = "1234567890abcdeghknopquvxyz",
6277           tt, alm, tdc, tcca, p, almx, almy, tlist, tg;
6278       if (isYokogaki && (tar.localName === "text")) {
6279         y += fontSize * 0.2;
6280       } else if (tar.localName === "text"){
6281         x -= fontSize * 0.5;
6282       }
6283       while (ti) {
6284         if (ti.nodeType === /*Node.TEXT_NODE*/ 3) {
6285           tt = ti._tars;
6286           /*tspan(tref)要素のx属性で指定された座標の個数よりも、文字数が多い場合は、祖先(親)のx属性を
6287            *使う。また、属性が指定されていないときも同様に祖先や親を使う。
6288            *もし、仮に祖先や親がx属性を指定されていなければ、現在のテキスト位置(変数xに格納している)を使う。
6289            *この処理はdx属性やdy、y属性でも同様とする
6290            *参照資料SVG1.1 Text
6291            *http://www.hcn.zaq.ne.jp/___/REC-SVG11-20030114/text.html
6292            *
6293            *注意:ここでは、tspan要素だけではなく、text要素にも適用しているが、本来はtspan要素のみに処理させること
6294            */
6295           for (var i=0, tli=tt.length;i<tli;++i) {
6296             if (n < ptx.numberOfItems - chars) {
6297               x = ptx.getItem(n).value;
6298               if (!isYokogaki) {
6299                 x -= fontSize * 0.5;
6300               }
6301             } else if (n < tx.numberOfItems) {
6302               x = tx.getItem(n).value;
6303               if (!isYokogaki) {
6304                 x -= fontSize * 0.5;
6305               }
6306             }
6307             if (n < pty.numberOfItems - chars) {
6308               y = pty.getItem(n).value;
6309               if (isYokogaki) {
6310                 y += fontSize * 0.2;
6311               }
6312             } else if (n < ty.numberOfItems) {
6313               y = ty.getItem(n).value;
6314               if (isYokogaki) {
6315                 y += fontSize * 0.2;
6316               }
6317             }
6318             if (n < ptdx.numberOfItems - chars) {
6319               x += ptdx.getItem(n).value;
6320             } else if (n < tdx.numberOfItems) {
6321               x += tdx.getItem(n).value;
6322             }
6323             if (n < ptdy.numberOfItems - chars) {
6324               y += ptdy.getItem(n).value;
6325             } else if (n < tdy.numberOfItems) {
6326               y += tdy.getItem(n).value;
6327             }
6328             alm = 0;
6329             if (isYokogaki) {
6330               //カーニングを求めて、字の幅を文字ごとに調整する
6331               tdc = ti.data.charAt(i);
6332               if (kern.indexOf(tdc) > -1) {
6333                 alm = fontSize * 0.68;
6334               } else if (tdc === "s"){
6335                 alm = fontSize * 0.52;
6336               } else if ((tdc === "C") || (tdc === "D") || (tdc === "M") || (tdc === "W") || (tdc === "G") || (tdc === "m")){
6337                 alm = fontSize * 0.2;
6338               } else if (akern.indexOf(tdc) > -1){
6339                 alm = fontSize * 0.45;
6340               } else {
6341                 alm = fontSize * 0.3;
6342               }
6343               tcca = tdc.charCodeAt(0);
6344               if ((12288 <= tcca) && (tcca <= 65533)) {
6345                 alm = -fontSize * 0.01;
6346                 if ((tdc === "う") || (tdc === "く") || (tdc === "し") || (tdc === "ち")) {
6347                   alm += fontSize * 0.2;
6348                 }
6349               }
6350             }
6351             tlist = tar._list;
6352             tlist[tlist.length] = x;
6353             tlist[tlist.length] = y;
6354             tlist[tlist.length] = fontSize - alm;
6355             if (isYokogaki) {
6356               x += fontSize;
6357               x -= alm;
6358             } else {
6359               y += fontSize;
6360             }
6361             ++n;
6362           }
6363           chars += tli;
6364           if (ti.parentNode && (ti.parentNode.localName === "a")) { //a要素が親である場合は、tiを親に戻しておく
6365             ti = ti.parentNode;
6366           }
6367           ti = ti.nextSibling;
6368         } else if (((ti.localName === "tspan") || (ti.localName === "tref"))
6369             && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
6370           /*現在のテキスト位置(x,y)の分だけ、tspan (tref)要素をずらしておく。
6371            *さらに、現在のテキスト位置を更新する
6372            */
6373           ti._stx = x;
6374           ti._sty = y;
6375           ti._chars = chars;
6376           p = ti.getStartPositionOfChar(ti.getNumberOfChars());
6377           almx = 0;
6378           almy = 0;
6379           tlist = ti._list;
6380           if (isYokogaki) {
6381             almx = tlist[tlist.length-1];
6382           } else {
6383             almy = tlist[tlist.length-1];
6384           }
6385           x = tlist[tlist.length-3] + almx;
6386           y = tlist[tlist.length-2] + almy;
6387           tar._list = tar._list.concat(tlist);
6388           tg = ti.getNumberOfChars();
6389           n += tg;
6390           chars += tg;
6391           ti = ti.nextSibling;
6392         } else if ((ti.localName === "a") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
6393           /*a要素のテキストノードも処理する*/
6394           ti = ti.firstChild;
6395         } else {
6396           ti = ti.nextSibling;
6397         }
6398       }
6399       tar._isYokogaki = isYokogaki //getEndPositionOfCharメソッドなどで使う
6400     }
6401     tar = ti = tp = ptx = pty = tx = ty = chars = style = x = y = isYokogaki = kern = akern = tt = alm = tdc = tcca = p = almx = almy = tlist = tg = void 0;
6402     var s = this.ownerDocument.documentElement.createSVGPoint();
6403     s.x = this._list[charnum*3];
6404     s.y = this._list[charnum*3 + 1];
6405     s = s.matrixTransform(this.getScreenCTM());
6406     return s;
6407   }
6408 };
6409 /*SVGPoint*/ t.prototype.getEndPositionOfChar = function(/*unsigned long*/ charnum ) {
6410   if (charnum > this.getNumberOfChars() || charnum < 0) {
6411     throw (new DOMException(DOMException.INDEX_SIZE_ERR));
6412   } else {
6413     var s = this.getStartPositionOfChar(charnum);
6414     //アドバンス値(すなわちフォントの大きさ)をCTMの行列式を用いて、算出する
6415     var n = this._list[charnum*3 + 2] * Math.sqrt(Math.abs(this.getScreenCTM()._determinant()));
6416     if (this._isYokogaki) {
6417       s.x += n;
6418     } else {
6419       s.y += n;
6420     }
6421     return s;
6422   }
6423 };
6424 /*SVGRect*/  t.prototype.getExtentOfChar = function(/*unsigned long*/ charnum ) {
6425   
6426 };
6427 /*float*/    t.prototype.getRotationOfChar = function(/*unsigned long*/ charnum ) {
6428   
6429 };
6430 /*long*/     t.prototype.getCharNumAtPosition = function(/*SVGPoint*/ point ) {
6431   
6432 };
6433 /*void*/     t.prototype.selectSubString = function(/*unsigned long*/ charnum,/*unsigned long*/ nchars ) {
6434   
6435 };
6436 })(SVGTextContentElement);
6437
6438 function SVGTextPositioningElement(_doc) { 
6439   SVGTextContentElement.apply(this, arguments);
6440   var sl = SVGAnimatedLengthList;
6441   /*readonly SVGAnimatedLengthList*/ this.x = new sl();
6442   /*readonly SVGAnimatedLengthList*/ this.y = new sl();
6443   /*readonly SVGAnimatedLengthList*/ this.dx = new sl();
6444   /*readonly SVGAnimatedLengthList*/ this.dy = new sl();
6445   sl = void 0;
6446   /*readonly SVGAnimatedNumberList*/ this.rotate = new SVGAnimatedNumberList();
6447   this.addEventListener("DOMAttrModified", function(evt){
6448     var tar = evt.target,
6449         name = evt.attrName,
6450         tod = tar.ownerDocument.documentElement,
6451         _parseFloat = parseFloat;
6452     if ((name === "x") || (name === "y") || (name === "dx") || (name === "dy")) {
6453       var enr = evt.newValue.replace(/^\s+|\s+$/g, "").split(/[\s,]+/),
6454           teas = tar[name].baseVal;
6455       for (var i=0, tli=enr.length;i<tli;++i) {
6456         var tea = tod.createSVGLength(),
6457             n = enr[i].slice(-1),
6458             type = 0;
6459         if (n >= "0" && n <= "9") {
6460           type = /*SVGLength.SVG_LENGTHTYPE_NUMBER*/ 1;
6461         } else if (n === "%") {
6462           if ((name === "x") || (name === "dx")) {
6463             tea._percent *= tod.viewport.width;
6464           } else if ((name === "y") || (name === "dy")) {
6465             tea._percent *= tod.viewport.height;
6466           }
6467           type = /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2;
6468         } else {
6469           n = enr[i].slice(-2);
6470           if (n === "em") {
6471             var style = tar.ownerDocument.defaultView.getComputedStyle(tar, null);
6472             tea._percent *= _parseFloat(style.getPropertyValue("font-size"));
6473             style = void 0;
6474             type = /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3;
6475           } else if (n === "ex") {
6476             type = /*SVGLength.SVG_LENGTHTYPE_EXS*/ 4;
6477           } else if (n === "px") {
6478             type = /*SVGLength.SVG_LENGTHTYPE_PX*/ 5;
6479           } else if (n === "cm") {
6480             type = /*SVGLength.SVG_LENGTHTYPE_CM*/ 6;
6481           } else if (n === "mm") {
6482             type = /*SVGLength.SVG_LENGTHTYPE_MM*/ 7;
6483           } else if (n === "in") {
6484             type = /*SVGLength.SVG_LENGTHTYPE_IN*/ 8;
6485           } else if (n === "pt") {
6486             type = /*SVGLength.SVG_LENGTHTYPE_PT*/ 9;
6487           } else if (n === "pc") {
6488             type = /*SVGLength.SVG_LENGTHTYPE_PC*/ 10;
6489           }
6490         }
6491         var s = _parseFloat(enr[i]);
6492         s = isNaN(s) ? 0 : s;
6493         tea.newValueSpecifiedUnits(type, s);
6494         teas.appendItem(tea);
6495       }
6496       tar._list = null;
6497     }
6498     evt = tar = void 0;
6499   }, false);
6500   this.addEventListener("DOMNodeInserted", function(evt){
6501     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
6502       var tar = evt.target;
6503       if (tar.nodeType !== /*Node.TEXT_NODE*/ 3) {
6504         tar._list = void 0;
6505         evt.currentTarget._list = null;
6506       }
6507       evt = tar = void 0;
6508     }
6509   }, false);
6510   if (_doc) {
6511     this._tar = _doc.createElement("v:group");
6512     this._doc = _doc; //_docプロパティは_texto関数内で使われる
6513   }
6514   this.addEventListener("DOMNodeInserted", function(evt){
6515     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
6516       return; //強制終了させる
6517     }
6518     var tar = evt.target,
6519         tnext = tar.nextSibling,
6520         tpart = tar.parentNode._tar,
6521         isLast = true;
6522     if (tnext && tnext._tar && tpart && (tnext._tar.parentNode === tpart)) {
6523       tpart.insertBefore(tar._tar, tnext._tar);
6524     } else if (tnext && !tnext._tar && tpart) {
6525       /*以下の処理は、_tarプロパティがない要素オブジェクトがあるため、それに対処するもの
6526        *use要素や実体参照などは_tarプロパティがないことに注意
6527        */
6528       while (tnext) {
6529         if (tnext._tar && (tnext._tar.parentNode === tpart)) {
6530           tpart.insertBefore(tar._tar, tnext._tar);
6531           isLast = false;
6532         } 
6533         tnext = tnext.nextSibling;
6534       }
6535       if (isLast) {
6536         tpart.appendChild(tar._tar);
6537       }
6538     } else if (!tnext && tpart) {
6539       tpart.appendChild(tar._tar);      
6540     }
6541     tnext = tpart = isLast = void 0;
6542     tar.addEventListener("DOMNodeInsertedIntoDocument", tar._texto, false);
6543     evt = tar = void 0;
6544   },false);
6545   return this;
6546 };
6547 SVGTextPositioningElement.constructor = SVGTextContentElement;
6548 SVGTextPositioningElement.prototype = new SVGTextContentElement();
6549 SVGTextPositioningElement.prototype._texto = function(evt) {
6550   var tar = evt.target,
6551       ti = tar.firstChild,
6552       ttp = tar._tar,
6553       style = tar.ownerDocument.defaultView.getComputedStyle(tar, null),
6554       deter = Math.sqrt(Math.abs(tar.getScreenCTM()._determinant())),
6555       n = parseFloat(style.getPropertyValue("font-size")) * deter,
6556       tod = tar.ownerDocument.documentElement,
6557       ttpc = ttp, //ttpcはttpのキャッシュ
6558       tlen = tar.getComputedTextLength(),
6559       anchor = style.getPropertyValue("text-anchor"),
6560       tedeco = style.getPropertyValue("text-decoration"), //text-decorationは継承しないので、個々に設定する
6561       ttps = ttp.style,
6562       ae = [],
6563       lts = parseFloat(style.getPropertyValue("letter-spacing")),
6564       wds = parseFloat(style.getPropertyValue("word-spacing"));
6565   ttps.fontSize = n + "px"; //nは算出された文字の大きさ (CSSではなく、SVG独自のCTM方式による)
6566   ttps.fontFamily = style.getPropertyValue("font-family");
6567   ttps.fontStyle = style.getPropertyValue("font-style");
6568   ttps.fontWeight = style.getPropertyValue("font-weight");
6569   if (isFinite(lts)) {
6570     ttps.letterSpacing = lts * deter + "px";
6571   }
6572   if (isFinite(parseFloat(wds))) {
6573     ttps.wordSpacing = wds * deter + "px";
6574   }
6575   /*ここでの変数jは前回ノードまでの総文字数*/
6576   for (var i=0, j=0, tli=tar.getNumberOfChars();i<tli;++i) {
6577     if (ti) {
6578       if (!!ti._tars && (ti._tars.length !== 0)) {
6579         var ij = (i > j) ? i - j : j - i
6580         var sty = ti._tars[ij].style,
6581             p = tar.getStartPositionOfChar(i);
6582         sty.position = "absolute";
6583         if (tar._isYokogaki) {
6584           if (anchor === "middle") {
6585             p.x -= tlen / 2;
6586           } else if (anchor === "end") {
6587             p.x -= tlen;
6588           }
6589         } else {
6590           if (anchor === "middle") {
6591             p.y -= tlen / 2;
6592           } else if (anchor === "end") {
6593             p.y -= tlen;
6594           }
6595         }
6596         sty.left = p.x + "px";
6597         sty.top = p.y + "px";
6598         sty.width = "0px";
6599         sty.height = "0px";
6600         sty.marginTop = tar._isYokogaki ? -n-5+ "px" : "-5px";
6601         sty.lineHeight = n+10+ "px";
6602         sty.textDecoration = tedeco;
6603         sty.display = "none"
6604         ttp.appendChild(ti._tars[ij]);
6605         sty = p = void 0;
6606       }
6607       if (ti.nodeName === "#text") {
6608         if ((ti.data.length+j) <= i+1) { //テキストノード内の文字をすべて処理し終えれば
6609           j = j + ti.data.length;
6610           if (ti.parentNode.localName === "a") {
6611             ti =  ti.parentNode;
6612             ttp = ttpc;
6613           }
6614           ti = ti.nextSibling;
6615         }
6616       } else if (!!ti.getNumberOfChars) {
6617           if ((ti.getNumberOfChars()+j) <= i+1) {
6618             j = j + ti.getNumberOfChars();
6619             ti = ti.nextSibling;
6620           }
6621       } else if ((ti.localName === "a") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
6622         ttp = ti._tar;
6623         ti = ti.firstChild;
6624         ae[ae.length] = ti;
6625         i-=2;
6626       }
6627     }
6628   }
6629   var color = style.getPropertyValue("fill"),
6630       cursor = style.getPropertyCSSValue("cursor"),
6631       vis = style.getPropertyCSSValue("visibility"),
6632       disp = style.getPropertyCSSValue("display"),
6633       tts = tar._tar.style,
6634       tft = tar.firstChild._tars, //空白のテキストノードの場合、tftがundefinedになる恐れがある
6635       ttt = tft[0] ? tft[0].innerText.charAt(0) : [""], //あらかじめ初期化しておく
6636       tfti;
6637   if (color === "none"){
6638     tts.color = "transparent";
6639   } else if (color.indexOf("url") === -1) {
6640     tts.color = color;
6641   } else {
6642     tts.color = "black";
6643   }
6644   if (cursor && !cursor._isDefault) { //初期値でないならば
6645     var tc = cursor.cssText;
6646     tts.cursor = tc.split(":")[1];
6647     tc = void 0;
6648   }
6649   if ((tar.x.baseVal.numberOfItems === 1) && (tar.y.baseVal.numberOfItems === 1)
6650       && tar._isYokogaki && (tar.firstChild.nodeName === "#text")) {
6651     /*xとy属性が一つの値しか取らないとき、字詰めの処理をすべてブラウザに任せておく。
6652      *以下では、他のdiv要素のテキストをすべて、最初のdiv要素にまとめている
6653      */
6654     for (var i=1, tli=tft.length;i<tli;++i) {
6655       tfti = tft[i];
6656       ttt += tfti.innerText;
6657       tfti.parentNode.removeChild(tfti);
6658     }
6659     //以下でinnerTextやinnerHTMLを使うのは、IE6でエラーとなる可能性がある
6660     if (tft[0] && tft[0].replaceChild) {
6661       tft[0].replaceChild(tar._doc.createTextNode(ttt), tft[0].firstChild);
6662     }
6663     ttt = void 0;
6664   }
6665   var isRect = true,
6666       di = "block";
6667   if (ttp.lastChild) {
6668     if (ttp.lastChild.nodeName !== "rect") {
6669       isRect = false;
6670     }
6671   } else {
6672     isRect = false;
6673   }
6674   if (!isRect) {
6675     var backr = tar._doc.createElement("v:rect"),
6676         backrs = backr.style; //ずれを修正するためのもの
6677     backrs.width = backrs.height = "1px";
6678     backrs.left = backrs.top = "0px";
6679     backr.stroked = backr.filled = "false";
6680     ttp.appendChild(backr);
6681   }
6682   if (vis && !vis._isDefault) {
6683     tts.visibility = vis.cssText.split(":")[1];
6684   }
6685   /*dipslayプロパティだけはdiv要素の個々に設定しておく必要がある
6686    *なぜかといえば、div要素をdisplay:none;であらかじめ設定しているため。
6687    */
6688   if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) {
6689     di = "none";
6690         } else if (disp && !disp._isDefault) {
6691     di = "block";
6692   }
6693   var jt = tar._tar.firstChild,
6694       j = 0;
6695   while (jt) {
6696     jt.style.display = di;
6697     jt = jt.nextSibling;
6698   }
6699   while (ae[j]) { //要素内部にあるa要素の処理
6700     for (var l=0, tli=ae[j]._tars.length;l<tli;++l) {
6701       ae[j]._tars[l].style.display = di;
6702     }
6703     l = void 0;
6704     ++j;
6705   }
6706   delete tar._cacheMatrix;
6707   ae = isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = di = tft = jt = lts = deter = void 0;
6708 };
6709
6710 function SVGTextElement(_doc) {
6711   SVGTextPositioningElement.apply(this, arguments);
6712   return this;
6713 };
6714 SVGTextElement.constructor = SVGTextPositioningElement;
6715 SVGTextElement.prototype = new SVGTextPositioningElement();
6716
6717 function SVGTSpanElement() {
6718   SVGTextElement.apply(this, arguments);
6719   return this;
6720 };
6721 SVGTSpanElement.constructor = SVGTextPositioningElement;
6722 SVGTSpanElement.prototype = new SVGTextPositioningElement();
6723
6724 function SVGTRefElement(_doc) {
6725   SVGTextPositioningElement.apply(this, arguments);
6726   this.addEventListener("DOMNodeInserted", function(evt){
6727     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
6728       return; //強制終了させる
6729     }
6730     evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
6731   }, false);
6732   this.addEventListener("S_Load", function(evt){
6733     var tar = evt.target,
6734         tic = tar._instance.firstChild;
6735     /*textノードのデータだけを処理*/
6736     while (tic && (tic.nodeName !== "#text")) {
6737       tic = tic.nextSibling;
6738     }
6739     tic && tar.parentNode.insertBefore(tar.ownerDocument.importNode(tic, false), tar);
6740     evt.target = tar.parentNode;
6741     tar.parentNode._texto(evt);
6742     tar = tic = evtt = void 0;
6743   }, false);
6744   SVGURIReference.apply(this, arguments);
6745   return this;
6746 };
6747 SVGTRefElement.constructor = SVGTextPositioningElement;
6748 SVGTRefElement.prototype = new SVGTextPositioningElement();
6749
6750 function SVGTextPathElement() { 
6751   SVGTextContentElement.apply(this, arguments);
6752   /*readonly SVGAnimatedLength*/      this.startOffset;
6753   /*readonly SVGAnimatedEnumeration*/ this.method;
6754   /*readonly SVGAnimatedEnumeration*/ this.spacing;
6755   SVGURIReference.apply(this, arguments);
6756   return this;
6757 };
6758 SVGTextPathElement.constructor = SVGTextContentElement;
6759 SVGTextPathElement.prototype = new SVGTextContentElement();
6760
6761 (function(t){
6762     // textPath Method Types
6763   /*unsigned short*/ t.TEXTPATH_METHODTYPE_UNKNOWN   = 0;
6764   /*unsigned short*/ t.TEXTPATH_METHODTYPE_ALIGN     = 1;
6765   /*unsigned short*/ t.TEXTPATH_METHODTYPE_STRETCH     = 2;
6766     // textPath Spacing Types
6767   /*unsigned short*/ t.TEXTPATH_SPACINGTYPE_UNKNOWN   = 0;
6768   /*unsigned short*/ t.TEXTPATH_SPACINGTYPE_AUTO     = 1;
6769   /*unsigned short*/ t.TEXTPATH_SPACINGTYPE_EXACT     = 2;
6770 })(SVGTextPathElement);
6771
6772 function SVGAltGlyphElement() { 
6773   SVGTextPositioningElement.apply(this, arguments);
6774   /*DOMString*/ this.glyphRef;
6775   /*DOMString*/ this.format;
6776   SVGURIReference.apply(this, arguments);
6777   return this;
6778 };
6779 SVGAltGlyphElement.constructor = SVGTextPositioningElement;
6780 SVGAltGlyphElement.prototype = new SVGTextPositioningElement();
6781
6782 function SVGAltGlyphDefElement() {
6783   SVGElement.apply(this, arguments);
6784   return this;
6785 };
6786 SVGAltGlyphDefElement.prototype = new SVGElement();
6787
6788 function SVGAltGlyphItemElement() {
6789   SVGElement.apply(this, arguments);
6790   return this;
6791 };
6792 SVGAltGlyphItemElement.prototype = new SVGElement();
6793
6794 function SVGGlyphRefElement() { 
6795   SVGElement.apply(this, arguments);
6796   /*DOMString*/ this.glyphRef;
6797   /*DOMString*/ this.format;
6798   /*float*/    this.x;
6799   /*float*/    this.y;
6800   /*float*/    this.dx;
6801   /*float*/    this.dy;
6802   SVGURIReference.apply(this, arguments);
6803   return this;
6804 };
6805 SVGGlyphRefElement.prototype = new SVGElement();
6806
6807 function SVGPaint() { 
6808   SVGColor.apply(this, arguments);
6809   return this;
6810 };
6811
6812 (function(t){
6813 t.prototype = new SVGColor();
6814     // Paint Types
6815   /*unsigned short*/ t.SVG_PAINTTYPE_UNKNOWN               = 0;
6816   /*unsigned short*/ t.SVG_PAINTTYPE_RGBCOLOR              = 1;
6817   /*unsigned short*/ t.SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR     = 2;
6818   /*unsigned short*/ t.SVG_PAINTTYPE_NONE                  = 101;
6819   /*unsigned short*/ t.SVG_PAINTTYPE_CURRENTCOLOR          = 102;
6820   /*unsigned short*/ t.SVG_PAINTTYPE_URI_NONE              = 103;
6821   /*unsigned short*/ t.SVG_PAINTTYPE_URI_CURRENTCOLOR      = 104;
6822   /*unsigned short*/ t.SVG_PAINTTYPE_URI_RGBCOLOR          = 105;
6823   /*unsigned short*/ t.SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106;
6824   /*unsigned short*/ t.SVG_PAINTTYPE_URI                   = 107;
6825   /*readonly unsigned short*/ t.prototype.paintType = t.SVG_PAINTTYPE_UNKNOWN;
6826   /*readonly DOMString*/      t.prototype.uri = null;
6827 /*void*/ t.prototype.setUri = function(/*DOMString*/ uri ) {
6828   this.setPaint(SVGPaint.SVG_PAINTTYPE_URI_NONE, uri, null, null);
6829 };
6830 /*void*/ t.prototype.setPaint = function(/*unsigned short*/ paintType, /*DOMString*/ uri, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ) {
6831   if ((paintType < 101 && uri) || (paintType > 102 && !uri)) {
6832     throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR);
6833   }
6834   this.uri = uri;
6835   this.paintType = paintType;
6836   if (paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
6837     paintType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
6838   }
6839   this.setColor(paintType, rgbColor, iccColor); //SVGColorのsetColorメソッドを用いる
6840 };
6841 //                    raises( SVGException );
6842 t = void 0;
6843 })(SVGPaint);
6844
6845 function SVGMarkerElement(){ 
6846   SVGElement.apply(this);
6847   var sl = SVGAnimatedLength;
6848   /*readonly SVGAnimatedLength*/      this.refX = new sl();
6849   /*readonly SVGAnimatedLength*/      this.refY = new sl();
6850   /*readonly SVGAnimatedEnumeration*/ this.markerUnits = new SVGAnimatedEnumeration();
6851   /*readonly SVGAnimatedLength*/      this.markerWidth = new sl();
6852   /*readonly SVGAnimatedLength*/      this.markerHeight = new sl();
6853   sl = void 0;
6854   /*readonly SVGAnimatedEnumeration*/ this.orientType = new SVGAnimatedEnumeration();
6855   /*readonly SVGAnimatedAngle*/       this.orientAngle = new SVGAnimatedAngle();
6856     //SVGFitToViewBoxのインターフェースを用いる
6857   /*readonly SVGAnimatedRect*/   this.viewBox = new SVGAnimatedRect();
6858   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();
6859   /*unsigned short*/             this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
6860   return this;
6861 };
6862 (function(t){
6863     // Marker Unit Types
6864   /*unsigned short*/ t.SVG_MARKERUNITS_UNKNOWN        = 0;
6865   /*unsigned short*/ t.SVG_MARKERUNITS_USERSPACEONUSE = 1;
6866   /*unsigned short*/ t.SVG_MARKERUNITS_STROKEWIDTH    = 2;
6867     // Marker Orientation Types
6868   /*unsigned short*/ t.SVG_MARKER_ORIENT_UNKNOWN      = 0;
6869   /*unsigned short*/ t.SVG_MARKER_ORIENT_AUTO         = 1;
6870   /*unsigned short*/ t.SVG_MARKER_ORIENT_ANGLE        = 2;
6871 t.prototype = new SVGElement();
6872 /*void*/ t.prototype.setOrientToAuto = function() {
6873   
6874 };
6875 /*void*/ t.prototype.setOrientToAngle = function(/*SVGAngle*/ angle ) {
6876   
6877 };
6878 })(SVGMarkerElement);
6879 function SVGColorProfileElement() { 
6880   SVGElement.apply(this);
6881   /*DOMString*/      this._local;
6882                          // raises DOMException on setting
6883                        // (NOTE: is prefixed by "_"
6884                        // as "local" is an IDL keyword. The
6885                        // prefix will be removed upon processing)
6886   /*DOMString*/      this.name;
6887   /*unsigned short*/ this.renderingIntent;
6888   SVGURIReference.apply(this, arguments);
6889   return this;
6890 };
6891 SVGColorProfileElement.prototype = new SVGElement();
6892
6893 function SVGColorProfileRule() { 
6894   SVGCSSRule.apply(this);
6895   /*DOMString*/      this.src;
6896   /*DOMString*/      this.name;
6897   /*unsigned short*/ this.renderingIntent;
6898   return this;
6899 };
6900 SVGColorProfileRule.prototype = new SVGCSSRule();
6901
6902 function SVGGradientElement() { 
6903   SVGElement.apply(this);
6904   SVGURIReference.apply(this);
6905   /*readonly SVGAnimatedEnumeration*/   this.gradientUnits = new SVGAnimatedEnumeration();
6906   /*readonly SVGAnimatedTransformList*/ this.gradientTransform = new SVGAnimatedTransformList();
6907   /*readonly SVGAnimatedEnumeration*/   this.spreadMethod = new SVGAnimatedEnumeration();
6908   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
6909     var grad = evt.target,
6910         ele = evt._tar,
6911         t = evt._style, //eleはv:fill要素やv:stroke要素のノード、tはラップした要素ノードのスタイルを収納
6912         grad2 = grad,
6913         href, stops, length,
6914         color = [],
6915         colors = [],
6916         opacity = [],
6917         stop, sstyle, ci;
6918     if (!ele || !grad) { //まだ、path要素などが設定されていない場合
6919       grad = ele = t = grad2 = href = stops = length = color = colors = opacity = void 0;
6920       return;
6921     }
6922     if (grad._instance) { //xlink言語で呼び出されたノードが_instanceに収納されているならば
6923       grad2 = grad._instance;
6924     }
6925     stops = grad2.getElementsByTagNameNS("http://www.w3.org/2000/svg", "stop");
6926     if (!stops) {
6927       ele = t = href = grad = grad2 = stops = color = colors = opacity = void 0;
6928       return;
6929     }
6930     length = stops.length;
6931     for (var i = 0; i < length; ++i) {
6932       stop = stops[i];
6933       sstyle = stop.ownerDocument.defaultView.getComputedStyle(stop, "");
6934       ci = sstyle.getPropertyCSSValue("stop-color");
6935       if (ci && (ci.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
6936         /*再度、設定。css.jsのsetPropertyを参照*/
6937         sstyle.setProperty("color", sstyle.getPropertyValue("color"));
6938       }
6939       color[i] =  "rgb(" +ci.rgbColor.red.getFloatValue(1)+ "," +ci.rgbColor.green.getFloatValue(1)+ "," +ci.rgbColor.blue.getFloatValue(1)+ ")";
6940       colors[i] = stop.offset.baseVal + " " + color[i];
6941       opacity[i] = (sstyle.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity");
6942     }
6943     ele["method"] = "none";
6944     ele["color"] = color[0];
6945     ele["color2"] = color[length-1];
6946     ele["colors"] = colors.join(",");
6947     // When colors attribute is used, the meanings of opacity and o:opacity2 are reversed.
6948     ele["opacity"] = opacity[length-1]+ "";
6949     ele["o:opacity2"] = opacity[0]+ "";
6950     /*SVGRadialGradientElementインターフェースで利用する*/
6951     grad._color = color;
6952     var gt = grad2.getAttributeNS(null, "gradientTransform");
6953     if (gt) {
6954       grad.setAttributeNS(null, "transform", gt);
6955     }
6956     grad = grad2 = ele = stops = length = color = colors = opacity = evt = t = href = stop = sstyle = ci = void 0;
6957   }, false);
6958   return this;
6959 };
6960 SVGGradientElement.prototype = new SVGElement();
6961     // Spread Method Types
6962   /*unsigned short*/ SVGGradientElement.SVG_SPREADMETHOD_UNKNOWN = 0;
6963   /*unsigned short*/ SVGGradientElement.SVG_SPREADMETHOD_PAD     = 1;
6964   /*unsigned short*/ SVGGradientElement.SVG_SPREADMETHOD_REFLECT = 2;
6965   /*unsigned short*/ SVGGradientElement.SVG_SPREADMETHOD_REPEAT  = 3;
6966
6967 function SVGLinearGradientElement() { 
6968   SVGGradientElement.apply(this);
6969   var sl = SVGAnimatedLength;
6970   /*readonly SVGAnimatedLength*/ this.x1 = new sl();
6971   /*readonly SVGAnimatedLength*/ this.y1 = new sl();
6972   /*readonly SVGAnimatedLength*/ this.x2 = new sl();
6973   /*readonly SVGAnimatedLength*/ this.y2 = new sl();
6974   sl = void 0;
6975   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
6976     var grad = evt.target, ele = evt._tar, angle = 270;
6977     if (!!!ele) { //まだ、path要素などが設定されていない場合
6978       return;
6979     }
6980     var style = grad.ownerDocument.defaultView.getComputedStyle(grad, "");
6981     var fontSize = parseFloat(style.getPropertyValue("font-size"));
6982     grad.x1.baseVal._emToUnit(fontSize);
6983     grad.y1.baseVal._emToUnit(fontSize);
6984     grad.x2.baseVal._emToUnit(fontSize);
6985     grad.y2.baseVal._emToUnit(fontSize);
6986     angle = 270 - Math.atan2(grad.y2.baseVal.value-grad.y1.baseVal.value, grad.x2.baseVal.value-grad.x1.baseVal.value) * 180 / Math.PI;
6987     if (angle >= 360) {
6988       angle -= 360;
6989     }
6990     ele.setAttribute("type", "gradient");
6991     ele.setAttribute("angle", angle + "");
6992     evt = ele = grad = angle = style = fontSize = void 0;
6993   }, false);
6994   return this;
6995 };
6996 SVGLinearGradientElement.prototype = new SVGGradientElement();
6997
6998 function SVGRadialGradientElement(_doc) { 
6999   SVGGradientElement.apply(this);
7000   var sl = SVGAnimatedLength;
7001   /*readonly SVGAnimatedLength*/ this.cx = new sl();
7002   /*readonly SVGAnimatedLength*/ this.cy = new sl();
7003   /*readonly SVGAnimatedLength*/ this.r = new sl();
7004   /*readonly SVGAnimatedLength*/ this.fx = new sl();
7005   /*readonly SVGAnimatedLength*/ this.fy = new sl();
7006   sl = void 0;
7007   this.cx.baseVal.value = this.cy.baseVal.value = this.r.baseVal.value = 0.5;
7008   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
7009     var grad = evt.target,
7010         ele = evt._tar,
7011         tar = evt._ttar; //eleはv:fill要素。tarはターゲットとになる要素
7012     if (!!!ele) { //まだ、path要素などが設定されていない場合
7013       return;
7014     }
7015     ele.setAttribute("type", "gradientTitle");
7016     ele.setAttribute("focus", "100%");
7017     ele.setAttribute("focusposition", "0.5 0.5");
7018     if (tar.localName === "rect") {
7019       /*VMLでは、図の形状に沿って、円状のグラデーションを処理するようになっているため、
7020        *四角だとおかしな模様が出てしまう。以下はそれを避ける処理
7021        */
7022       var style = grad.ownerDocument.defaultView.getComputedStyle(tar, ""),
7023           fontSize = parseFloat(style.getPropertyValue("font-size"));
7024       grad.cx.baseVal._emToUnit(fontSize);
7025       grad.cy.baseVal._emToUnit(fontSize);
7026       grad.r.baseVal._emToUnit(fontSize);
7027       grad.fx.baseVal._emToUnit(fontSize);
7028       grad.fy.baseVal._emToUnit(fontSize);
7029       var cx = grad.cx.baseVal.value,
7030           cy = grad.cy.baseVal.value,
7031           r = grad.r.baseVal.value,
7032           mr = Math.round,
7033           rx, ry;
7034       rx = ry = r;
7035       var tarrect = tar.getBBox(),
7036           vi = tar.ownerDocument.documentElement.viewport,
7037           el = mr(vi.width),
7038           et = mr(vi.height),
7039           er = 0,
7040           eb = 0,
7041           units = grad.getAttributeNS(null, "gradientUnits");
7042       if (!units || units === "objectBoundingBox") {
7043         //%の場合は小数点に変換(10% -> 0.1)
7044         cx = cx > 1 ? cx/100 : cx;
7045         cy = cy > 1 ? cy/100 : cy;
7046         r = r > 1 ? r/100 : r;
7047         //要素の境界領域を求める(四隅の座標を求める)
7048         var nx = tarrect.x,
7049             ny = tarrect.y,
7050             wid = tarrect.width,
7051             hei = tarrect.height;
7052         cx = cx*wid + nx;
7053         cy = cy*hei + ny;
7054         rx = r*wid;
7055         ry = r*hei;
7056         nx = ny = wid = hei = void 0;
7057       }
7058       var matrix = tar.getScreenCTM().multiply(grad.getCTM());
7059       el = cx - rx;
7060       et = cy - ry;
7061       er = cx + rx;
7062       eb = cy + ry;
7063       var rrx = rx * 0.55228,
7064           rry = ry * 0.55228,
7065           list = ["m", cx,et, "c", cx-rrx,et, el,cy-rry, el,cy, el,cy+rry, cx-rrx,eb, cx,eb, cx+rrx,eb, er,cy+rry, er,cy, er,cy-rry, cx+rrx,et, cx,et, "x e"];
7066       for (var i = 0, lili = list.length; i < lili;) {
7067         if (isNaN(list[i])) { //コマンド文字は読み飛ばす
7068           ++i;
7069           continue;
7070         }
7071         var p = grad.ownerDocument.documentElement.createSVGPoint();
7072         p.x = parseFloat(list[i]);
7073         p.y = parseFloat(list[i+1]);
7074         var pmt = p.matrixTransform(matrix);
7075         list[i] = mr(pmt.x);
7076         i++;
7077         list[i] = mr(pmt.y);
7078         i++;
7079         p = pmt = void 0;
7080       }
7081       var ellipse = list.join(" "),
7082           outline = _doc.getElementById("_NAIBU_outline"),
7083           background = _doc.createElement("div"),
7084           bstyle = background.style;
7085       bstyle.position = "absolute";
7086       bstyle.display = "inline-block";
7087       var w = vi.width,
7088           h = vi.height;
7089       bstyle.textAlign = "left";
7090       bstyle.top = "0px";
7091       bstyle.left = "0px";
7092       bstyle.width = w+ "px";
7093       bstyle.height = h+ "px";
7094       outline.appendChild(background);
7095       bstyle.filter = "progid:DXImageTransform.Microsoft.Compositor";
7096       background.filters.item('DXImageTransform.Microsoft.Compositor').Function = 23;
7097       var circle = '<v:shape style="display:inline-block; position:relative; antialias:false; top:0px; left:0px;" coordsize="' +w+ ' ' +h+ '" path="' +ellipse+ '" stroked="f">' +ele.outerHTML+ '</v:shape>',
7098           data = tar._tar.path.value;
7099       background.innerHTML = '<v:shape style="display:inline-block; position:relative; top:0px; left:0px;" coordsize="' +w+ ' ' +h+ '" path="' +data+ '" stroked="f" fillcolor="' +grad._color[grad._color.length-1]+ '" ></v:shape>';
7100       background.filters[0].apply();
7101       background.innerHTML = circle;
7102       background.filters[0].play();
7103       tar._tar.parentNode.insertBefore(background, tar._tar);
7104       tar._tar.filled = "false";
7105       ellipse = outline = background = style = fontSize = bstyle = circle = data = list = mr = gt = cx = cy = r = w = h = matrix = void 0;
7106     } else if (!ele.parentNode){
7107       tar._tar.appendChild(ele);
7108     }
7109     evt = tar = ele = gard = void 0;
7110   }, false);
7111   return this;
7112 };
7113 SVGRadialGradientElement.prototype = new SVGGradientElement();
7114
7115 function SVGStopElement() { 
7116   SVGElement.apply(this, arguments);
7117   /*readonly SVGAnimatedNumber*/ this.offset = new SVGAnimatedNumber();
7118   this.addEventListener("DOMAttrModified", function(evt) {
7119     if (evt.attrName === "offset") {
7120       evt.target.offset.baseVal = parseFloat(evt.newValue);
7121     }
7122     evt = void 0;
7123   }, false);
7124   return this;
7125 };
7126 SVGStopElement.prototype = new SVGElement();
7127
7128 function SVGPatternElement() { 
7129   SVGElement.apply(this);
7130   var sl = SVGAnimatedLength;
7131   /*readonly SVGAnimatedEnumeration*/   this.patternUnits = new SVGAnimatedEnumeration();
7132   /*readonly SVGAnimatedEnumeration*/   this.patternContentUnits = new SVGAnimatedEnumeration();
7133   /*readonly SVGAnimatedTransformList*/ this.patternTransform = new SVGAnimatedTransformList();
7134   /*readonly SVGAnimatedLength*/        this.x = new sl();
7135   /*readonly SVGAnimatedLength*/        this.y = new sl();
7136   /*readonly SVGAnimatedLength*/        this.width = new sl();
7137   /*readonly SVGAnimatedLength*/        this.height = new sl();
7138   sl = void 0;
7139   SVGURIReference.apply(this, arguments);
7140     //SVGFitToViewBoxのインターフェースを用いる
7141   /*readonly SVGAnimatedRect*/   this.viewBox = new SVGAnimatedRect();
7142   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();
7143   /*unsigned short*/             this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
7144   return this;
7145 };
7146 SVGPatternElement.prototype = new SVGElement();
7147
7148 function SVGClipPathElement() { 
7149   SVGElement.apply(this, arguments);
7150   /*readonly SVGAnimatedEnumeration*/ this.clipPathUnits = new SVGAnimatedEnumeration();
7151   return this;
7152 };
7153 SVGClipPathElement.prototype = new SVGElement();
7154
7155 function SVGMaskElement() { 
7156   SVGElement.apply(this);
7157   var sl = SVGAnimatedLength;
7158   /*readonly SVGAnimatedEnumeration*/ this.maskUnits = new SVGAnimatedEnumeration();
7159   /*readonly SVGAnimatedEnumeration*/ this.maskContentUnits = new SVGAnimatedEnumeration();
7160   /*readonly SVGAnimatedLength*/      this.x = new sl();
7161   /*readonly SVGAnimatedLength*/      this.y = new sl();
7162   /*readonly SVGAnimatedLength*/      this.width = new sl();
7163   /*readonly SVGAnimatedLength*/      this.height = new sl();
7164   sl = void 0;
7165   return this;
7166 };
7167 SVGMaskElement.prototype = new SVGElement();
7168
7169 function SVGFilterElement() { 
7170   SVGElement.apply(this);
7171   var sl = SVGAnimatedLength;
7172   /*readonly SVGAnimatedEnumeration*/ this.filterUnits = new SVGAnimatedEnumeration();
7173   /*readonly SVGAnimatedEnumeration*/ this.primitiveUnits = new SVGAnimatedEnumeration();
7174   /*readonly SVGAnimatedLength*/      this.x = new sl();
7175   /*readonly SVGAnimatedLength*/      this.y = new sl();
7176   /*readonly SVGAnimatedLength*/      this.width = new sl();
7177   /*readonly SVGAnimatedLength*/      this.height = new sl();
7178   sl = void 0;
7179   /*readonly SVGAnimatedInteger*/     this.filterResX = new SVGAnimatedInteger();
7180   /*readonly SVGAnimatedInteger*/     this.filterResY = new SVGAnimatedInteger();
7181   SVGURIReference.apply(this, arguments);
7182   //setFilterRes (/*unsigned long*/ filterResX,/*unsigned long*/ filterResY );
7183   return this;
7184 };
7185 SVGFilterElement.prototype = new SVGElement();
7186
7187 function SVGFilterPrimitiveStandardAttributes(ele) { 
7188   SVGStylable.apply(this, arguments);
7189   this._tar = ele;
7190   var sl = SVGAnimatedLength;
7191   /*readonly SVGAnimatedLength*/ this.x = new sl();
7192   /*readonly SVGAnimatedLength*/ this.y = new sl();
7193   /*readonly SVGAnimatedLength*/ this.width = new sl();
7194   /*readonly SVGAnimatedLength*/ this.height = new sl();
7195   /*readonly SVGAnimatedString*/ this.result = new sl();
7196   sl = void 0;
7197   };
7198 SVGFilterPrimitiveStandardAttributes.prototype = new SVGStylable();
7199
7200 function SVGFEBlendElement() {
7201   SVGElement.apply(this, arguments);
7202   /*readonly SVGAnimatedString*/      this.in1 = new SVGAnimatedString();
7203   /*readonly SVGAnimatedString*/      this.in2 = new SVGAnimatedString();
7204   /*readonly SVGAnimatedEnumeration*/ this.mode = new SVGAnimatedEnumeration();
7205   this._fpsa = SVGFilterPrimitiveStandardAttributes(this);
7206   return this;
7207 };
7208 SVGFEBlendElement.prototype = new SVGElement();
7209     // Blend Mode Types
7210   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_UNKNOWN  = 0;
7211   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL   = 1;
7212   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_MULTIPLY = 2;
7213   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_SCREEN   = 3;
7214   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_DARKEN   = 4;
7215   /*unsigned short*/ SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN  = 5;
7216
7217 function SVGFEGaussianBlurElement() { 
7218   SVGElement.apply(this, arguments);
7219   /*readonly SVGAnimatedString*/ this.in1 = new SVGAnimatedString();
7220   /*readonly SVGAnimatedNumber*/ this.stdDeviationX = new SVGAnimatedNumber();
7221   /*readonly SVGAnimatedNumber*/ this.stdDeviationY = new SVGAnimatedNumber();
7222   this._fpsa = SVGFilterPrimitiveStandardAttributes(this);
7223   return this;
7224 };
7225 SVGFEGaussianBlurElement.prototype = new SVGElement();
7226 /*void*/ SVGFEGaussianBlurElement.prototype.setStdDeviation = function(/*float*/ stdDeviationX, /*float*/ stdDeviationY ) {
7227   
7228 };
7229
7230 function SVGCursorElement() { 
7231   SVGElement.apply(this, arguments);
7232   /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength();
7233   /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength();
7234   SVGURIReference.apply(this, arguments);
7235   return this;
7236 };
7237 SVGCursorElement.prototype = new SVGElement();
7238
7239 function SVGAElement(_doc) {
7240   SVGElement.apply(this);
7241   this._tar = _doc.createElement("a");
7242   _doc = void 0;
7243   /*readonly SVGAnimatedString*/ this.target = new SVGAnimatedString();
7244   this.target.baseVal = "_self";
7245   this.addEventListener("DOMAttrModified", function(evt){
7246     var tar = evt.target;
7247     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7248       return; //強制終了させる
7249     }
7250     if (evt.attrName === "target") {
7251       tar.target.baseVal = evt.newValue;
7252     } else if (evt.attrName === "xlink:title") {
7253       tar._tar.setAttribute("title", evt.newValue);
7254     }
7255     evt = void 0;
7256   }, false);
7257   this.addEventListener("DOMNodeInserted", function(evt){
7258     var tar = evt.target;
7259     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7260       return; //強制終了させる
7261     }
7262     if (tar.nextSibling) {
7263       if (!!tar.parentNode._tar && !!tar.nextSibling._tar) {
7264         tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar);
7265       }
7266     } else if (!!tar.parentNode._tar){
7267       tar.parentNode._tar.appendChild(tar._tar);
7268     }
7269     var txts = tar._tar.style;
7270     txts.cursor = "hand";
7271     txts.left = "0px";
7272     txts.top = "0px";
7273     txts.textDecoration = "none";
7274     txts = void 0;
7275     var t = tar.target.baseVal;
7276     var st = "replace";
7277     if (t === "_blank") {
7278       st = "new";
7279     }
7280     tar.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", st);
7281     tar._tar.style.color = tar.ownerDocument.defaultView.getComputedStyle(tar, "").getPropertyValue("fill");
7282     tar = evt = void 0;
7283   }, false);
7284   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
7285     var tar = evt.target;
7286     if (!!tar._tar && (tar.nodeType === /*Node.ELEMENT_NODE*/ 1)) {
7287       var txts = tar._tar.style;
7288       txts.cursor = "hand";
7289       txts.textDecoration = "none";
7290       txts = void 0;
7291     }
7292     tar = evt = void 0;
7293     return; //強制終了させる
7294   }, true);
7295   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
7296     var tar = evt.target;
7297     tar._tar.setAttribute("target", tar.target.baseVal);
7298     if (tar.href.baseVal.indexOf(".svg") !== -1) { //もし、リンク先がSVGファイルならば
7299       tar.addEventListener("click", function(evt){
7300           var tar = evt.target,
7301               sd = document.body,
7302               ob, nd;
7303           sd.lastChild.innerHTML = "<object data='" +tar.href.baseVal.split("#")[0]+ "' width='" +screen.width+ "' height='" +screen.height+ "' type='image/svg+xml'></object>";
7304           if (tar.target.baseVal === "_self") {
7305             nd = tar.ownerDocument._iframe;
7306             nd.parentNode.insertBefore(sd.lastChild.firstChild, nd);
7307             ob = nd.nextSibling;
7308             if (ob && (ob.tagName === "OBJECT")) {
7309               nd.previousSibling.setAttribute("width", ob.getAttribute("width"));
7310               nd.previousSibling.setAttribute("height", ob.getAttribute("height"));
7311               nd.parentNode.removeChild(ob);
7312             }
7313             ob = NAIBU._search([nd.previousSibling]);
7314             nd.parentNode.removeChild(nd);
7315           } else {
7316             sd.appendChild(sd.lastChild.firstChild);
7317             while (sd.firstChild !== sd.lastChild) {     //オブジェクト要素以外を除去
7318               sd.removeChild(sd.firstChild);
7319             }
7320             ob = NAIBU._search([sd.lastChild]);
7321           }
7322           NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
7323           evt.preventDefault();
7324           ob._next = {
7325             _init: (function (ob) {
7326               return (function(){
7327                 document.title = ob.getSVGDocument().title;
7328                 ob = void 0;
7329               });
7330             })(ob)
7331           };
7332           ob._init();
7333           sd = ob = nd = void 0;
7334       }, false);
7335     }
7336     tar = void 0;
7337   }, false);
7338   SVGURIReference.apply(this, arguments);
7339   return this;
7340 };
7341 SVGAElement.prototype = new SVGElement();
7342
7343 function SVGViewElement() { 
7344   SVGElement.apply(this, arguments);
7345   /*readonly SVGStringList*/ this.viewTarget = new SVGStringList();
7346       //SVGFitToViewBoxのインターフェースを用いる
7347   /*readonly SVGAnimatedRect*/   this.viewBox = new SVGAnimatedRect();
7348   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();
7349   /*unsigned short*/             this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
7350   return this;
7351 };
7352 SVGViewElement.prototype = new SVGElement();
7353
7354 function SVGScriptElement() { 
7355   SVGElement.apply(this);
7356   /*DOMString*/ this.type;
7357   SVGURIReference.apply(this, arguments);
7358   this.addEventListener("DOMAttrModified", function(evt){
7359     if (evt.attrName === "type") {
7360       evt.target.type = evt.newValue;
7361     }
7362     evt = void 0;
7363   }, false);
7364   this.addEventListener("S_Load", function(evt){
7365     var tar = evt.target, script = tar._text;
7366     var tod = tar.ownerDocument;
7367     NAIBU._temp_doc = tod;
7368     script = script.replace(/function\s+(\w+)/g, "$1 = function");
7369     script = "(function(document){" +script+ "})(NAIBU._temp_doc);"
7370     try {
7371       eval(script);
7372     } catch (e) { //IE9では、documentがconstとして定数指定されているため、引数として指定できない
7373       script = script.replace(/function\(document\){/, "function() {");
7374       eval(script);
7375     }
7376     tar = evt = script = void 0;
7377   }, false);
7378   this.addEventListener("DOMNodeInserted", function(evt){
7379     var tar = evt.target;
7380     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7381       if (tar.nodeName === "#cdata-section") {
7382         evt.currentTarget._text = tar.data;
7383       }
7384       return;
7385     }
7386     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
7387       var tar = evt.target;
7388       if (evt.eventPhase === Event.AT_TARGET && !tar.getAttributeNodeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
7389         var evtt = tar.ownerDocument.createEvent("SVGEvents");
7390         evtt.initEvent("S_Load", false, false);
7391         evt.currentTarget.dispatchEvent(evtt);
7392       }
7393       tar = evt = void 0;
7394     }, false);
7395   }, false);
7396   return this;
7397 };
7398 SVGScriptElement.prototype = new SVGElement();
7399
7400 function SVGEvent() {
7401   Event.apply(this, arguments);
7402   return this;
7403 };
7404 SVGEvent.prototype = new Event();
7405
7406 function SVGZoomEvent() { 
7407   UIEvent.apply(this, arguments);
7408   /*readonly SVGRect*/  this.zoomRectScreen = new SVGRect();
7409   /*readonly float*/    this.previousScale = 1;
7410   /*readonly SVGPoint*/ this.previousTranslate = new SVGPoint();
7411   /*readonly float*/    this.newScale = 1;
7412   /*readonly SVGPoint*/ this.newTranslate = new SVGPoint();
7413   return this;
7414 };
7415 SVGZoomEvent.prototype = new UIEvent();
7416
7417 function SVGAnimationElement(es) {
7418   if (!!es) {
7419     return this;
7420   }
7421   SVGElement.apply(this);
7422   /*SIEにおけるSVGElementでは、fill属性とStyleSheetを結びつける機構があるため、
7423    *styleのsetPropertyメソッドを無効化させておく必要がある
7424    */
7425   this.style.setProperty = function(){};
7426   this._tar = null;
7427   /*readonly SVGElement*/ this.targetElement;
7428   /*それぞれのプロパティは、_を除いた属性に対応している*/
7429   this._begin = this._end = this._repeatCount = this._repeatDur = this._dur = this._resatrt = null;
7430   this._currentFrame = 0;
7431   /*_isRepeatと_numRepeatは繰り返し再生のときに使う。なお、後者は現在のリピート回数*/
7432   this._isRepeat = false;
7433   this._numRepeat = 0;
7434   /*_isStartプロパティは一度は起動したかどうか*/
7435   this._isStarted = false;
7436   /*_startと_finishプロパティはミリ秒数のリストを収納する。
7437    *_startはアニメ開始時の秒数リスト。_finishはアニメ終了時の秒数のリスト。
7438    *なお、文書読み込み終了時(アニメ開始時刻)の秒数を0とする。
7439    *_startingプロパティは現在アニメーションでの開始時刻。getSartTimeメソッドで使う
7440    */
7441   this._start = this._finish = this._starting = null;
7442   /*_activeDurプロパティは現時点でのアニメーションの活動期間*/
7443   this._activeDur = 0; 
7444   this._from = this._to = this._values = this._by = null;
7445   this._keyTimes = null;
7446   this.addEventListener("beginEvent", function(evt) {
7447     try {
7448       var tar = evt.target,
7449       begin = tar.getStartTime(),
7450       durv = tar._dur,
7451       dur = tar._getOffset(durv),
7452       end = tar._finish,
7453       endv= tar._end,
7454       td = tar._repeatDur,
7455       tc = tar._repeatCount,
7456       ac = null;
7457       if (end) {
7458         for (var i=0, eli=end.length;i<eli;++i) {
7459           /*endの配列(ソース済み)からbeginに最も近い数値を選ぶ*/
7460           if (end[i] >= begin) {
7461             end = end[i];
7462             break;
7463           }
7464         }
7465       } else {
7466         /*イベント待ちの場合は、endの値を、indefiniteとみなす。参照: http://www.w3.org/TR/smil-animation/#ComputingActiveDur
7467          * 
7468          * 3.3.4. Computing the active duration
7469          * 
7470          * If the value of end cannot be resolved (e.g. when it is event-based),
7471          * the value is considered to be "indefinite" for the purposes of evaluating the active duration.
7472          *
7473          */
7474         endv = null;
7475       }
7476       /*Activate Duration (活性持続時間と呼ぶことにする)を計算
7477        *計算方法は以下を参照のこと
7478        *http://www.w3.org/TR/smil-animation/#ComputingActiveDur
7479        *3.3.4. Computing the active duration
7480        */
7481       if ((td === "indefinite") || (tc === "indefinite")) {
7482         if (endv) {
7483           ac = end - begin;
7484         } else {
7485           /*活性持続時間が不定(indefinite)なので、強制的にアニメを終了させる*/
7486           ac = null;
7487         }
7488       } else if (durv === "indefinite") {
7489         if (!tc && !endv) {
7490           /*活性持続時間が不定(indefinite)なので、強制的にアニメを終了させる*/
7491           ac = null;
7492         } else if (tc && !endv) {
7493           ac = tar._getOffset(td);
7494         } else if (!tc && endv) {
7495           ac = end - begin;
7496         } else {
7497           ac = (tar._getOffset(td) > (end - begin)) ? tar._getOffset(td) : (end - begin);
7498         }
7499       } else if (durv && !td && !tc && !endv) {
7500         ac = dur;
7501       } else if (durv && !td && tc && !endv) {
7502         ac = dur * (+tc);
7503       } else if (durv && td && !tc && !endv) {
7504         ac = tar._getOffset(td);
7505       } else if (durv && !td && !tc && endv) {
7506         ac = (dur > (end - begin)) ? dur : (end - begin);
7507       } else if (durv && td && tc && !endv) {
7508         ac = (+tc*dur > tar._getOffset(td)) ? +tc*dur : tar._getOffset(td);
7509       } else if (durv && td && tc && endv) {
7510         ac = (+tc*dur > Math.min(+td, (end-begin))) ? +tc*dur : Math.min(tar._getOffset(td), (end - begin));
7511       } else if (durv && td && !tc && endv) {
7512         ac = (tar._getOffset(td) > (end - begin)) ? tar._getOffset(td) : (end - begin);
7513       } else if (durv && !td && tc && endv) {
7514         ac = (+tc*dur > (end - begin)) ? +tc*dur : (end - begin)
7515       }
7516     } catch (e) {
7517       tar.endElementAt(1);
7518       throw new DOMException(DOMException.INVALID_STATE_ERR);
7519     }
7520     if ((ac || (ac === 0)) && isFinite(ac)) {
7521       /*endの値がすでにある場合は、二重指定を避ける*/
7522       endv || tar.endElementAt(ac);
7523       tar._activeDur = ac;
7524     }
7525     tar = begin = dur = durv = end = endv= td = tc = ac = void 0;
7526   }, false);
7527   this.addEventListener("DOMAttrModified", function(evt){
7528     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7529       return;
7530     }
7531     var tar = evt.target,
7532         name = evt.attrName,
7533         evtv = evt.newValue;
7534     if (name === "begin") {
7535       tar._begin = evtv.replace(/\s+/g, "").split(";"); //空白は取り除く
7536     } else if (name === "end") {
7537       tar._end = evtv.replace(/\s+/g, "").split(";");
7538     } else if (name === "dur") {
7539       tar._dur = evtv;
7540     } else if (name === "repeatCount") {
7541       tar._repeatCount = evtv;
7542       tar._isRepeat = true;
7543     } else if (name === "repeatDur") {
7544       tar._repeatCount = evtv;
7545       tar._isRepeat = true;
7546     } else if (name === "from") {
7547       tar._from = evtv;
7548     } else if (name === "to") {
7549       tar._to = evtv;
7550     } else if (name === "values") {
7551       tar._values = evtv.split(";");
7552     } else if (name === "by") {
7553       tar._by = evtv;
7554     } else if (name === "keyTimes") {
7555       var s = evtv.split(";");
7556       tar._keyTimes = []; //_keyTimesプロパティを初期化
7557       for (var i=0;i<s.length;++i) {
7558         tar._keyTimes[i] = parseFloat(s[i]);
7559       }
7560       s = void 0;
7561     } else if (name === "restart") {
7562       tar._restart = evtv;
7563     }
7564     evt = evtv = void 0;
7565   }, false);
7566   this.addEventListener("DOMNodeInserted", function(evt){
7567     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7568       return; //強制終了させる
7569     }
7570     var tar = evt.target;
7571     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
7572       var tar = evt.target;
7573       /*以降の場合分けルールに関しては、下記の仕様を参照
7574        *http://www.jsa.or.jp/stdz/instac/syoukai/H13/H13annual_report/12/ngc-wg3/offline/smil_20_20020131/animation.html#AnimationNS-FromToBy
7575        */
7576       if (tar._values) {
7577       } else if (tar._from && tar._to) {
7578         tar._values = [tar._from, tar._to];
7579       } else if (tar._from && tar._by) {
7580         var n = parseFloat(tar._from) + parseFloat(tar._by), tanni = tar._from.match(/\D+/) || [""];
7581         tar._values = [tar._from, n+tanni[0]];
7582       } else if (tar._to) {
7583         tar._values = [null, tar._to];
7584       } else if (tar._by) {
7585         tar._values = [null, null, tar._by];
7586       } else if (!tar.hasChildNodes() && !tar.hasAttributeNS(null, "path")) { //SVGAnimateMotionElementに留意
7587         /*アニメーションの効果が出ないように調整する
7588          *SMILアニメーションの仕様を参照
7589          *
7590          *>if none of the from, to, by or values attributes are specified, the animation will have no effect
7591          *「3.2.2. Animation function values」より引用
7592          *http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
7593          */
7594         return this;
7595       }
7596       /*begin属性とend属性を処理する*/
7597       var that = tar,
7598           timing = function(val, name, offset) {
7599         /*timing関数は時間のタイミングをidとeventと、clock-value(offset)に分割して処理していく
7600          *まず、idを検出するためのsearcIdローカル関数を作る
7601          */
7602         var searchId = function () {
7603               var n = val.indexOf(".");
7604               if ((n > 0) && (/[a-z]/i).test(val.charAt(n+1))) { //. (dot)の後がアルファベットならば
7605                 return (val.slice(0, n));
7606               }
7607               n = nn = void 0;
7608               return "";
7609             },
7610             id;
7611         /*
7612          *W3CのSMIl AnimationのTimingモデルは7パターンがあるので、場合分けする
7613          */
7614         if (isFinite(parseFloat(val))) { //1) offset-valueの場合
7615           that[name](offset);
7616         } else if (val.indexOf("repeat(") > -1) { //2) repeat-valueの場合
7617           var inte = parseFloat(val.slice(7)),
7618               ds = (function(that, name, offset) {
7619                 return function (evt) {
7620                    if (inte === evt.target._numRepeat) {
7621                      that[name](offset);
7622                    }
7623                 };
7624               })(that, name, offset),
7625               id = searchId();
7626               if (id) {
7627                 that.ownerDocument.getElementById(id).addEventListener("repeatEvent", ds);
7628               } else {
7629                 that.addEventListener("repeatEvent", ds);
7630               }
7631         } else if (/\.(begin|end)/.test(val)) { //3) syncbase-valueの場合
7632           id = searchId();
7633           if (id) {
7634             var ds = (function(that, name, offset) {
7635                   return function (evt) {
7636                     that[name](offset);
7637                   };
7638                 })(that, name, offset),
7639                 ev = "";
7640             /\.(begin|end)/.test(val); //RegExp.$1のために、もう一度する必要がある
7641            if (RegExp.$1 === "begin") {
7642               ev = "beginEvent";
7643             } else if (RegExp.$1 === "end") {
7644               ev = "endEvent";
7645             }
7646             that.ownerDocument.getElementById(id).addEventListener(ev, ds, false);
7647           }
7648         } else if (val.indexOf("wallclock(") === 0) { //4) wallclock-valueの場合
7649           
7650         } else if (val === "indefinite") { //5) indefiniteの場合
7651         } else if (val.indexOf("accesskey(") > -1) { //6) accesskey-valueの場合
7652           
7653         } else { //7) event-valueの場合
7654           id = searchId();
7655           var ds = (function(that, name, offset) {
7656                 return function (evt) {
7657                    that[name](offset);
7658                 };
7659               })(that, name, offset);
7660           if (id && val.match(/\.([a-z]+)/i)) {
7661             that.ownerDocument.getElementById(id).addEventListener(RegExp.$1, ds);
7662           } else if (val){
7663             that.targetElement.addEventListener(val.match(/^[a-z]+/i)[0], ds)
7664           }
7665         }
7666         val = searchId = id = void 0;
7667       };
7668       if (tar._begin) {
7669         for (var i=0,tli=tar._begin.length;i<tli;++i) {
7670           timing(tar._begin[i], "beginElementAt", tar._getOffset(tar._begin[i]));
7671         }
7672       } else {
7673         tar.beginElementAt(0);
7674       }
7675       if (tar._end) {
7676         for (var i=0,tli=tar._end.length;i<tli;++i) {
7677           timing(tar._end[i], "endElementAt", tar._getOffset(tar._end[i]));
7678         }
7679       }
7680       that = void 0;
7681       if (tar.hasAttributeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
7682         tar.targetElement = tar.ownerDocument.getElementById(tar.getAttributeNS("http://www.w3.org/1999/xlink", "xlink:href").slice(1))
7683       } else {
7684         tar.targetElement = tar.parentNode;
7685       }
7686       evt = tar = void 0;
7687     }, false);
7688     evt = tar = void 0;
7689   }, false);
7690   return this;
7691 };
7692 SVGAnimationElement.prototype = new SVGElement();
7693 /*以下のメソッド(beginElementなど)については、
7694  *別モジュールであるsmil::ElementTimeControl(smil.js)を参照のこと
7695  */
7696 /*void*/ SVGAnimationElement.prototype.beginElement = function() {
7697   var ttd = this.ownerDocument,
7698       evt = ttd.createEvent("TimeEvents");
7699   this._starting = ttd.documentElement.getCurrentTime(); //getStartTimeメソッドで使う開始時刻
7700   if (this._isStarted && ((this._restart === "never")
7701       || ((this._restart === "whenNotActive") && (this.getCurrentTime() > 0)))) {
7702     return; //restart属性の設定により、再起動させないようにする
7703   }
7704   if (this.getCurrentTime() > 0) {
7705     /*アニメーションの最中で、beginEventが起きるときは、endEventが前もって起こされる。SVG1.1の仕様を参照
7706      * 
7707      * 19.4.2 Interface TimeEvent
7708      * Note that if an element is restarted while it is currently playing, the element will raise an end event and another begin event, as the element restarts. 
7709      * 
7710      * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
7711      * 
7712      */
7713     this.endElement();
7714   }
7715   evt.initTimeEvent("beginEvent", ttd.defaultView, 0);
7716   this.dispatchEvent(evt);
7717   /*新しくリストの頭を更新して、別の値も実行させるようにする*/
7718   this._start && this._start.shift();
7719   this._isStarted = true;
7720   ttd = evt = void 0;
7721 };
7722 /*void*/ SVGAnimationElement.prototype.endElement = function() {
7723   var ttd = this.ownerDocument,
7724       evt = ttd.createEvent("TimeEvents");
7725   evt.initTimeEvent("endEvent", ttd.defaultView, 0);
7726   this.dispatchEvent(evt);
7727   this._finish && this._finish.shift();
7728   this._currentFrame = 0;
7729 };
7730 /*void*/ SVGAnimationElement.prototype.beginElementAt = function(/*float*/ offset) {
7731   var ntc = this.ownerDocument.documentElement.getCurrentTime(),
7732       start = this._start || [];
7733   for (var i=0,sli=start.length;i<sli;++i) {
7734     if (start[i] === (offset+ntc)) {
7735       ntc = start = offset = void 0;
7736       return;
7737     }
7738   }
7739   start.push(offset + ntc);
7740   start.sort(function(a, b) {
7741     return a - b;
7742   });
7743   this._start = start;
7744   ntc = start = offset = void 0;
7745 };
7746 /*void*/ SVGAnimationElement.prototype.endElementAt = function(/*float*/ offset) {
7747   var ntc = this.ownerDocument.documentElement.getCurrentTime(),
7748   fin = this._finish || [];
7749   for (var i=0,fli=fin.length;i<fli;++i) {
7750     if (fin[i] === (offset+ntc)) {
7751       ntc = fin = offset = void 0;
7752       return;
7753     }
7754   }
7755   fin.push(offset + ntc);
7756   fin.sort(function(a, b) {
7757     return a - b;
7758   });
7759   this._finish = fin;
7760   ntc = start = offset = void 0;
7761 };
7762 SVGAnimationElement.prototype._eventRegExp = /(mouse|activ|clic|begi|en)[a-z]+/;
7763 SVGAnimationElement.prototype._timeRegExp = /[\-\d\.]+(h|min|s|ms)?$/;
7764 SVGAnimationElement.prototype._unit = {
7765     "h"   : 3600000,
7766     "min" : 60000,
7767     "s"   : 1000
7768 };
7769 /*_getOffsetメソッド
7770  * どれだけズレの時間があるかを計測するメソッド
7771  *tに数値が使われていないときは0を返す
7772  *これはSMILアニメーションモジュールの以下の記述にあるように、値のデフォルトが0であることに起因する
7773  *http://www.w3.org/TR/2001/REC-smil20-20010807/smil-timing.html#Timing-Ex:0DurDiscreteMedia
7774  *http://www.w3.org/TR/2001/REC-smil20-20010807/smil-timing.html#Timing-DurValueSemantics
7775  ** Note that when the simple duration is "indefinite", some simple use cases can yield surprising results. See the related example #4 in Appendix B.
7776  */
7777 SVGAnimationElement.prototype._getOffset = function(/*string*/ val) {
7778   var t = null, //tは最初の数値
7779       n = [val.indexOf("+"), val.indexOf("-")],
7780       s;
7781   if (n[0] > -1) {
7782     s = val.slice(n[0]);
7783     t = parseFloat(s);
7784   } else if (n[1] > -1) {
7785     s = val.slice(n[1]);
7786     t = parseFloat(s);
7787   } else {
7788     s = val;
7789     t = parseFloat(val);
7790   }
7791   if (isFinite(t)) {
7792     if (/\d+\:(\d\d)\:([\d\.]+)$/.test(s)) { //Full-Clock-Valueの場合
7793       t = (t*3600 + parseInt(RegExp.$1, 10)*60 + parseFloat(RegExp.$2)) * 1000;
7794     } else if (/\d\d\:([\d\.]+)$/.test(s)) {
7795       t = (t*60 + parseFloat(RegExp.$1)) * 1000;
7796     } else if (/(h|min|s)$/.test(s)) {
7797       t *= this._unit[RegExp.$1];
7798     }
7799     if (isFinite(t)) {
7800        t *= 0.8;
7801       return t;
7802     }
7803   }
7804   return 0;
7805 };
7806
7807 /*float*/ SVGAnimationElement.prototype.getStartTime = function(){
7808   if (this._starting || (this._starting === 0)) {
7809     return (this._starting);
7810   } else {
7811     throw new DOMException(DOMException.INVALID_STATE_ERR);
7812   }
7813 };
7814 /*getCurrentTimeメソッド
7815  *現在の時間コンテナ内での時刻であり、
7816  *決して現在時刻ではない。要素のbeginイベントの発火したときが0sである。
7817  */
7818 /*float*/ SVGAnimationElement.prototype.getCurrentTime = function(){
7819   return (this._currentFrame * 125 * 0.8);
7820 };
7821 /*float*/ SVGAnimationElement.prototype.getSimpleDuration = function(){
7822   if (!this._dur && !this._finish && (this._dur === "indefinite")) {
7823     throw new DOMException(DOMException.NOT_SUPPORTED_ERR);
7824   } else {
7825     return (this._getOffset(this._dur));
7826   }
7827 };
7828                     //raises( DOMException );
7829 NAIBU.Time = {
7830   currentFrame : 0,
7831   Max : 17000,
7832   start : function() {
7833   if (NAIBU.Clip.length > 0) {
7834     screen.updateInterval = 42; //24fpsとして描画処理
7835     window.onscroll = function () {
7836       screen.updateInterval = 0;
7837       screen.updateInterval = 42;
7838     }
7839     NAIBU.stop = setInterval( (function() {
7840 /*      try{*/
7841         var ntc = NAIBU.Time.currentFrame,
7842             nc = NAIBU.Clip,
7843             s = ntc * 100; //フレーム数ntcをミリ秒数sに変換 (100 = 125 * 0.8)
7844         if (ntc > NAIBU.Time.Max) {
7845           clearInterval(NAIBU.stop);
7846         }
7847         nc[0] && nc[0].ownerDocument.documentElement.setCurrentTime(s);
7848         for (var i=0,ncli=nc.length;i<ncli;++i) {
7849           var nci = nc[i]
7850               s2 = s + 100,
7851               s1 = s - 100;
7852           if (nci._start) {
7853               var sti = nci._start[0];
7854               if (sti && nci._finish && (sti === nci._finish[0])) { //アニメーションの途中ならば
7855                 nci.endElement();
7856               }
7857               if ((sti || (sti === 0)) && (s1 <= sti) && (sti < s)) {
7858                 nci.beginElement();
7859               }
7860               sti = void 0;
7861           }
7862           if (nci._isRepeat && (nci.getCurrentTime() >= nci.getSimpleDuration()*nci._numRepeat)) {
7863             /*リピート処理*/
7864             var ttd = nci.ownerDocument,
7865                 evt = ttd.createEvent("TimeEvents");
7866             ++nci._numRepeat;
7867             evt.initTimeEvent("repeatEvent", ttd.defaultView, nci._numRepeat);
7868             nci.dispatchEvent(evt);
7869             ttd = evt = void 0;
7870           }
7871           if (nci._finish && (nci.getCurrentTime() !== 0)) {
7872               var fti = nci._finish[0];
7873               if ((fti || (fti === 0)) && (s1 <= fti) && (fti <= s)) {
7874                 nci.endElement();
7875               }
7876               fti = void 0;
7877           }
7878           if (nci._frame) {
7879             ++nci._currentFrame;
7880             nci._frame();
7881           }
7882         }
7883         ++NAIBU.Time.currentFrame;
7884         ntc = nc = s = nci = s1 = s2 = void 0;
7885 /*      } catch (e) {
7886         stlog.add(e, 4157);
7887       }*/
7888         }),
7889          1
7890       );
7891     } else {
7892       window.onscroll = function () {
7893         screen.updateInterval = 0;
7894                window.onscroll = NAIBU.emptyFunction;
7895       }
7896     }
7897  }
7898 };
7899 NAIBU.Clip = [];
7900   
7901 function SVGAnimateElement(){
7902   SVGAnimationElement.apply(this);
7903   /*NAIBU.Clipについては、NAIBU.Timeで使う
7904    *くわしくはNAIBU.Time.start関数のコードを参照
7905    */
7906   NAIBU.Clip[NAIBU.Clip.length] = this;
7907   /*_valueListプロパティは、
7908    *機械が理解できる形で保管されているvalueの値の配列リスト
7909    */
7910   this._valueList = [];
7911   this._isDiscrete = false;
7912   this.addEventListener("DOMAttrModified", function(evt){
7913     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7914       return; //強制終了させる
7915     }
7916     if ((evt.attrName === "calcMode") && (evt.newValue === "discrete")) {
7917       evt.target._isDiscrete = true;
7918     }
7919   }, false);
7920   this.addEventListener("DOMNodeInserted", function(evt){
7921     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
7922       return; //強制終了させる
7923     }
7924     var tar = evt.target;
7925     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
7926       var tar = evt.target,
7927           attrName = tar.getAttributeNS(null, "attributeName"),
7928           ttr = tar.targetElement,
7929           tta = ttr[attrName];
7930       /*tar.valuesのリスト:  ["12px", "13px"]
7931        *tar._valueList:   [(new SVGPoint()), (new SVGPoint())]
7932        *  tar.valuesを機械が理解できるように変換したものがtar._valueList
7933        *この_valueListプロパティはアニメの際に使うので、_valuesプロパティはアニメ中に使わないことに注意
7934        */
7935       var vi = ttr.cloneNode(false);
7936       if (!tar._values[0]) {   //to属性か、by属性が設定されている場合
7937         var ttrs = ttr.ownerDocument.defaultView.getComputedStyle(ttr, "");
7938         tar._values[0] = ttr.getAttributeNS(null, attrName) || ttrs.getPropertyValue(attrName);
7939         if (!tar._values[1] && tar._values[2]) { //by属性のみが設定されている場合
7940           var v2 = parseFloat(tar._values[0]) + parseFloat(tar._values[2]), tanni = tar._values[0].match(/\D+/) || [""];
7941           tar._values[1] = v2 + tanni[0];
7942           tar._values.pop();
7943           v2 = tanni = void 0;
7944         }
7945       }
7946       if (("animatedPoints" in ttr) && (attrName === "points")) {
7947         ttr.animatedPoints = vi.points;
7948         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
7949           var vir = ttr.cloneNode(false);
7950           delete vir._tar;
7951           vir.setAttributeNS(null, "points", tav[i]);
7952           tar._valueList[tar._valueList.length] = vir.points;
7953         }
7954       } else if (!!tta) {
7955         tta.animVal = vi[attrName].baseVal;
7956         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
7957           var vir = ttr.cloneNode(false); //仮の要素
7958           delete vir._tar;
7959           vir.setAttributeNS(null, attrName, tav[i]);
7960           tar._valueList[tar._valueList.length] = vir[attrName].baseVal;
7961         }
7962       } else if (!!CSS2Properties[attrName] || attrName.indexOf("-") > -1) { //スタイルシートのプロパティならば
7963         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
7964           if ((attrName === "fill") || (attrName === "stroke") || (attrName === "stop-color")) {
7965             tar._valueList[i] = new SVGPaint();
7966             tar._valueList[i].setPaint(1, null, tav[i], null)
7967           } else {
7968             tar._valueList[i] = parseFloat(tav[i]);
7969           }
7970         }
7971       } else if (("normalizedPathSegList" in ttr) && (attrName === "d")) {
7972         ttr.animatedNormalizedPathSegList = vi.normalizedPathSegList;
7973         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
7974           var vir = ttr.cloneNode(false);
7975           delete vir._tar;
7976           vir.setAttributeNS(null, "d", tav[i]);
7977           tar._valueList[tar._valueList.length] = vir.normalizedPathSegList;
7978         }
7979       } else {
7980         vi = void 0;
7981         return;
7982       }
7983       evt = tta = vir = vi = void 0;
7984     }, false);
7985   }, false);
7986   this.addEventListener("beginEvent", function(evt) {
7987     var _tar = evt.target,
7988         attrName = _tar.getAttributeNS(null, "attributeName"),
7989         newAttr = _tar.targetElement.attributes.getNamedItemNS(null, attrName),
7990         ttr = _tar.targetElement,
7991         tta = ttr[attrName];
7992     _tar._frame = function() {
7993       var tar = _tar,
7994           d = tar._isRepeat ? tar.getSimpleDuration() : tar._activeDur,
7995           n = tar._valueList.length-1,
7996           tg = tar.getCurrentTime();
7997       tar._activeDur || (d = 0);
7998       d *= 0.8;
7999       if ((n !== -1) && (d !== 0) && (tg <= d)) {
8000         if (tar._isDiscrete) {
8001           ++n; //discreteモードは他のモードに比べて、分割数が多いことに注意
8002         }
8003         var ii = Math.floor((tg*n) / d);
8004         if (ii === n) { //iiが境い目のときは、n-2を適用
8005           ii -= 1;
8006         }
8007       } else {
8008         return;
8009       }
8010       /*setAttrbute(NS)メソッドはDOM属性を書き換えるため利用しない。
8011       *
8012       * 参照:アニメーションサンドイッチモデル
8013       * >アニメーションが起動している時,それは実際,DOMの中の属性値は変化しない。
8014       *http://www.jsa.or.jp/stdz/instac/syoukai/H13/H13annual_report/12/ngc-wg3/offline/smil_20_20020131/animation.html#animationNS-AnimationSandwichModel
8015       */
8016       var evt = tar.ownerDocument._domnodeEvent();
8017       if (tar._keyTimes) {
8018         var di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d;
8019         var ti = tar._keyTimes[ii];
8020       } else {
8021         var di = d / n; //keyTimesがなければ均等に時間を配分しておく
8022         var ti = ii / n;
8023       }
8024       if (("animatedPoints" in ttr) && (attrName === "points")) {
8025         var base = ttr.points;
8026         ttr.points = ttr.animatedPoints;
8027         ttr.dispatchEvent(evt);
8028         ttr.animatedPoints = ttr.points;
8029         ttr.points = base;
8030       } else if (!!tta) {
8031         var base = tta.baseVal, tanim = tta.animVal;
8032         var v1 = tar._valueList[ii].value;
8033         /*vを求める公式に関しては、SMIL2.0 Animation Moduleの単純アニメーション関数の項を参照
8034          * 3.4.2 Specifying the simple animation function f(t)
8035          *http://www.w3.org/TR/2005/REC-SMIL2-20050107/animation.html#animationNS-SpecifyingAnimationFunction
8036          */
8037         if (!tar._isDiscrete) {
8038           var v2 = tar._valueList[ii+1].value, v = v1 + (v2-v1) * (tg-ti*d) / di;
8039         } else {
8040           var v = v1;
8041         }
8042         tanim.newValueSpecifiedUnits(base.unitType, v);
8043         tta.baseVal = tanim;
8044         tanim = void 0;
8045         ttr.dispatchEvent(evt);
8046         /*変化値はanimValプロパティに収納しておき、
8047          *変化する前の、元の値はbaseValプロパティに再び収納しておく
8048          */
8049         tta.animVal = tta.baseVal;
8050         tta.baseVal = base;
8051         di = void 0;
8052       } else if (!!CSS2Properties[attrName] || attrName.indexOf("-") > -1) { //スタイルシートのプロパティならば
8053         var base = null;
8054         var v1 = tar._valueList[ii].value, v2 = tar._valueList[ii+1].value;
8055         if (!tar._isDiscrete) {
8056           var v = v1 + (v2-v1) * (tg-ti*d) / di;
8057         } else {
8058           var v = v1;
8059         }
8060       } else if (("normalizedPathSegList" in ttr) && (attrName === "d")) {
8061         var base = ttr.normalizedPathSegList;
8062         ttr.normalizedPathSegList = ttr.animatedNormalizedPathSegList;
8063         ttr.dispatchEvent(evt);
8064         ttr.animatedNormalizedPathSegList = ttr.normalizedPathSegList;
8065         ttr.normalizedPathSegList = base;
8066       }
8067      evt = tar = v1 = v2 = v = d = n = ii = tg = void 0;
8068     };
8069     evt = vir = void 0;
8070   }, false);
8071   this.addEventListener("endEvent", function(evt) {
8072     var tar = evt.target,
8073         fill = tar.getAttributeNS(null, "fill");
8074     if (!fill || (fill === "remove")) {
8075       var evt = tar.ownerDocument._domnodeEvent();
8076       tar.targetElement.dispatchEvent(evt);
8077       evt = void 0;
8078       tar._frame && tar._frame();
8079     }
8080     delete tar._frame;
8081   }, false);
8082   this.addEventListener("repeatEvent", function(evt) {
8083     var tar = evt.target;
8084   }, false);
8085   return this;
8086 };
8087 SVGAnimateElement.prototype = new SVGAnimationElement(1);
8088
8089 function SVGSetElement(){
8090   SVGAnimationElement.apply(this);
8091   NAIBU.Clip[NAIBU.Clip.length] = this;
8092   this._to = "";
8093   this.addEventListener("DOMAttrModified", function(evt) {
8094     var tar = evt.target, name = evt.attrName;
8095     if (name === "to") {
8096       tar._to = evt.newValue;
8097     }
8098     tar = name = void 0;
8099   }, false);
8100   this.addEventListener("beginEvent", function(evt) {
8101     var tar = evt.target;
8102     tar._currentFrame = 1; //これがないと、NAIBU.stopの内部の処理の都合上、endEventが発動しない。
8103     if (tar.targetElement) {
8104       var attrName = tar.getAttributeNS(null, "attributeName"),
8105           newAttr = tar.targetElement.attributes.getNamedItemNS(null, attrName),
8106           tta = tar.targetElement[attrName];
8107       if (!!CSS2Properties[attrName] || attrName.indexOf("-") > -1) { //スタイルシートのプロパティならば
8108         /*前もって、スタイルシートの値を取得しておいて、endEventの際に使う*/
8109         tar._prestyle = tar.ownerDocument.defaultView.getComputedStyle(tar.targetElement, "").getPropertyValue(attrName);
8110         var style = tar.ownerDocument.getOverrideStyle(tar.targetElement, "");
8111         style.setProperty(attrName, tar.getAttributeNS(null, "to"), null);
8112         style = void 0;
8113       } else if (!!tta) {
8114         var base = tta.baseVal;
8115         if (base instanceof SVGLength) {
8116           tta.baseVal = tar.ownerDocument.documentElement.createSVGLength();
8117         } else if (base instanceof SVGRect) {
8118           tta.baseVal = tar.ownerDocument.documentElement.createSVGRect();
8119         }
8120         /*setAttrbute(NS)メソッドはDOM属性を書き換えるため利用しない。
8121          *
8122          * 参照:アニメーションサンドイッチモデル
8123          * >アニメーションが起動している時,それは実際,DOMの中の属性値は変化しない。
8124          *http://www.jsa.or.jp/stdz/instac/syoukai/H13/H13annual_report/12/ngc-wg3/offline/smil_20_20020131/animation.html#animationNS-AnimationSandwichModel
8125          */
8126         var evt = tar.ownerDocument.createEvent("MutationEvents");
8127         evt.initMutationEvent("DOMAttrModified", true, false, newAttr, newAttr, tar._to, attrName, MutationEvent.MODIFICATION);
8128         tar.targetElement.dispatchEvent(evt);
8129         evt = void 0;
8130         /*変化値はanimValプロパティに収納しておき、
8131          *変化する前の、元の値はbaseValプロパティに再び収納しておく
8132          */
8133         tta.animVal = tta.baseVal;
8134         tta.baseVal = base;
8135       }
8136     }
8137     evt = tar = attrName = void 0;
8138   }, false);
8139   this.addEventListener("endEvent", function(evt) {
8140     var tar = evt.target,
8141         fill = tar.getAttributeNS(null, "fill");
8142     if (!fill || (fill === "remove")) {
8143       var attrName = tar.getAttributeNS(null, "attributeName"),
8144           style = tar.ownerDocument.getOverrideStyle(tar.targetElement, "");
8145       if (tar._prestyle) { //スタイルシートの変更ならば
8146         style.setProperty(attrName, tar._prestyle, null);
8147       } else {
8148         var evtt = tar.ownerDocument._domnodeEvent();
8149         tar.targetElement.dispatchEvent(evtt);
8150       }
8151       attrName = style = evtt = void 0;
8152     }
8153     tar = fill = void 0;
8154   }, false);
8155   this.addEventListener("repeatEvent", function(evt) {
8156     var tar = evt.target, attrName = tar.getAttributeNS(null, "attributeName"), style = tar.ownerDocument.defaultView.getComputedStyle(tar.targetElement, "");
8157   }, false);
8158   return this;
8159 };
8160 SVGSetElement.prototype = new SVGAnimationElement(1);
8161
8162 function SVGAnimateMotionElement(){
8163   SVGAnimationElement.apply(this);
8164   NAIBU.Clip[NAIBU.Clip.length] = this;
8165   this.addEventListener("DOMAttrModified", function(evt){
8166     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8167       return;
8168     }
8169     var tar = evt.target,
8170         name = evt.attrName;
8171     if (name === "path") {
8172       var d = tar.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "path");
8173       d.setAttributeNS(null, "d", evt.newValue);
8174       tar._path = d;
8175       d = void 0;
8176     }
8177   }, false);
8178   this.addEventListener("DOMNodeInserted", function(evt){
8179     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8180       return; //強制終了させる
8181     }
8182     var tar = evt.target;
8183     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
8184       var vlist = [],
8185           ti;
8186       if (tar._values) {
8187         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
8188           ti = tav[i];
8189           ti = ti.split(",");
8190           vlist[i] = [+ti[0], +ti[1]];
8191         }
8192         tar._valueList = vlist;
8193       }
8194     }, false);
8195   }, false);
8196   this.addEventListener("beginEvent", function(evt) {
8197     var tar = evt.target,
8198         trans = tar.targetElement.transform;
8199     /*アニメーション中に変化すべき値をanimValプロパティに入力して、
8200      *baseValと同じような値に設定。
8201      */
8202     trans.animVal = new SVGTransformList();
8203     if (trans.baseVal.numberOfItems !== 0) {
8204       trans.baseVal.consolidate();
8205       trans.animVal.initialize(trans.baseVal.createSVGTransformFromMatrix(trans.baseVal.getItem(0).matrix));
8206       } else {
8207       trans.animVal.appendItem(tar.ownerDocument.documentElement.createSVGTransform());
8208     }
8209     tar._frame = function() {
8210       var _tar = tar,
8211           tpn = _tar._path,
8212           tgsd = _tar._isRepeat ? _tar.getSimpleDuration() : _tar._activeDur,
8213           d = tgsd * 0.8,
8214           tg = _tar.getCurrentTime(),
8215           ii;
8216       _tar._activeDur || (d = 0);
8217       if (tgsd === 0) {
8218          tgsd = void 0;
8219          return;
8220       }
8221       if (tpn) { //path属性が指定されていた場合、tpnは属性値となる
8222         var st = tpn.getTotalLength() * tg / d, //stは現在に至るまでの距離
8223             p = tpn.getPointAtLength(st),
8224             trans = _tar.targetElement.transform;
8225         trans.animVal.getItem(trans.animVal.numberOfItems-1).setTranslate(p.x, p.y);
8226         var base = trans.baseVal;
8227         trans.baseVal = trans.animVal;
8228         _tar.targetElement._cacheMatrix = null;
8229         var evtt = _tar.ownerDocument.createEvent("MutationEvents");
8230         evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
8231         _tar.targetElement.dispatchEvent(evtt);
8232         trans.baseVal = base;
8233         evtt = base = trans = st = p = void 0;
8234       } else if (tar._valueList) {
8235         var total = 0, //totalは総距離
8236             st = 0,    //stは現在にいたるまでの距離
8237             tav = tar._valueList,
8238             n = tav.length - 1;
8239         if ((n !== -1) && (d !== 0) && (tg <= d)) {
8240           ii = Math.floor((tg*n) / d);
8241           if (ii === n) { //iiが境い目のときは、n-2を適用
8242             ii -= 1;
8243           }
8244         } else {
8245           return;
8246         }
8247         for (var i=1, tvli=tav.length;i<tvli;i+=2) {
8248           total += Math.sqrt(Math.pow(tav[i][1] - tav[i-1][1], 2) + Math.pow(tav[i][0] - tav[i-1][0], 2));
8249         }
8250         for (var i=1;i<ii;i+=2) {
8251           st += Math.sqrt(Math.pow(tav[i][1] - tav[i-1][1], 2) + Math.pow(tav[i][0] - tav[i-1][0], 2));
8252         }
8253         var p = tar.ownerDocument.documentElement.createSVGPoint(),
8254             trans = _tar.targetElement.transform;
8255         st = (st / total) * d;
8256         p.x = tav[ii][0] + (tav[ii+1][0] - tav[ii][0]) * (tg - st) / d;
8257         p.y = tav[ii][1] + (tav[ii+1][1] - tav[ii][1]) * (tg - st) / d;
8258         trans.animVal.getItem(trans.animVal.numberOfItems-1).setTranslate(p.x, p.y);
8259         var base = trans.baseVal;
8260         trans.baseVal = trans.animVal;
8261         _tar.targetElement._cacheMatrix = void 0;
8262         var evtt = _tar.ownerDocument.createEvent("MutationEvents");
8263         evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
8264         _tar.targetElement.dispatchEvent(evtt);
8265         trans.baseVal = base;
8266         evtt = base = trans = st = p = i = void 0;
8267       }
8268     }
8269     evt = trans = tpn = tgsd = void 0;
8270   }, false);
8271   this.addEventListener("endEvent", function(evt) {
8272     var tar = evt.target,
8273         trans = tar.targetElement.transform,
8274         fill = tar.getAttributeNS(null, "fill"),
8275         tavli = tar._valueList,
8276         tb;
8277     if (!fill || (fill === "remove")) {
8278       /*アニメが開始される前の状態に戻す*/
8279       var evtt = tar.ownerDocument._domnodeEvent();
8280       tar.targetElement.dispatchEvent(evtt);
8281       tar._frame && tar._frame();
8282     } else {
8283       /*_frame関数で終了位置に会わないことがあるので、以下の処理で位置を修正*/
8284       trans.animVal.getItem(trans.animVal.numberOfItems-1).setTranslate(tavli[tavli.length-1][0], tavli[tavli.length-1][1]);
8285       tb = trans.baseVal;
8286       trans.baseVal = trans.animVal;
8287       var evtt = tar.ownerDocument._domnodeEvent();
8288       tar.targetElement.dispatchEvent(evtt);
8289       trans.baseVal = tb;      
8290     }
8291     delete tar._frame;
8292     evt = evtt = trans = fill = tar = tavli = tb = void 0;
8293   }, false);
8294   this.addEventListener("repeatEvent", function(evt) {
8295     var tar = evt.target;
8296   }, false);
8297   return this;
8298 };
8299 SVGAnimateMotionElement.prototype = new SVGAnimationElement(1);
8300
8301 function SVGMPathElement() /* : 
8302                 SVGElement,
8303                 SVGURIReference,
8304                 SVGExternalResourcesRequired*/ {
8305   SVGElement.apply(this);
8306   SVGURIReference.apply(this);
8307   return this;
8308 };
8309 SVGMPathElement.prototype = new SVGElement();
8310
8311 function SVGAnimateColorElement() {
8312   SVGAnimationElement.apply(this);
8313   NAIBU.Clip[NAIBU.Clip.length] = this;
8314   this._valueList = [];
8315   this.addEventListener("DOMNodeInserted", function(evt){
8316     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8317       return; //強制終了させる
8318     }
8319     var tar = evt.target;
8320     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
8321       var tar = evt.target,
8322           attrName = tar.getAttributeNS(null, "attributeName"),
8323           ttr = tar.targetElement,
8324           fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, ""),
8325           css, n;
8326       if (!tar._values[0]) {
8327         tar._values[0] = fstyle.getPropertyValue(attrName);
8328       }
8329       for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
8330         var to = new SVGColor();
8331         if (tar._values[i] === "currentColor") {
8332           to.setRGBColor(fstyle.getPropertyValue("color") || "black");
8333         } else if (tar._values[i] === "inherit") {
8334           /*いったん、cssValueTypeプロパティをinheritに指定して、継承元のオブジェクトを取得*/
8335           css = fstyle.getPropertyCSSValue(attrName);
8336           n = css.cssValueType;
8337           css.cssValueType = /*CSSValue.CSS_INHERIT*/ 0;
8338           to = fstyle.getPropertyCSSValue(attrName);
8339           css.cssValueType = n;
8340         } else {
8341           to.setRGBColor(tar._values[i]);
8342         }
8343         tar._valueList[tar._valueList.length] = to;
8344         to = void 0;
8345       }
8346       tar = ttr = fstyle = css = n = attrName = void 0;
8347     }, false);
8348   }, false);
8349   this.addEventListener("beginEvent", function(evt) {
8350     var tar = evt.target,
8351         attrName = tar.getAttributeNS(null, "attributeName"),
8352         style = tar.ownerDocument.getOverrideStyle(tar.targetElement, ""),
8353         fstyle = tar.ownerDocument.defaultView.getComputedStyle(tar.targetElement, "");
8354     tar._frame = function() {
8355       var _tar = tar;
8356       /*公式に関しては、SMIL2.0 Animation Moduleの単純アニメーション関数の項を参照
8357        * 3.4.2 Specifying the simple animation function f(t)
8358        *http://www.w3.org/TR/2005/REC-SMIL2-20050107/animation.html#animationNS-SpecifyingAnimationFunction
8359        */
8360       var d = _tar._isRepeat ? _tar.getSimpleDuration() : _tar._activeDur,
8361           n = _tar._valueList.length - 1,
8362           tg = _tar.getCurrentTime(),
8363           ii, di, ti;
8364       _tar._activeDur || (d = 0);
8365       d *= 0.8;
8366       if ((n !== -1) && (d !== 0) && (tg <= d)) {
8367         ii = Math.floor((tg*n) / d);
8368         if (ii === n) { //iiが境い目のときは、n-2を適用
8369           ii -= 1;
8370         }
8371       } else {
8372         return;
8373       }
8374       if (tar._keyTimes) {
8375         di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d;
8376         ti = tar._keyTimes[ii];
8377       } else {
8378         di = d / n; //keyTimesがなければ均等に時間を配分しておく
8379         ti = ii / n;
8380       }
8381       var fc = _tar._valueList[ii].rgbColor,
8382           tc = _tar._valueList[ii+1].rgbColor,
8383           durd = (tg-ti*d) / di,
8384           num = CSSPrimitiveValue.CSS_NUMBER,
8385           fr = fc.red.getFloatValue(num),
8386           fg = fc.green.getFloatValue(num),
8387           fb = fc.blue.getFloatValue(num),
8388           r = fr + (tc.red.getFloatValue(num) - fr) * durd,
8389           g = fg + (tc.green.getFloatValue(num) - fg) * durd,
8390           b = fb + (tc.blue.getFloatValue(num) - fb) * durd;
8391       style.setProperty(attrName, "rgb(" +Math.ceil(r)+ "," +Math.ceil(g)+ "," +Math.ceil(b)+ ")", null);
8392       _tar = d = n = tg = fc = tc = fr = fg = fb = num = r = g = b = ii = void 0;
8393     };
8394     tar._frame();
8395   }, false);
8396   this.addEventListener("endEvent", function(evt) {
8397     var tar = evt.target,
8398         fill = tar.getAttributeNS(null, "fill");
8399     if (!fill || (fill === "remove")) {
8400       var evtt = tar.ownerDocument._domnodeEvent();
8401       tar.targetElement.dispatchEvent(evtt);
8402       tar._frame && tar._frame();
8403     }
8404     delete tar._frame;
8405     evt = evtt = tar = fill = void 0;
8406   }, false);
8407   this.addEventListener("repeatEvent", function(evt) {
8408     var tar = evt.target;
8409   }, false);
8410   return this;
8411 };
8412 SVGAnimateColorElement.prototype = new SVGAnimationElement(1);
8413
8414 function SVGAnimateTransformElement() {
8415   SVGAnimationElement.apply(this);
8416   NAIBU.Clip[NAIBU.Clip.length] = this;
8417   this.addEventListener("beginEvent", function(evt) {
8418     var tar = evt.target, trans = tar.targetElement.transform;
8419     /*アニメーション中に変化すべき値をanimValプロパティに入力して、
8420      *baseValと同じような値に設定。
8421      */
8422     trans.animVal = new SVGTransformList();
8423     if (trans.baseVal.numberOfItems !== 0) {
8424       trans.animVal.initialize(trans.baseVal.createSVGTransformFromMatrix(trans.baseVal.getItem(0).matrix));
8425     }
8426     trans.animVal.appendItem(tar.ownerDocument.documentElement.createSVGTransform());
8427   }, false);
8428   this.addEventListener("endEvent", function(evt) {
8429     var tar = evt.target,
8430         fill = tar.getAttributeNS(null, "fill");
8431     if (!fill || (fill === "remove")) {
8432       var evtt = tar.ownerDocument._domnodeEvent();
8433       tar.targetElement.dispatchEvent(evtt);
8434       tar._frame && tar._frame();
8435     }
8436     delete tar._frame;
8437     evt = evtt = tar = fill = void 0;
8438   }, false);
8439   this.addEventListener("repeatEvent", function(evt) {
8440     var tar = evt.target;
8441   }, false);
8442   return this;
8443 };
8444 SVGAnimateTransformElement.prototype = new SVGAnimationElement(1);
8445
8446 function SVGFontElement() /*: 
8447                 SVGElement,
8448                 SVGExternalResourcesRequired,
8449                 SVGStylable*/ {
8450   SVGElement.apply(this);
8451   /*_isExternalは外部から呼び出されたfont要素ならば、真(1)となる*/
8452   /*boolean or number*/ this._isExternal = 0;
8453   this.addEventListener("DOMNodeInserted", function(evt){
8454     var tar = evt.target;
8455     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8456       return;
8457     }
8458     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
8459       var tar = evt.target, svgns = "http://www.w3.org/2000/svg", fontFace = tar.getElementsByTagNameNS(svgns, "font-face").item(0);
8460       var nefunc = function(evt){
8461         var svg = evt.target;
8462         /*以下のtarはfont要素*/
8463         var familyName = fontFace.getAttributeNS(null, "font-family");
8464         var textElements = tar.ownerDocument.getElementsByTagNameNS(svgns, "text");
8465         for (var i=0,_tar=tar,tli=textElements.length;i<tli;++i) {
8466           var ti = textElements[i], style = _tar.ownerDocument.defaultView.getComputedStyle(ti, '');
8467           if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) {
8468             NAIBU._noie_createFont(ti, _tar, true);
8469           }
8470         }
8471         evt = tar = svg = curt = textElments = svgns = _tar = void 0;
8472       };
8473       if (!fontFace.__isLinked || tar._isExternal) {
8474         tar.ownerDocument.documentElement._svgload_limited = 0;
8475         tar.ownerDocument.documentElement.addEventListener("SVGLoad", nefunc, false);
8476       }
8477     }, false);
8478   }, false);
8479   return this;
8480 };
8481 SVGFontElement.prototype = new SVGElement();
8482
8483 function SVGGlyphElement() /*: 
8484                 SVGElement,
8485                 SVGStylable*/ {
8486   SVGElement.apply(this);
8487   return this;
8488 };
8489 SVGGlyphElement.prototype = new SVGElement();
8490
8491 function SVGMissingGlyphElement() /*: 
8492                 SVGElement,
8493                 SVGStylable*/ {
8494   SVGElement.apply(this);
8495   return this;
8496 };
8497 SVGMissingGlyphElement.prototype = new SVGElement();
8498
8499 function SVGHKernElement() {
8500   SVGElement.apply(this);
8501   return this;
8502 };
8503 SVGHKernElement.prototype = new SVGElement();
8504
8505 function SVGVKernElement() {
8506   SVGElement.apply(this);
8507   return this;
8508 };
8509 SVGVKernElement.prototype = new SVGElement();
8510
8511 function SVGFontFaceElement() {
8512   SVGElement.apply(this);
8513   /*boolean(or number)*/ this._isLinked = 0;
8514   this.addEventListener("DOMNodeInserted", function(evt){
8515     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8516       if (evt.target.localName === "font-face-uri") { //外部リンクがあれば
8517         evt.currentTarget._isLinked = 1;
8518       }
8519       return; //強制終了させる
8520     }
8521   }, false);
8522   return this;
8523 };
8524 SVGFontFaceElement.prototype = new SVGElement();
8525
8526 function SVGFontFaceSrcElement() {
8527   SVGElement.apply(this);
8528   return this;
8529 };
8530 SVGFontFaceSrcElement.prototype = new SVGElement();
8531
8532 function SVGFontFaceUriElement() {
8533   SVGElement.apply(this);
8534   this.addEventListener("DOMNodeInserted", function(evt){
8535     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
8536       return; //強制終了させる
8537     }
8538     evt.target.ownerDocument.documentElement._svgload_limited--
8539     evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
8540   }, false);
8541   this.addEventListener("S_Load", function(evt){
8542     var tar = evt.target, tpp = tar.parentNode.parentNode.parentNode;
8543     if (tpp.localName === "defs") {
8544       tpp = tar.parentNode.parentNode; //tppをfont-face要素としておく
8545     }
8546     tar._instance._isExternal = 1;
8547     tpp.parentNode.appendChild(tar._instance);
8548     evt = tar = tpp = void 0;
8549   }, false);
8550   SVGURIReference.apply(this);
8551   return this;
8552 };
8553 SVGFontFaceUriElement.prototype = new SVGElement();
8554
8555 function SVGFontFaceFormatElement() {
8556   SVGElement.apply(this);
8557   return this;
8558 };
8559 SVGFontFaceFormatElement.prototype = new SVGElement();
8560
8561 function SVGFontFaceNameElement() {
8562   SVGElement.apply(this);
8563   return this;
8564 };
8565 SVGFontFaceNameElement.prototype = new SVGElement();
8566
8567 function SVGDefinitionSrcElement() {
8568   SVGElement.apply(this);
8569   return this;
8570 };
8571 SVGDefinitionSrcElement.prototype = new SVGElement();
8572
8573 function SVGMetadataElement() {
8574   SVGElement.apply(this);
8575   return this;
8576 };
8577 SVGMetadataElement.prototype = new SVGElement();
8578
8579 function SVGForeignObjectElement() /*: 
8580                 SVGElement,
8581                 SVGTests,
8582                 SVGLangSpace,
8583                 SVGExternalResourcesRequired,
8584                 SVGStylable,
8585                 SVGTransformable,
8586                 events::EventTarget*/ { 
8587   SVGElement.apply(this);
8588   var sl = SVGAnimatedLength;
8589   /*readonly SVGAnimatedLength*/ this.x = new sl();
8590   /*readonly SVGAnimatedLength*/ this.y = new sl();
8591   /*readonly SVGAnimatedLength*/ this.width = new sl();
8592   /*readonly SVGAnimatedLength*/ this.height = new sl();
8593   sl = void 0;
8594   return this;
8595 };
8596 SVGForeignObjectElement.prototype = new SVGElement();
8597
8598 //#endif  _SVG_IDL_
8599 /*SVGの要素マッピング(DOMでは定められていないが、必須)
8600  *本来であれば、SVGDocumentのcreateElementNSメソッドを上書きすることが望ましいが、
8601  *SIEでは軽量化のために、マッピングを用いた
8602  */
8603 DOMImplementation["http://www.w3.org/2000/svg"] = {
8604   Document:        SVGDocument,
8605   svg:             SVGSVGElement,
8606   g:               SVGGElement,
8607   path:            NAIBU.SVGPathElement,
8608   title:           SVGTitleElement,
8609   desc:            SVGDescElement,
8610   defs:            SVGDefsElement,
8611   linearGradient:  SVGLinearGradientElement,
8612   radialGradient:  SVGRadialGradientElement,
8613   stop:            SVGStopElement,
8614   rect:            SVGRectElement,
8615   circle:          SVGCircleElement,
8616   ellipse:         SVGEllipseElement,
8617   polyline:        SVGPolylineElement,
8618   polygon:         SVGPolygonElement,
8619   text:            SVGTextElement,
8620   tspan:           SVGTSpanElement,
8621   image:           SVGImageElement,
8622   line:            SVGLineElement,
8623   a:               SVGAElement,
8624   altGlyphDef:     SVGAltGlyphDefElement,
8625   altGlyph:        SVGAltGlyphElement,
8626   altGlyphItem:    SVGAltGlyphItemElement,
8627   animateColor:    SVGAnimateColorElement,
8628   animate:         SVGAnimateElement,
8629   animateMotion:   SVGAnimateMotionElement,
8630   animateTransform:SVGAnimateTransformElement,
8631   clipPath:        SVGClipPathElement,
8632   colorProfile:    SVGColorProfileElement,
8633   cursor:          SVGCursorElement,
8634   definitionSrc:   SVGDefinitionSrcElement,
8635   feBlend:         SVGFEBlendElement,
8636   feGaussianBlur:  SVGFEGaussianBlurElement,
8637   filter:          SVGFilterElement,
8638   font:            SVGFontElement,
8639   "font-face":     SVGFontFaceElement,
8640   "font-face-format":SVGFontFaceFormatElement,
8641   "font-face-name":SVGFontFaceNameElement,
8642   "font-face-src": SVGFontFaceSrcElement,
8643   "font-face-uri": SVGFontFaceUriElement,
8644   foreignObject:   SVGForeignObjectElement,
8645   glyph:           SVGGlyphElement,
8646   glyphRef:        SVGGlyphRefElement,
8647   hkern:           SVGHKernElement,
8648   marker:          SVGMarkerElement,
8649   mask:            SVGMaskElement,
8650   metadata:        SVGMetadataElement,
8651   missingGlyph:    SVGMissingGlyphElement,
8652   mpath:           SVGMPathElement,
8653   script:          SVGScriptElement,
8654   set:             SVGSetElement,
8655   style:           SVGStyleElement,
8656   "switch":        SVGSwitchElement,
8657   "symbol":        SVGSymbolElement,
8658   textPath:        SVGTextPathElement,
8659   tref:            SVGTRefElement,
8660   use:             SVGUseElement,
8661   view:            SVGViewElement,
8662   vkern:           SVGVKernElement,
8663   pattern:         SVGPatternElement
8664 };
8665
8666 NAIBU._fontSearchURI = function(evt){
8667   var doc = evt.target.ownerDocument;
8668   var tsrc = doc.getElementsByTagNameNS("http://www.w3.org/2000/svg", "font-face-uri");
8669   for (var i=0;i<tsrc.length;++i) {
8670     var src = tsrc[i].getAttributeNS("http://www.w3.org/1999/xlink", "href"),
8671         ids = src.split(":")[1],
8672         xmlhttp = NAIBU.xmlhttp;
8673     xmlhttp.open("GET", src.replace(/#.+$/, ""), true);
8674     xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
8675     xmlhttp.onreadystatechange = function() {
8676       if ((xmlhttp.readyState === 4)  &&  (xmlhttp.status === 200)) {
8677         var doce = (new DOMParser()).parseFromString(xmlhttp.responseText, "text/xml");
8678         NAIBU._font({document:doce, docu:doc, id:ids});
8679         xmlhttp = doc = doce = void 0;
8680       }
8681     };
8682     xmlhttp.send(null);
8683   }
8684 };
8685 /*_font関数は、SVGFontで使う*/
8686 NAIBU._font = function (data) {
8687   var doc = data.document, svgns = "http://www.w3.org/2000/svg";
8688   //getElementByIdは使えないので注意(DOMParserを使った場合、DTDでの指定が必要)
8689   var font = doc.getElementsByTagNameNS(svgns, "font").item(0);
8690   var familyName = font.getElementsByTagNameNS(svgns, "font-face").item(0).getAttributeNS(null, "font-family");
8691   if (familyName && (font.getAttributeNS(null, "id") === data.id)) {
8692     var textElements = data.docu.getElementsByTagNameNS(svgns, "text");
8693     for (var i=0,tli=textElements.length;i<tli;++i) {
8694       var ti = textElements[i], style = data.docu.defaultView.getComputedStyle(ti, '');
8695       if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) {
8696         NAIBU._noie_createFont(ti, font, false);
8697       }
8698     }
8699   }
8700   doc = data = void 0;
8701 };
8702 NAIBU._noie_createFont = function(/*Element*/ ti, /*Element*/ font, /*boolean*/ isMSIE) {
8703   var style = ti.ownerDocument.defaultView.getComputedStyle(ti, ''),
8704       svgns = "http://www.w3.org/2000/svg",
8705       //isTategakiは縦書きならば真
8706       isTategaki = ti.getAttributeNS(null, "writing-mode") || ti.parentNode.getAttributeNS(null, "writing-mode"),
8707       horizOrVert = isTategaki ? "vert-adv-y" : "horiz-adv-x",
8708       node = ti.firstChild, data, glyphs = font.getElementsByTagNameNS(svgns, "glyph"),
8709       em = parseFloat(font.getElementsByTagNameNS(svgns, "font-face").item(0).getAttributeNS(null, "units-per-em") || 1000),
8710       advX = parseFloat( (font.getAttributeNS(null, horizOrVert) || em) ), //字幅の設定
8711       dx = parseFloat(ti.getAttributeNS(null, "x") || 0),
8712       dy = parseFloat(ti.getAttributeNS(null, "y") || 0),
8713       fontSize = parseFloat(style.getPropertyValue("font-size")),
8714       fe = fontSize / em,
8715       ds = false, npdlist = ["fill",
8716   "fill-opacity",
8717   "stroke",
8718   "stroke-width",
8719   "stroke-linecap",
8720   "stroke-linejoin",
8721   "stroke-miterlimit",
8722   "stroke-dasharray",
8723   "stroke-opacity",
8724   "opacity",
8725   "cursor"];
8726   if (/a/[-1] === 'a') { //Firefoxならば
8727     ds = true;
8728   } else if (isMSIE || isTategaki) {
8729     ds = true;
8730   }
8731   if (ds){
8732      while(node) {
8733       if (!glyphs) {
8734         break;
8735       }
8736       data = node.data;
8737       if (data !== void 0) { //dataがある場合
8738         var advanceX = [], glyphData = [];
8739         for (var i=0,gli=glyphs.length;i<gli;++i) {
8740           var glyph = glyphs[i], unicode = glyph.getAttributeNS(null, "unicode") || "なし"; //unicode属性に指定がない場合、処理させないようにする
8741           var orientation = glyph.getAttributeNS(null, "orientation"), isVert = true, isOrientationAttribute = true;
8742           if (orientation) {
8743             if (orientation === "h") {
8744               isVert = false;
8745             }
8746           } else {
8747             isOrientationAttribute = false;
8748           }
8749           if ( (isTategaki && isVert) || !(isTategaki || isVert) || !isOrientationAttribute){
8750             //indexは該当する文字が何番目にあるかの数字
8751             var index = data.indexOf(unicode);
8752             while (index > -1) {
8753               advanceX[index] = parseFloat(glyph.getAttributeNS(null, horizOrVert) || advX); //字幅を収納
8754               glyphData[index] = glyph.getAttributeNS(null, "d");
8755               index = data.indexOf(unicode, index+1);
8756             }
8757           }
8758         }
8759         for (var i=0,adv=0;i<data.length;++i) {
8760           if (advanceX[i] !== void 0) { //配列に含まれていれば
8761             var path = ti.ownerDocument.createElementNS(svgns, "path");
8762             //advance、すなわち字幅の長さ分、ずらしていく
8763             var matrix = ti.ownerDocument.documentElement.createSVGMatrix();
8764             matrix.a = fe;
8765             matrix.d = -fe;
8766             for (var j=0;j<npdlist.length;++j){
8767               var nj = npdlist[j],
8768                   tg = ti.getAttributeNS(null, nj) || style.getPropertyValue(nj);
8769               if (nj === "stroke-width") {
8770                 tg = style.getPropertyCSSValue(nj).getFloatValue(1) / fe;
8771                 tg += "";
8772               }
8773               if (tg) {
8774                 path.setAttributeNS(null, nj, tg);
8775               }
8776             }
8777             if (isTategaki) {
8778               var y= dy + adv*fe, x = dx;
8779               if ("、。".indexOf(data.charAt(i)) > -1) { //句読点の場合
8780                 var fms = fontSize / Math.SQRT2;
8781                 x += fms;
8782                 y -= fms;
8783                 fms = void 0;
8784               }
8785               matrix.e = x;
8786               matrix.f = y;
8787             } else {
8788               matrix.e = dx + adv*fe;
8789               matrix.f = dy;
8790             }
8791             path.setAttributeNS(null, "transform", "matrix(" +matrix.a+ "," +matrix.b+ "," +matrix.c+ "," +matrix.d+ "," +matrix.e+ "," +matrix.f+ ")");
8792             path.setAttributeNS(null, "d", glyphData[i]);
8793             ti.parentNode.insertBefore(path, ti);
8794             adv += advanceX[i];
8795             matrix = void 0;
8796           }
8797         }
8798         adv = advanceX = glyphData = void 0;
8799       } else if ("tspan|a".indexOf(node.localName) > -1){
8800         NAIBU._noie_createFont(node, font, isMSIE);
8801       }
8802       node = node.nextSibling;
8803     }
8804     if (isMSIE) {
8805       var style = ti.ownerDocument.getOverrideStyle(ti, null);
8806       style.setProperty("visibility", "hidden");
8807       style = void 0;
8808     } else {
8809       ti.setAttributeNS(null, "opacity", "0");
8810     }
8811   }
8812   data = isTategaki = horizOrVert = em = advX = dx = dy = fontSize = style = svgns = node = void 0;
8813 };
8814
8815 /*以下は、getComputedStyleメソッドで使うために、CSS2Propertiesの_listプロパティに、
8816  *CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している
8817  */
8818 (function(){
8819   var s = new CSSStyleDeclaration(),
8820        slis = s._list,
8821       n = 0,
8822       regAZ = /([A-Z])/,
8823       regm = /\-/,
8824       u, t;
8825   for (var i in CSS2Properties) {
8826     if(CSS2Properties.hasOwnProperty(i)) {
8827       t = i.replace(regAZ, "-");
8828       if (!!RegExp.$1) {
8829         u = "-" +RegExp.$1.toLowerCase();
8830       } else {
8831         u = "-";
8832       }
8833       t = t.replace(regm, u);
8834       s.setProperty(t, CSS2Properties[i]);
8835       slis[t] = slis[n]; //この処理はCSSモジュールのgetComputedStyleメソッドのため
8836       slis[n]._isDefault = 1;
8837       ++n;
8838       i = t = u =  void 0;
8839     }
8840   }
8841   slis._opacity = 1;
8842   slis._fontSize = 12;
8843   CSS2Properties._list = slis;
8844   Document.prototype.defaultView._defaultCSS = slis;
8845   s = n = regAZ = regm = slis =null;
8846 })();
8847
8848 NAIBU.addEvent = function(evt,lis){
8849   if (window.addEventListener) {
8850     window.addEventListener(evt, lis, false);
8851   } else if (window.attachEvent) {
8852     window.attachEvent('on'+evt, lis);
8853   } else {
8854     window['on'+evt] = lis;
8855   }
8856   //Sieb用
8857   if (sieb_s) {
8858     lis();
8859   }
8860 };
8861
8862 function unsvgtovml() {
8863   try {
8864     if ("stop" in NAIBU) {
8865       clearInterval(NAIBU.stop);
8866     }
8867     window.onscroll = NAIBU.emptyFunction;
8868     window.detachEvent("onload", NAIBU._main);
8869     NAIBU.freeArg();
8870     Element = SVGElement = Attr = NamedNodeMap = CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = SVGColor = SVGPaint = void 0;
8871     Array = ActiveXObject = void 0;
8872   } catch(e) {}
8873 }
8874 /*_main関数
8875  *一番最初に起動するべき関数 
8876  */
8877 NAIBU._main = (function() {
8878   stlog = new STLog(false);
8879   var xmlhttp,         //XMLHttpオブジェクトを生成
8880       _doc = document; //documentのエイリアスを作成
8881   try {
8882     if (XMLHttpRequest) {
8883       xmlhttp = false;
8884     } else {
8885       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
8886     }
8887   } catch (e) {
8888     try {
8889       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
8890     } catch (E) {
8891       xmlhttp = false;
8892     }
8893   }
8894   if (!xmlhttp) {
8895     try {
8896       xmlhttp = new XMLHttpRequest();
8897     } catch (e) {
8898       xmlhttp = false;
8899     }
8900   }
8901   NAIBU.xmlhttp = xmlhttp;
8902   var nd;
8903   if (("namespaces" in _doc) && !_doc.namespaces["v"]) {
8904     try {
8905       NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
8906     } catch (e) {
8907       
8908     }
8909     nd = NAIBU.doc;
8910     _doc.namespaces.add("v","urn:schemas-microsoft-com:vml");
8911     _doc.namespaces.add("o","urn:schemas-microsoft-com:office:office");
8912     var st = _doc.createStyleSheet(),
8913         vmlUrl = "behavior: url(#default#VML);display: inline-block;} "; //inline-blockはIEのバグ対策
8914     st.cssText = "v\\:rect{" +vmlUrl+ "v\\:image{" +vmlUrl+ "v\\:fill{" +vmlUrl+ "v\\:stroke{" +vmlUrl+ "o\\:opacity2{" +vmlUrl
8915       + "dn\\:defs{display:none}"
8916       + "v\\:group{text-indent:0px;position:relative;width:100%;height:100%;" +vmlUrl
8917       + "v\\:shape{width:100%;height:100%;" +vmlUrl;
8918   }
8919   var ary = _doc.getElementsByTagName("script");
8920   //全script要素をチェックして、type属性がimage/svg+xmlならば、中身をSVGとして処理する
8921   for (var i=0; ary[i]; ++i) {
8922     var ai = ary[i],
8923         hoge = ai.type;
8924     if (ai.type === "image/svg+xml") {
8925       var ait = ai.text;
8926       if (sieb_s && ait.match(/&lt;svg/)) {
8927         //ソース内のタグを除去
8928         ait = ait.replace(/<.+?>/g, "");
8929         //エンティティを文字に戻す
8930         ait = ait.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
8931       }
8932       if (NAIBU.isMSIE) {
8933         var gsd = new GetSVGDocument(ai);
8934         gsd.xmlhttp = {
8935           readyState : 4,
8936           status : 200,
8937           responseText : ait.replace(/\shref=/g, " target='_top' xlink:href=")
8938         }
8939         gsd._ca();
8940       } else {
8941         var base = location.href.replace(/\/[^\/]+?$/,"/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/
8942         ait = ait.replace(/\shref=(['"a-z]+?):\/\//g, " target='_top' xlink:href=$1://").replace(/\shref=(.)/g, " target='_top' xlink:href=$1"+base);
8943         var s = NAIBU.textToSVG(ait,ai.getAttribute("width"),ai.getAttribute("height"));
8944         ai.parentNode.insertBefore(s,ai);
8945       }
8946       ai = ait = void 0;
8947     }
8948     hoge = void 0;
8949   }
8950   NAIBU.doc = nd;
8951   nd = ary = void 0;
8952   if (xmlhttp && NAIBU.isMSIE) {
8953     if (!!_doc.createElementNS && !!_doc.createElementNS( "http://www.w3.org/2000/svg", "svg").createSVGRect) { //IE9ならば
8954     } else { //IE6-8ならば
8955       var ob = _doc.getElementsByTagName("object"),
8956           em = _doc.getElementsByTagName("embed"),
8957           img = _doc.getElementsByTagName("img"),
8958           s=[],
8959           t = [],
8960           _search = function(_ob) {
8961             var ifr, obi, n,
8962                 w = "width",
8963                 h = "height";
8964             s || (s = []);             //NAIBU._searchで呼ばれたときに必要
8965             _doc || (_doc = document);
8966             for (var i=0;_ob[i];++i) {
8967               obi = _ob[i];
8968               s[s.length] = new GetSVGDocument(obi);
8969               ifr = _doc.createElement("iframe");
8970               ifr.style.cssText = obi.style.cssText;
8971               ifr.style.background = "black";
8972               n = obi.getAttribute(w);
8973               n && ifr.setAttribute(w, n);
8974               n = obi.getAttribute(h);
8975               n && ifr.setAttribute(h, n);
8976               ifr.marginWidth = ifr.marginHeight = "0px"; //このマージン設定がないと、全体がずれてしまう
8977               ifr.scrolling = "no";
8978               ifr.frameBorder = "0";
8979              /*iframe要素を使って、描画のプロセスを分離する
8980               *したがって、_docはdocumentとは別のオブジェクトとなる
8981               */
8982               obi.parentNode.insertBefore(ifr, obi);
8983             }
8984             i = obi = ifr = _ob = w = h = void 0;
8985             return s[s.length-1];
8986           };
8987       _search(ob);
8988       _search(em);
8989       for (var i=0,j=0;img[i];++i) {
8990         /*img要素の処理*/
8991         if (img[i].getAttribute("src").indexOf(".svg") > -1) { //拡張子があればSVG画像と判断
8992           t[j] = img[i];
8993           ++j;
8994         }
8995       }
8996       _search(t);
8997       NAIBU._search = _search; //a要素がクリックされたときに使う関数
8998       ob = em = t = img = _search = void 0;
8999       for (var i=0;i<s.length;++i) {
9000         /*あとで変数iが使われるために、次の条件分岐が必要*/
9001         if (i < s.length-1) {
9002           s[i]._next = s[i+1]
9003         }
9004       }
9005       if (i > 0) {
9006         s[0]._init(); //初期化作業を開始
9007       }
9008       s = void 0;
9009     }
9010   } else {
9011     var ob = _doc.getElementsByTagName("object");
9012     for (var i=0;i<ob.length;++i) {
9013       if (ob[i].contentDocument) {
9014         NAIBU._fontSearchURI({target:{ownerDocument:ob[i].contentDocument}});
9015       } else if (ob[i].getSVGDocument) {
9016         ob[i].getSVGDocument()._docElement.addEventListener("SVGLoad", NAIBU._fontSearchURI, false);
9017       } else {
9018       }
9019     }
9020   }
9021   xmlhttp = _doc = void 0;
9022 });
9023 NAIBU.addEvent("load", NAIBU._main);
9024 NAIBU.utf16 = function ( /*string*/ s)  {
9025   return unescape(s);
9026 }
9027 NAIBU.unescapeUTF16 = function ( /*string*/ s) {
9028   return s.replace(/%u\w\w\w\w/g,  NAIBU.utf16);
9029 }
9030 //Text2SVG機能。SVGのソース(文章)をSVG画像に変換できる。
9031 NAIBU.textToSVG = function ( /*string*/ source, /*float*/ w, /*float*/ h) {
9032   /*Safari3.xでは、DOMParser方式だと、文字が表示されないバグがあるため、
9033    *dataスキーム方式を採用する
9034    */
9035   if (navigator.userAgent.indexOf('WebKit') > -1 || navigator.userAgent.indexOf('Safari') > -1) { //WebKit系ならば
9036     var data = 'data:image/svg+xml;charset=utf-8,' + NAIBU.unescapeUTF16(escape(source));
9037     var ob = document.createElement("object");
9038     ob.setAttribute("data",data);
9039     ob.setAttribute("width",w);
9040     ob.setAttribute("height",h);
9041     ob.setAttribute("type","image/svg+xml");
9042     return ob;
9043   } else {
9044     var doc = (new DOMParser()).parseFromString(source, "text/xml");
9045     return (document.importNode(doc.documentElement, true));
9046   }
9047 };
9048 NAIBU.addEvent("unload", unsvgtovml);
9049 //IEならばtrue
9050 NAIBU.isMSIE = /*@cc_on!@*/false;